35#include <wx/strconv.h> 
   38#include <pegtl/contrib/parse_tree.hpp> 
   65                                      std::vector<std::pair<std::string, std::string>>* aQueue )
 
   69        std::string fileContents = 
SafeReadFile( aFilePath, wxS( 
"r" ) ).ToStdString( wxConvUTF8 );
 
   70        std::string filePath = aFilePath.ToStdString( wxConvUTF8 );
 
   72        tao::pegtl::string_input<> in( fileContents, filePath );
 
   78        for( 
const auto& node : root->children )
 
   82                aQueue->emplace_back( node->children.at( 0 )->string(), node->string() );
 
   86                wxString lib = 
m_library.m_pathResolver( node->children.at( 0 )->string(), aFilePath );
 
  103                wxFAIL_MSG( 
"Unhandled parse tree node" );
 
  111    catch( 
const tao::pegtl::parse_error& e )
 
 
  123    std::vector<std::pair<std::string, std::string>> modelQueue;
 
  125    parseFile( aFilePath, aReporter, &modelQueue );
 
  127    m_library.m_models.reserve( modelQueue.size() );
 
  128    m_library.m_modelNames.reserve( modelQueue.size() );
 
  130    for( 
const auto& [
name, source] : modelQueue )
 
  132        m_library.m_models.emplace_back( 
nullptr );
 
  137            [&]( 
int ii, 
bool firstPass )
 
  140                                                                  firstPass, aReporter );
 
  146    auto results = 
tp.submit_loop( 0, modelQueue.size(),
 
  149                                createModel( ii, true );
 
  154    for( 
int ii = 0; ii < (int) modelQueue.size(); ++ii )
 
  157            createModel( ii, 
false );
 
 
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
 
virtual const wxString What() const
A composite of Problem() and Where()
 
A pure virtual class used to derive REPORTER objects from.
 
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Report a string with a given severity.
 
static std::unique_ptr< SIM_MODEL_SPICE > Create(const SIM_LIBRARY_SPICE &aLibrary, const std::string &aSpiceCode, bool aFirstPass, REPORTER &aReporter)
 
SIM_LIBRARY_SPICE & m_library
 
virtual void ReadFile(const wxString &aFilePath, REPORTER &firstPass)
 
void parseFile(const wxString &aFilePath, REPORTER &aReporter, std::vector< std::pair< std::string, std::string > > *aModelQueue)
 
must_if< error >::control< Rule > control
 
wxString SafeReadFile(const wxString &aFilePath, const wxString &aReadType)
Nominally opens a file and reads it into a string.
 
thread_pool & GetKiCadThreadPool()
Get a reference to the current thread pool.
 
BS::thread_pool< 0 > thread_pool