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 278 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 177 of file cadstar_archive_parser.cpp.

178 {
179  wxASSERT( aNode->GetName() == wxT( "LINECODE" ) );
180 
181  ID = GetXmlAttributeIDString( aNode, 0 );
182  Name = GetXmlAttributeIDString( aNode, 1 );
183 
184  if( !GetXmlAttributeIDString( aNode, 2 ).ToLong( &Width ) )
185  THROW_PARSING_IO_ERROR( wxT( "Line Width" ), wxString::Format( "LINECODE -> %s", Name ) );
186 
187  XNODE* cNode = aNode->GetChildren();
188 
189  if( cNode->GetName() != wxT( "STYLE" ) )
190  THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), wxString::Format( "LINECODE -> %s", Name ) );
191 
192  wxString styleStr = GetXmlAttributeIDString( cNode, 0 );
193 
194  if( styleStr == wxT( "SOLID" ) )
195  {
197  }
198  else if( styleStr == wxT( "DASH" ) )
199  {
201  }
202  else if( styleStr == wxT( "DASHDOT" ) )
203  {
205  }
206  else if( styleStr == wxT( "DASHDOTDOT" ) )
207  {
209  }
210  else if( styleStr == wxT( "DOT" ) )
211  {
213  }
214  else
215  {
216  THROW_UNKNOWN_PARAMETER_IO_ERROR( wxString::Format( "STYLE %s", styleStr ),
217  wxString::Format( "LINECODE -> %s", Name ) );
218  }
219 }
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 281 of file cadstar_archive_parser.h.

◆ Style

LINESTYLE CADSTAR_ARCHIVE_PARSER::LINECODE::Style

Definition at line 283 of file cadstar_archive_parser.h.

◆ Width

long CADSTAR_ARCHIVE_PARSER::LINECODE::Width

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