KiCad PCB EDA Suite
CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT Struct Reference

#include <cadstar_pcb_archive_parser.h>

Inheritance diagram for CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT:
CADSTAR_ARCHIVE_PARSER::PARSER

Public Member Functions

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

Public Attributes

COMPONENT_ID ID
 
wxString Name
 Designator e.g. "C1", "R1", etc. More...
 
PART_ID PartID
 
SYMDEF_ID SymdefID
 
POINT Origin
 Origin of the component (this is used as the reference point when placing the component in the design) More...
 
GROUP_ID GroupID = wxEmptyString
 If not empty, this component is part of a group. More...
 
REUSEBLOCKREF ReuseBlockRef
 
COMPONENT_ID VariantParentComponentID = wxEmptyString
 
VARIANT_ID VariantID = wxEmptyString
 
long OrientAngle = 0
 
bool TestPoint = false
 Indicates whether this component should be treated as a testpoint. More...
 
bool Mirror = false
 
bool Fixed = false
 
READABILITY Readability = READABILITY::BOTTOM_TO_TOP
 
std::map< ATTRIBUTE_ID, TEXT_LOCATION > TextLocations
 This contains location of any attributes, including designator position. More...
 
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
 
std::map< PART_DEFINITION_PIN_ID, wxString > PinLabels
 This is inherited from the PARTS library but is allowed to be out of sync. More...
 
std::map< PART_DEFINITION_PIN_ID, PIN_ATTRIBUTEPinAttributes
 
std::map< PAD_ID, PADEXCEPTIONPadExceptions
 Override pad definitions for this instance. More...
 

Detailed Description

Definition at line 895 of file cadstar_pcb_archive_parser.h.

Member Function Documentation

◆ Parse()

void CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::Parse ( XNODE aNode,
PARSER_CONTEXT aContext 
)
overridevirtual

Implements CADSTAR_ARCHIVE_PARSER::PARSER.

Definition at line 1828 of file cadstar_pcb_archive_parser.cpp.

1829 {
1830  wxASSERT( aNode->GetName() == wxT( "COMP" ) );
1831 
1832  ID = GetXmlAttributeIDString( aNode, 0 );
1833  Name = GetXmlAttributeIDString( aNode, 1 );
1834  PartID = GetXmlAttributeIDString( aNode, 2 );
1835  SymdefID = GetXmlAttributeIDString( aNode, 3 );
1836 
1837  XNODE* cNode = aNode->GetChildren();
1838  bool originParsed = false;
1839 
1840  for( ; cNode; cNode = cNode->GetNext() )
1841  {
1842  wxString cNodeName = cNode->GetName();
1843 
1844  if( !originParsed && cNodeName == wxT( "PT" ) )
1845  {
1846  Origin.Parse( cNode, aContext );
1847  originParsed = true;
1848  }
1849  else if( cNodeName == wxT( "GROUPREF" ) )
1850  {
1851  GroupID = GetXmlAttributeIDString( cNode, 0 );
1852  }
1853  else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
1854  {
1855  ReuseBlockRef.Parse( cNode, aContext );
1856  }
1857  else if( cNodeName == wxT( "TESTPOINT" ) )
1858  {
1859  TestPoint = true;
1860  }
1861  else if( cNodeName == wxT( "FIX" ) )
1862  {
1863  Fixed = true;
1864  }
1865  else if( cNodeName == wxT( "MIRROR" ) )
1866  {
1867  Mirror = true;
1868  }
1869  else if( cNodeName == wxT( "READABILITY" ) )
1870  {
1871  Readability = ParseReadability( cNode );
1872  }
1873  else if( cNodeName == wxT( "ORIENT" ) )
1874  {
1875  OrientAngle = GetXmlAttributeIDLong( cNode, 0 );
1876  }
1877  else if( cNodeName == wxT( "VCOMPMASTER" ) )
1878  {
1880  VariantID = GetXmlAttributeIDString( cNode, 1 );
1881  }
1882  else if( cNodeName == wxT( "TEXTLOC" ) )
1883  {
1884  TEXT_LOCATION textloc;
1885  textloc.Parse( cNode, aContext );
1886  TextLocations.insert( std::make_pair( textloc.AttributeID, textloc ) );
1887  }
1888  else if( cNodeName == wxT( "ATTR" ) )
1889  {
1890  ATTRIBUTE_VALUE attrVal;
1891  attrVal.Parse( cNode, aContext );
1892  AttributeValues.insert( std::make_pair( attrVal.AttributeID, attrVal ) );
1893  }
1894  else if( cNodeName == wxT( "PINATTR" ) )
1895  {
1896  PIN_ATTRIBUTE pinAttr;
1897  pinAttr.Parse( cNode, aContext );
1898  PinAttributes.insert( std::make_pair( pinAttr.Pin, pinAttr ) );
1899  }
1900  else if( cNodeName == wxT( "COMPPINLABEL" ) )
1901  {
1902  PART_DEFINITION_PIN_ID pinID = GetXmlAttributeIDLong( cNode, 0 );
1903  wxString pinLabel = GetXmlAttributeIDString( cNode, 1 );
1904  PinLabels.insert( std::make_pair( pinID, pinLabel ) );
1905  }
1906  else if( cNodeName == wxT( "PADEXCEPTION" ) )
1907  {
1908  PADEXCEPTION padExcept;
1909  padExcept.Parse( cNode, aContext );
1910  PadExceptions.insert( std::make_pair( padExcept.ID, padExcept ) );
1911  }
1912  else
1913  {
1914  THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
1915  }
1916  }
1917 
1918  if( !originParsed )
1919  THROW_MISSING_PARAMETER_IO_ERROR( wxT( "PT" ), aNode->GetName() );
1920 }
long PART_DEFINITION_PIN_ID
Pin identifier in the part definition.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
bool TestPoint
Indicates whether this component should be treated as a testpoint.
std::map< PART_DEFINITION_PIN_ID, wxString > PinLabels
This is inherited from the PARTS library but is allowed to be out of sync.
std::map< PART_DEFINITION_PIN_ID, PIN_ATTRIBUTE > PinAttributes
wxString Name
Designator e.g. "C1", "R1", etc.
#define THROW_MISSING_PARAMETER_IO_ERROR(param, location)
XNODE * GetChildren() const
Definition: xnode.h:62
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static long GetXmlAttributeIDLong(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
Hold an XML or S-expression element.
Definition: xnode.h:43
std::map< PAD_ID, PADEXCEPTION > PadExceptions
Override pad definitions for this instance.
XNODE * GetNext() const
Definition: xnode.h:67
static READABILITY ParseReadability(XNODE *aNode)
GROUP_ID GroupID
If not empty, this component is part of a group.
#define THROW_UNKNOWN_NODE_IO_ERROR(nodename, location)
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
static wxString GetXmlAttributeIDString(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
std::map< ATTRIBUTE_ID, TEXT_LOCATION > TextLocations
This contains location of any attributes, including designator position.
POINT Origin
Origin of the component (this is used as the reference point when placing the component in the design...

References XNODE::GetChildren(), XNODE::GetNext(), CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDLong(), CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString(), CADSTAR_PCB_ARCHIVE_PARSER::PADEXCEPTION::ID, CADSTAR_PCB_ARCHIVE_PARSER::PIN_ATTRIBUTE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::PADEXCEPTION::Parse(), CADSTAR_ARCHIVE_PARSER::ParseReadability(), CADSTAR_PCB_ARCHIVE_PARSER::PIN_ATTRIBUTE::Pin, THROW_MISSING_PARAMETER_IO_ERROR, and THROW_UNKNOWN_NODE_IO_ERROR.

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

Member Data Documentation

◆ AttributeValues

std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE> CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::AttributeValues

◆ Fixed

bool CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::Fixed = false

Definition at line 912 of file cadstar_pcb_archive_parser.h.

◆ GroupID

GROUP_ID CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::GroupID = wxEmptyString

If not empty, this component is part of a group.

Definition at line 904 of file cadstar_pcb_archive_parser.h.

◆ ID

COMPONENT_ID CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::ID

◆ Mirror

bool CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::Mirror = false

◆ Name

wxString CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::Name

Designator e.g. "C1", "R1", etc.

Definition at line 898 of file cadstar_pcb_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadComponents().

◆ OrientAngle

long CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::OrientAngle = 0

◆ Origin

POINT CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::Origin

Origin of the component (this is used as the reference point when placing the component in the design)

Definition at line 901 of file cadstar_pcb_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadComponents().

◆ PadExceptions

std::map<PAD_ID, PADEXCEPTION> CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::PadExceptions

Override pad definitions for this instance.

Definition at line 924 of file cadstar_pcb_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadComponents().

◆ PartID

PART_ID CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::PartID

◆ PinAttributes

std::map<PART_DEFINITION_PIN_ID, PIN_ATTRIBUTE> CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::PinAttributes

Definition at line 923 of file cadstar_pcb_archive_parser.h.

◆ PinLabels

std::map<PART_DEFINITION_PIN_ID, wxString> CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::PinLabels

This is inherited from the PARTS library but is allowed to be out of sync.

See PART::DEFINITION::PIN::Label

Definition at line 919 of file cadstar_pcb_archive_parser.h.

◆ Readability

READABILITY CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::Readability = READABILITY::BOTTOM_TO_TOP

Definition at line 913 of file cadstar_pcb_archive_parser.h.

◆ ReuseBlockRef

REUSEBLOCKREF CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::ReuseBlockRef

Definition at line 905 of file cadstar_pcb_archive_parser.h.

◆ SymdefID

SYMDEF_ID CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::SymdefID

◆ TestPoint

bool CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::TestPoint = false

Indicates whether this component should be treated as a testpoint.

See SYMDEF_TYPE::TESTPOINT

Definition at line 909 of file cadstar_pcb_archive_parser.h.

◆ TextLocations

std::map<ATTRIBUTE_ID, TEXT_LOCATION> CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::TextLocations

This contains location of any attributes, including designator position.

Definition at line 915 of file cadstar_pcb_archive_parser.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadComponentAttributes().

◆ VariantID

VARIANT_ID CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::VariantID = wxEmptyString

◆ VariantParentComponentID

COMPONENT_ID CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::VariantParentComponentID = wxEmptyString

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