30#include <pegtl/contrib/parse_tree.hpp>
31#include <boost/algorithm/string/replace.hpp>
32#include <boost/algorithm/string/case_conv.hpp>
33#include <boost/algorithm/string/predicate.hpp>
73 std::string result =
param.value;
104 if(
param.info.enumValues.size() >= 1 &&
param.value ==
param.info.defaultValue )
109 if( paramValuePair ==
"" )
115 result.append(
" " );
117 result.append( paramValuePair );
128 std::vector<std::reference_wrapper<const SIM_MODEL_PIN>> pins =
m_model.
GetPins();
133 std::sort( pins.begin(), pins.end(),
136 return StrNumCmp( lhs.symbolPinNumber, rhs.symbolPinNumber, true ) < 0;
141 std::string symbolPinNumber(
pin.symbolPinNumber.ToUTF8() );
143 if( symbolPinNumber !=
"" )
145 if( !result.empty() )
146 result.append(
" " );
148 result.append( fmt::format(
"{}={}", symbolPinNumber,
pin.modelPinName ) );
166 tao::pegtl::string_input<> in( aValue,
"Value field" );
174 for(
const auto& node : root->children )
177 SIM_VALUE::NOTATION::SI>>()
178 && node->string() !=
"" )
184 catch(
const tao::pegtl::parse_error& e )
195 tao::pegtl::string_input<> in( aParams,
"Sim.Params field" );
196 std::unique_ptr<tao::pegtl::parse_tree::node> root;
208 catch(
const tao::pegtl::parse_error& e )
213 std::string paramName;
214 bool isPrimaryValueSet =
false;
216 for(
const auto& node : root->children )
220 paramName = node->string();
227 wxASSERT( paramName !=
"" );
232 isPrimaryValueSet =
true;
236 std::string str = node->string();
239 boost::replace_all( str,
"\\\"",
"\"" );
245 std::string token = node->string();
264 tao::pegtl::string_input<> in( aPins,
"Sim.Pins field" );
265 std::unique_ptr<tao::pegtl::parse_tree::node> root;
275 for(
const auto& node : root->children )
277 std::string symbolPinNumber = node->children.at( 0 )->string();
278 std::string modelPinName = node->children.at( 1 )->string();
283 catch(
const tao::pegtl::parse_error& e )
295 char c = boost::to_lower_copy( aEnable )[0];
297 if( c ==
'n' || c ==
'f' || c ==
'0' )
307 if( boost::ends_with(
name,
"_" ) )
310 std::string value = aParam.
value;
313 return value ==
"1" ?
name :
"";
315 if( value ==
"" || value.find(
' ' ) != std::string::npos )
316 value = fmt::format(
"\"{}\"", value );
318 return fmt::format(
"{}={}",
name, value );
std::string GeneratePins() const
void ParsePins(const std::string &aPins)
std::string generateParamValuePair(const SIM_MODEL::PARAM &aParam) const
std::string GenerateParams() const
std::string GenerateValue() const
void ParseValue(const std::string &aValue)
void ParseEnable(const std::string &aEnable)
std::string GenerateEnable() const
std::string GenerateDevice() const
bool ParseParams(const std::string &aParams)
std::string GenerateDeviceSubtype() const
const SIM_MODEL * GetBaseModel() const
bool IsStoredInValue() const
virtual const PARAM & GetParam(unsigned aParamIndex) const
int GetParamCount() const
void AssignSymbolPinNumberToModelPin(int aPinIndex, const wxString &aSymbolPinNumber)
DEVICE_INFO GetDeviceInfo() const
const PARAM & GetParamOverride(unsigned aParamIndex) const
virtual bool HasAutofill() const
void SetIsEnabled(bool aIsEnabled)
void SetParamValue(int aParamIndex, const std::string &aValue, SIM_VALUE::NOTATION aNotation=SIM_VALUE::NOTATION::SI)
void SetIsStoredInValue(bool aIsStoredInValue)
virtual bool HasPrimaryValue() const
std::vector< std::reference_wrapper< const SIM_MODEL_PIN > > GetPins() const
#define THROW_IO_ERROR(msg)
must_if< error >::control< Rule > control
bool Matches(const std::string &aName) const