KiCad PCB EDA Suite
CADSTAR_PCB_ARCHIVE_PARSER::LAYERDEFS Struct Reference

#include <cadstar_pcb_archive_parser.h>

Inheritance diagram for CADSTAR_PCB_ARCHIVE_PARSER::LAYERDEFS:

Public Member Functions

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

Public Attributes

std::map< MATERIAL_ID, MATERIALMaterials
 
std::map< LAYER_ID, LAYERLayers
 
std::vector< LAYER_IDLayerStack
 

Detailed Description

Definition at line 173 of file cadstar_pcb_archive_parser.h.

Member Function Documentation

◆ Parse()

void CADSTAR_PCB_ARCHIVE_PARSER::LAYERDEFS::Parse ( XNODE aNode,
PARSER_CONTEXT aContext 
)
override

Definition at line 159 of file cadstar_pcb_archive_parser.cpp.

160 {
161  wxASSERT( aNode->GetName() == wxT( "LAYERDEFS" ) );
162 
163  wxXmlAttribute* xmlAttribute = nullptr;
164 
165  XNODE* cNode = aNode->GetChildren();
166 
167  if( !cNode )
168  THROW_MISSING_PARAMETER_IO_ERROR( wxT( "LAYERSTACK" ), wxT( "LAYERDEFS" ) );
169 
170  for( ; cNode; cNode = cNode->GetNext() )
171  {
172  wxString nodeName = cNode->GetName();
173 
174  if( nodeName == wxT( "LAYERSTACK" ) )
175  {
176  xmlAttribute = cNode->GetAttributes();
177 
178  for( ; xmlAttribute; xmlAttribute = xmlAttribute->GetNext() )
179  {
180  if( !IsValidAttribute( xmlAttribute ) )
181  continue;
182  else
183  LayerStack.push_back( (LAYER_ID) xmlAttribute->GetValue() );
184  }
185 
186  CheckNoChildNodes( cNode );
187  }
188  else if( nodeName == wxT( "MATERIAL" ) )
189  {
190  MATERIAL material;
191  material.Parse( cNode, aContext );
192  Materials.insert( std::make_pair( material.ID, material ) );
193  }
194  else if( nodeName == wxT( "LAYER" ) )
195  {
196  LAYER layer;
197  layer.Parse( cNode, aContext );
198  Layers.insert( std::make_pair( layer.ID, layer ) );
199  }
200  else if( nodeName == wxT( "SWAPPAIR" ) )
201  {
202  LAYER_ID layerId = (LAYER_ID) GetXmlAttributeIDString( cNode, 0 );
203  LAYER_ID swapLayerId = (LAYER_ID) GetXmlAttributeIDString( cNode, 1 );
204 
205  Layers[layerId].SwapLayerID = swapLayerId;
206  }
207  else
208  {
209  THROW_UNKNOWN_NODE_IO_ERROR( nodeName, aNode->GetName() );
210  }
211  }
212 }
static bool IsValidAttribute(wxXmlAttribute *aAttribute)
std::map< MATERIAL_ID, MATERIAL > Materials
#define THROW_MISSING_PARAMETER_IO_ERROR(param, location)
static void CheckNoChildNodes(XNODE *aNode)
Base material class that can be used to derive other material implementations.
Definition: material.h:239
XNODE * GetChildren() const
Definition: xnode.h:62
Hold an XML or S-expression element.
Definition: xnode.h:43
XNODE * GetNext() const
Definition: xnode.h:67
Container to hold information pertinent to a layer of a BOARD.
Definition: board.h:82
wxString LAYER_ID
ID of a Sheet (if schematic) or board Layer (if PCB)
#define THROW_UNKNOWN_NODE_IO_ERROR(nodename, location)
static wxString GetXmlAttributeIDString(XNODE *aNode, unsigned int aID, bool aIsRequired=true)

References CADSTAR_ARCHIVE_PARSER::CheckNoChildNodes(), XNODE::GetChildren(), XNODE::GetNext(), CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString(), CADSTAR_PCB_ARCHIVE_PARSER::MATERIAL::ID, CADSTAR_PCB_ARCHIVE_PARSER::LAYER::ID, CADSTAR_ARCHIVE_PARSER::IsValidAttribute(), CADSTAR_PCB_ARCHIVE_PARSER::MATERIAL::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::LAYER::Parse(), THROW_MISSING_PARAMETER_IO_ERROR, and THROW_UNKNOWN_NODE_IO_ERROR.

Referenced by CADSTAR_PCB_ARCHIVE_PARSER::ASSIGNMENTS::Parse().

Member Data Documentation

◆ Layers

◆ LayerStack

std::vector<LAYER_ID> CADSTAR_PCB_ARCHIVE_PARSER::LAYERDEFS::LayerStack

◆ Materials

std::map<MATERIAL_ID, MATERIAL> CADSTAR_PCB_ARCHIVE_PARSER::LAYERDEFS::Materials

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