28#include <pegtl/contrib/parse_tree.hpp>
29#include <boost/algorithm/string/replace.hpp>
30#include <boost/algorithm/string/case_conv.hpp>
31#include <boost/algorithm/string/predicate.hpp>
71 std::string result =
param.value;
102 if(
param.info.enumValues.size() >= 1 &&
param.value ==
param.info.defaultValue )
107 if( paramValuePair ==
"" )
113 result.append(
" " );
115 result.append( paramValuePair );
126 std::vector<std::reference_wrapper<const SIM_MODEL_PIN>> pins =
m_model.
GetPins();
131 std::sort( pins.begin(), pins.end(),
134 return StrNumCmp( lhs.symbolPinNumber, rhs.symbolPinNumber, true ) < 0;
139 std::string symbolPinNumber(
pin.symbolPinNumber.ToUTF8() );
141 if( symbolPinNumber !=
"" )
143 if( !result.empty() )
144 result.append(
" " );
146 result.append( fmt::format(
"{}={}", symbolPinNumber,
pin.modelPinName ) );
164 tao::pegtl::string_input<> in( aValue,
"Value field" );
172 for(
const auto& node : root->children )
175 SIM_VALUE::NOTATION::SI>>()
176 && node->string() !=
"" )
182 catch(
const tao::pegtl::parse_error& e )
193 tao::pegtl::string_input<> in( aParams,
"Sim.Params field" );
194 std::unique_ptr<tao::pegtl::parse_tree::node> root;
206 catch(
const tao::pegtl::parse_error& e )
211 std::string paramName;
212 bool isPrimaryValueSet =
false;
214 for(
const auto& node : root->children )
218 paramName = node->string();
225 wxASSERT( paramName !=
"" );
230 isPrimaryValueSet =
true;
234 std::string str = node->string();
237 boost::replace_all( str,
"\\\"",
"\"" );
243 std::string token = node->string();
262 tao::pegtl::string_input<> in( aPins,
"Sim.Pins field" );
263 std::unique_ptr<tao::pegtl::parse_tree::node> root;
273 for(
const auto& node : root->children )
275 std::string symbolPinNumber = node->children.at( 0 )->string();
276 std::string modelPinName = node->children.at( 1 )->string();
281 catch(
const tao::pegtl::parse_error& e )
293 char c = boost::to_lower_copy( aEnable )[0];
295 if( c ==
'n' || c ==
'f' || c ==
'0' )
305 if( boost::ends_with(
name,
"_" ) )
308 std::string value = aParam.
value;
311 return value ==
"1" ?
name :
"";
313 if( value ==
"" || value.find(
' ' ) != std::string::npos )
314 value = fmt::format(
"\"{}\"", value );
316 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