KiCad PCB EDA Suite
CADSTAR_ARCHIVE_PARSER::LINECODE Struct Reference

#include <cadstar_archive_parser.h>

Inheritance diagram for CADSTAR_ARCHIVE_PARSER::LINECODE:
CADSTAR_ARCHIVE_PARSER::PARSER

Public Member Functions

void Parse (XNODE *aNode, PARSER_CONTEXT *aContext) override
 

Public Attributes

LINECODE_ID ID
 
wxString Name
 
long Width
 
LINESTYLE Style
 

Detailed Description

Definition at line 290 of file cadstar_archive_parser.h.

Member Function Documentation

◆ Parse()

void CADSTAR_ARCHIVE_PARSER::LINECODE::Parse ( XNODE aNode,
PARSER_CONTEXT aContext 
)
overridevirtual

Implements CADSTAR_ARCHIVE_PARSER::PARSER.

Definition at line 183 of file cadstar_archive_parser.cpp.

184 {
185  wxASSERT( aNode->GetName() == wxT( "LINECODE" ) );
186 
187  ID = GetXmlAttributeIDString( aNode, 0 );
188  Name = GetXmlAttributeIDString( aNode, 1 );
189 
190  if( !GetXmlAttributeIDString( aNode, 2 ).ToLong( &Width ) )
191  THROW_PARSING_IO_ERROR( wxT( "Line Width" ), wxString::Format( "LINECODE -> %s", Name ) );
192 
193  XNODE* cNode = aNode->GetChildren();
194 
195  if( cNode->GetName() != wxT( "STYLE" ) )
196  THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), wxString::Format( "LINECODE -> %s", Name ) );
197 
198  wxString styleStr = GetXmlAttributeIDString( cNode, 0 );
199 
200  if( styleStr == wxT( "SOLID" ) )
201  {
203  }
204  else if( styleStr == wxT( "DASH" ) )
205  {
207  }
208  else if( styleStr == wxT( "DASHDOT" ) )
209  {
211  }
212  else if( styleStr == wxT( "DASHDOTDOT" ) )
213  {
215  }
216  else if( styleStr == wxT( "DOT" ) )
217  {
219  }
220  else
221  {
222  THROW_UNKNOWN_PARAMETER_IO_ERROR( wxString::Format( "STYLE %s", styleStr ),
223  wxString::Format( "LINECODE -> %s", Name ) );
224  }
225 }
XNODE * GetChildren() const
Definition: xnode.h:62
#define THROW_PARSING_IO_ERROR(param, location)
Hold an XML or S-expression element.
Definition: xnode.h:43
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
#define THROW_UNKNOWN_NODE_IO_ERROR(nodename, location)
static wxString GetXmlAttributeIDString(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
#define THROW_UNKNOWN_PARAMETER_IO_ERROR(param, location)

References CADSTAR_ARCHIVE_PARSER::DASH, CADSTAR_ARCHIVE_PARSER::DASHDOT, CADSTAR_ARCHIVE_PARSER::DASHDOTDOT, CADSTAR_ARCHIVE_PARSER::DOT, Format(), XNODE::GetChildren(), CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString(), CADSTAR_ARCHIVE_PARSER::SOLID, THROW_PARSING_IO_ERROR, THROW_UNKNOWN_NODE_IO_ERROR, and THROW_UNKNOWN_PARAMETER_IO_ERROR.

Referenced by CADSTAR_ARCHIVE_PARSER::CODEDEFS::ParseSubNode().

Member Data Documentation

◆ ID

LINECODE_ID CADSTAR_ARCHIVE_PARSER::LINECODE::ID

◆ Name

wxString CADSTAR_ARCHIVE_PARSER::LINECODE::Name

Definition at line 293 of file cadstar_archive_parser.h.

◆ Style

LINESTYLE CADSTAR_ARCHIVE_PARSER::LINECODE::Style

Definition at line 295 of file cadstar_archive_parser.h.

◆ Width

long CADSTAR_ARCHIVE_PARSER::LINECODE::Width

The documentation for this struct was generated from the following files: