diff --git a/eeschema/netlist_exporters/netlist_exporter_spice.cpp b/eeschema/netlist_exporters/netlist_exporter_spice.cpp index 2f4217631d..87698e9514 100644 --- a/eeschema/netlist_exporters/netlist_exporter_spice.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_spice.cpp @@ -180,7 +180,7 @@ void NETLIST_EXPORTER_SPICE::ReadDirectives() else continue; - tao::pegtl::string_input<> in( text.ToStdString() + "\n", "from_content" ); + tao::pegtl::string_input<> in( ( text + "\n" ).ToUTF8(), "from_content" ); std::unique_ptr root; try @@ -320,8 +320,8 @@ bool NETLIST_EXPORTER_SPICE::readModel( SCH_SYMBOL& aSymbol, SPICE_ITEM& aItem ) catch( const IO_ERROR& e ) { DisplayErrorMessage( nullptr, - wxString::Format( "Failed reading %s simulation model.", aItem.refName ), - e.What() ); + wxString::Format( _( "Failed reading %s simulation model." ), aItem.refName ), + e.What() ); return false; } } diff --git a/eeschema/sim/sim_model.cpp b/eeschema/sim/sim_model.cpp index 7f1eb5c46e..7024470f41 100644 --- a/eeschema/sim/sim_model.cpp +++ b/eeschema/sim/sim_model.cpp @@ -380,9 +380,9 @@ SIM_MODEL::SPICE_INFO SIM_MODEL::SpiceInfo( TYPE aType ) } -TYPE SIM_MODEL::ReadTypeFromSpiceCode( const std::string& aSpiceCode ) +TYPE SIM_MODEL::ReadTypeFromSpiceCode( const wxString& aSpiceCode ) { - tao::pegtl::string_input<> in( aSpiceCode, "Spice_Code" ); + tao::pegtl::string_input<> in( aSpiceCode.ToUTF8(), "Spice_Code" ); std::unique_ptr root; try @@ -584,7 +584,7 @@ TYPE SIM_MODEL::InferTypeFromRefAndValue( const wxString& aRef, const wxString& case TYPE::TLINE_Z0: try { - tao::pegtl::string_input<> in( aValue.ToStdString(), "Value" ); + tao::pegtl::string_input<> in( aValue.ToUTF8(), "Value" ); auto root = tao::pegtl::parse_tree::parse< SIM_MODEL_PARSER::fieldParamValuePairsGrammar, SIM_MODEL_PARSER::fieldParamValuePairsSelector> @@ -700,7 +700,7 @@ std::unique_ptr SIM_MODEL::Create( TYPE aType, unsigned aSymbolPinCou } -std::unique_ptr SIM_MODEL::Create( const std::string& aSpiceCode ) +std::unique_ptr SIM_MODEL::Create( const wxString& aSpiceCode ) { std::unique_ptr model = create( ReadTypeFromSpiceCode( aSpiceCode ) ); @@ -837,12 +837,12 @@ void SIM_MODEL::SetFieldValue( std::vector& aFields, const wxString& aFieldNa } -void SIM_MODEL::ReadSpiceCode( const std::string& aSpiceCode ) +void SIM_MODEL::ReadSpiceCode( const wxString& aSpiceCode ) { // The default behavior is to treat the Spice param=value pairs as the model parameters and // values (for many models the correspondence is not exact, so this function is overridden). - tao::pegtl::string_input<> in( aSpiceCode, "Spice_Code" ); + tao::pegtl::string_input<> in( aSpiceCode.ToUTF8(), "Spice_Code" ); std::unique_ptr root; try @@ -1260,7 +1260,7 @@ void SIM_MODEL::ParseParamsField( const wxString& aParamsField ) { LOCALE_IO toggle; - tao::pegtl::string_input<> in( aParamsField.ToStdString(), "Sim_Params" ); + tao::pegtl::string_input<> in( aParamsField.ToUTF8(), "Sim_Params" ); std::unique_ptr root; try @@ -1329,7 +1329,7 @@ void SIM_MODEL::ParsePinsField( unsigned aSymbolPinCount, const wxString& aPinsF LOCALE_IO toggle; - tao::pegtl::string_input<> in( aPinsField.ToStdString(), PINS_FIELD ); + tao::pegtl::string_input<> in( aPinsField.ToUTF8(), PINS_FIELD ); std::unique_ptr root; try diff --git a/eeschema/sim/sim_model.h b/eeschema/sim/sim_model.h index b481ace6e0..581534b3c8 100644 --- a/eeschema/sim/sim_model.h +++ b/eeschema/sim/sim_model.h @@ -373,7 +373,7 @@ public: DIR aDir = DIR_INOUT, SIM_VALUE::TYPE aType = SIM_VALUE::TYPE_FLOAT, FLAGS aFlags = {}, - std::string aUnit = "", + const wxString& aUnit = "", CATEGORY aCategory = CATEGORY::PRINCIPAL, const wxString& aDefaultValue = "", const wxString& aDefaultValueOfOtherVariant = "", @@ -415,7 +415,7 @@ public: static SPICE_INFO SpiceInfo( TYPE aType ); - static TYPE ReadTypeFromSpiceCode( const std::string& aSpiceCode ); + static TYPE ReadTypeFromSpiceCode( const wxString& aSpiceCode ); template static TYPE ReadTypeFromFields( const std::vector& aFields ); @@ -427,7 +427,7 @@ public: static std::unique_ptr Create( TYPE aType, unsigned aSymbolPinCount = 0 ); - static std::unique_ptr Create( const std::string& aSpiceCode ); + static std::unique_ptr Create( const wxString& aSpiceCode ); static std::unique_ptr Create( const SIM_MODEL& aBaseModel, unsigned aSymbolPinCount ); @@ -456,7 +456,7 @@ public: SIM_MODEL& operator=(SIM_MODEL&& aOther ) = delete; - virtual void ReadSpiceCode( const std::string& aSpiceCode ); + virtual void ReadSpiceCode( const wxString& aSpiceCode ); template void ReadDataFields( unsigned aSymbolPinCount, const std::vector* aFields ); diff --git a/eeschema/sim/sim_model_ideal.cpp b/eeschema/sim/sim_model_ideal.cpp index 94bfb79686..783f2444b0 100644 --- a/eeschema/sim/sim_model_ideal.cpp +++ b/eeschema/sim/sim_model_ideal.cpp @@ -127,7 +127,7 @@ void SIM_MODEL_IDEAL::inferredReadDataFields( unsigned aSymbolPinCount, const st { wxString value = GetFieldValue( aFields, VALUE_FIELD ); - tao::pegtl::string_input<> in( value.ToStdString(), "Value" ); + tao::pegtl::string_input<> in( value.ToUTF8(), "Value" ); auto root = tao::pegtl::parse_tree::parse< SIM_MODEL_PARSER::fieldFloatValueGrammar, SIM_MODEL_PARSER::fieldFloatValueSelector> diff --git a/eeschema/sim/sim_model_source.cpp b/eeschema/sim/sim_model_source.cpp index b9437af42f..69423f8244 100644 --- a/eeschema/sim/sim_model_source.cpp +++ b/eeschema/sim/sim_model_source.cpp @@ -113,7 +113,7 @@ wxString SIM_MODEL_SOURCE::GenerateSpiceItemLine( const wxString& aRefName, case TYPE::V_PWL: case TYPE::I_PWL: { - tao::pegtl::string_input<> in( GetParam( 0 ).value->ToString().ToStdString(), + tao::pegtl::string_input<> in( GetParam( 0 ).value->ToString().ToUTF8(), "from_content" ); std::unique_ptr root; diff --git a/eeschema/sim/sim_model_subckt.cpp b/eeschema/sim/sim_model_subckt.cpp index 232f57da62..001e1df5bd 100644 --- a/eeschema/sim/sim_model_subckt.cpp +++ b/eeschema/sim/sim_model_subckt.cpp @@ -52,9 +52,9 @@ SIM_MODEL_SUBCKT::SIM_MODEL_SUBCKT( TYPE aType ) } -void SIM_MODEL_SUBCKT::ReadSpiceCode( const std::string& aSpiceCode ) +void SIM_MODEL_SUBCKT::ReadSpiceCode( const wxString& aSpiceCode ) { - tao::pegtl::string_input<> in( aSpiceCode, "from_content" ); + tao::pegtl::string_input<> in( aSpiceCode.ToUTF8(), "from_content" ); std::unique_ptr root; try diff --git a/eeschema/sim/sim_model_subckt.h b/eeschema/sim/sim_model_subckt.h index bd9e0ad653..77444fc851 100644 --- a/eeschema/sim/sim_model_subckt.h +++ b/eeschema/sim/sim_model_subckt.h @@ -33,7 +33,7 @@ class SIM_MODEL_SUBCKT : public SIM_MODEL public: SIM_MODEL_SUBCKT( TYPE aType ); - void ReadSpiceCode( const std::string& aSpiceCode ) override; + void ReadSpiceCode( const wxString& aSpiceCode ) override; wxString GenerateSpiceModelLine( const wxString& aModelName ) const override; std::vector GenerateSpiceCurrentNames( const wxString& aRefName ) const override; void SetBaseModel( const SIM_MODEL& aBaseModel ) override; diff --git a/eeschema/sim/sim_value.cpp b/eeschema/sim/sim_value.cpp index 72c3298bc3..e9e6d36fd2 100644 --- a/eeschema/sim/sim_value.cpp +++ b/eeschema/sim/sim_value.cpp @@ -128,7 +128,7 @@ bool SIM_VALUE_GRAMMAR::IsValid( const wxString& aString, SIM_VALUE::TYPE aValueType, NOTATION aNotation ) { - tao::pegtl::string_input<> in( aString.ToStdString(), "from_content" ); + tao::pegtl::string_input<> in( aString.ToUTF8(), "from_content" ); try { @@ -192,7 +192,7 @@ SIM_VALUE_PARSER::PARSE_RESULT SIM_VALUE_PARSER::Parse( const wxString& aString, { LOCALE_IO toggle; - tao::pegtl::string_input<> in( aString.ToStdString(), "from_content" ); + tao::pegtl::string_input<> in( aString.ToUTF8(), "from_content" ); std::unique_ptr root; PARSE_RESULT result;