27#include <boost/algorithm/string/predicate.hpp>
28#include <boost/algorithm/string/trim.hpp>
35 return fmt::format(
"__{}", aItem.
refName );
51 result.append( fmt::format(
".model {} ", aItem.
modelName ) );
52 size_t indentLength = result.length();
58 result.append( fmt::format(
" level={}", spiceInfo.
level ) );
60 if ( !spiceInfo.
version.empty() )
61 result.append( fmt::format(
" version={}", spiceInfo.
version ) );
63 result.append(
"\n" );
83 if( boost::ends_with( param.
info.
name,
"_" ) )
97 result.append( fmt::format(
"+{}\n",
name ) );
101 result.append( fmt::format(
"+{}{}={}\n",
102 std::string( indentLength - 1,
' ' ),
109 if( result.length() == indentLength + 1 )
123 item.
pinNumbers.push_back( fmt::format(
"{}", i + 1 ) );
137 result.append(
"\n" );
159 pin.symbolPinNumber );
163 result.append( fmt::format(
" NC-{}-{}", aItem.
refName, ncCounter++ ) );
167 long symbolPinIndex = std::distance( aItem.
pinNumbers.begin(), it );
168 result.append( fmt::format(
" {}", aItem.
pinNetNames.at( symbolPinIndex ) ) );
178 return fmt::format(
" {}", aItem.
modelName );
200 result.append( fmt::format(
" {}",
name ) );
205 result.append( fmt::format(
" {}={}",
name, value ) );
222 return { fmt::format(
"I({})",
ItemName( aItem ) ) };
228 std::string spiceCode =
ModelLine( aItem );
230 std::string itemLine =
ItemLine( aItem );
232 if( spiceCode !=
"" )
233 spiceCode.append(
"\n" );
235 spiceCode.append( itemLine );
236 return boost::trim_copy( spiceCode );
virtual bool requiresSpiceModelLine(const SPICE_ITEM &aItem) const
virtual const PARAM & GetParam(unsigned aParamIndex) const
int GetParamCount() const
SPICE_INFO GetSpiceInfo() const
static std::string ToSpice(const std::string &aString)
virtual std::string ItemName(const SPICE_ITEM &aItem) const
virtual std::string ItemPins(const SPICE_ITEM &aItem) const
virtual std::string ItemLine(const SPICE_ITEM &aItem) const
virtual std::string ModelLine(const SPICE_ITEM &aItem) const
virtual std::vector< std::reference_wrapper< const SIM_MODEL_PIN > > GetPins() const
virtual std::string ItemParams() const
const SIM_MODEL & m_model
virtual std::string Preview(const SPICE_ITEM &aItem) const
virtual std::string ItemModelName(const SPICE_ITEM &aItem) const
virtual std::string TunerCommand(const SPICE_ITEM &aItem, double aValue) const
virtual std::string ModelName(const SPICE_ITEM &aItem) const
virtual std::vector< std::string > CurrentNames(const SPICE_ITEM &aItem) const
std::string spiceModelName
std::string spiceInstanceName
bool isSpiceInstanceParam
std::vector< std::string > pinNetNames
std::string baseModelName
std::vector< std::string > pinNumbers