CADSTAR Archive Importer: Change architecture to Parse CADSTAR fields and store them in a static map

Architecture of the parser changed to have a shared PARSER_CONTEXT between all the individual parsers.
Parses CADSTAR fields such as <@DESIGN_TITLE@> or <@SHEET_NUMBER@> and replaces with an equivalent KiCad Text Variable.
This commit is contained in:
Roberto Fernandez Bautista 2020-12-10 16:13:35 +00:00 committed by Wayne Stambaugh
parent 8a278a0579
commit 9ed4780fec
6 changed files with 950 additions and 660 deletions

File diff suppressed because it is too large Load Diff

View File

@ -118,19 +118,101 @@ public:
* larger in KiCad.
*/
static const double TXT_HEIGHT_RATIO;
/**
* These are speccial fields in text objects enclosed between the tokens '<@' and '@>' such as
* <@[FIELD_NAME][FIELD_VALUE]@>. For example: "<@DESIGN TITLEProject Title@>"
*/
enum class TEXT_FIELD_NAME
{
DESIGN_TITLE,
SHORT_JOBNAME,
LONG_JOBNAME,
NUM_OF_SHEETS,
SHEET_NUMBER,
SHEET_NAME,
VARIANT_NAME,
VARIANT_DESCRIPTION,
REG_USER,
COMPANY_NAME,
CURRENT_USER,
DATE,
TIME,
MACHINE_NAME,
FROM_FILE,
DISTANCE,
UNITS_SHORT,
UNITS_ABBREV,
UNITS_FULL,
HYPERLINK,
NONE ///< Synthetic for flagging
};
struct FORMAT
/**
* Map between CADSTAR fields and KiCad text variables. This is used as a lookup
*/
static const std::map<TEXT_FIELD_NAME, wxString> CadstarToKicadFieldsMap;
struct PARSER_CONTEXT
{
/**
* CADSTAR doesn't have user defined text fields but does allow loading text from a
* file. This map stores all the text items that exist in the original CADSTAR design. They
* will be replaced by a text variable of the form ${FROM_FILE_[filename]_[extension]}
*/
std::map<wxString, wxString> FilenamesToTextMap;
/**
* KiCad doesn't support hyperlinks but we use this map to display warning messages
* after import. First element = Display Text. Second element = Hyperlink
*/
std::map<wxString, wxString> TextToHyperlinksMap;
/**
* Values for the text field elements used in the CADSTAR design extracted from the
* text element instances
*/
std::map<TEXT_FIELD_NAME, wxString> TextFieldToValuesMap;
/**
* Text fields need to be updated in CADSTAR and it is possible that they are not
* consistent accross text elements.
*/
std::set<TEXT_FIELD_NAME> InconsistentTextFields;
};
PARSER_CONTEXT mContext;
/**
* @brief Replaces CADSTAR fields for the equivalent in KiCad and stores the field values
* in aParserContext
* @param aTextString Text string to parse
* @param aParserContext PARSER_CONTEXT in which to store the values of the found fields
* @return
*/
static wxString ParseTextFields( wxString aTextString, PARSER_CONTEXT* aParserContext );
struct PARSER
{
virtual void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) = 0;
};
struct FORMAT : PARSER
{
wxString Type;
long SomeInt; ///< It is unclear what this parameter is used for
long Version; ///< Archive version number (e.g. for PCB: 19=> CADSTAR 17.0 archive,
///< 20=> CADSTAR 18.0 archive, 21 => CADSTAR 2018.0 / 2019.0 / 2020.0,
///< etc.)
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct TIMESTAMP
struct TIMESTAMP : PARSER
{
long Year;
long Month;
@ -139,7 +221,7 @@ public:
long Minute;
long Second;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
//Note: there are possibly several other resolutions, but HUNDREDTH MICRON is only one known
@ -149,7 +231,7 @@ public:
};
struct HEADER
struct HEADER : PARSER
{
FORMAT Format;
wxString JobFile;
@ -158,26 +240,26 @@ public:
RESOLUTION Resolution;
TIMESTAMP Timestamp;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct VARIANT ///< Nodename = "VARIANT" or "VMASTER" (master variant
struct VARIANT : PARSER ///< Nodename = "VARIANT" or "VMASTER" (master variant
{
VARIANT_ID ID = wxEmptyString;
VARIANT_ID ParentID = wxEmptyString; ///< if empty, then this one is the master
wxString Name = wxEmptyString;
wxString Description = wxEmptyString;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct VARIANT_HIERARCHY
struct VARIANT_HIERARCHY : PARSER
{
std::map<VARIANT_ID, VARIANT> Variants;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -191,34 +273,34 @@ public:
};
struct LINECODE
struct LINECODE : PARSER
{
LINECODE_ID ID;
wxString Name;
long Width;
LINESTYLE Style;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct HATCH
struct HATCH : PARSER
{
long Step;
long LineWidth;
long OrientAngle; ///< 1/1000 of a Degree
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct HATCHCODE
struct HATCHCODE : PARSER
{
HATCHCODE_ID ID;
wxString Name;
std::vector<HATCH> Hatches;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -226,7 +308,7 @@ public:
static const long FONT_BOLD = 700;
struct FONT
struct FONT : PARSER
{
wxString Name = wxT( "CADSTAR" );
long Modifier1 = FONT_NORMAL; ///< It seems this is related to weight. 400=Normal, 700=Bold.
@ -237,11 +319,11 @@ public:
///< characters in order to improve the appearance of the text"
bool Italic = false;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct TEXTCODE
struct TEXTCODE : PARSER
{
TEXTCODE_ID ID;
wxString Name;
@ -252,11 +334,11 @@ public:
///< a different aspect ratio.
FONT Font;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct ROUTEREASSIGN
struct ROUTEREASSIGN : PARSER
{
LAYER_ID LayerID;
long OptimalWidth;
@ -264,11 +346,11 @@ public:
long MaxWidth;
long NeckedWidth;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct ROUTECODE
struct ROUTECODE : PARSER
{
ROUTECODE_ID ID;
wxString Name;
@ -279,41 +361,41 @@ public:
std::vector<ROUTEREASSIGN> RouteReassigns;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
/**
* @brief Represents a floating value in E notation
*/
struct EVALUE
struct EVALUE : PARSER
{
long Base = 0;
long Exponent = 0;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
double GetDouble();
};
/**
* @brief Represents a point in x,y coordinates
*/
struct POINT : wxPoint
struct POINT : wxPoint, PARSER
{
POINT() : wxPoint( UNDEFINED_VALUE, UNDEFINED_VALUE )
{
}
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct LONGPOINT
struct LONGPOINT : PARSER
{
long x = UNDEFINED_VALUE;
long y = UNDEFINED_VALUE;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -330,24 +412,24 @@ public:
* @brief Represents a vertex in a shape. E.g. A circle is made by two semicircles with the same
* center point.
*/
struct VERTEX
struct VERTEX : PARSER
{
VERTEX_TYPE Type;
POINT Center;
POINT End;
static bool IsVertex( XNODE* aNode );
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
/**
* @brief Represents a cutout in a closed shape (e.g. OUTLINE)
*/
struct CUTOUT
struct CUTOUT : PARSER
{
std::vector<VERTEX> Vertices;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -360,7 +442,7 @@ public:
};
struct SHAPE
struct SHAPE : PARSER
{
SHAPE_TYPE Type;
std::vector<VERTEX> Vertices;
@ -368,7 +450,7 @@ public:
wxString HatchCodeID; ///< Only Applicable for HATCHED Type
static bool IsShape( XNODE* aNode );
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -405,7 +487,7 @@ public:
};
struct GRID
struct GRID : PARSER
{
GRID_TYPE Type;
wxString Name;
@ -415,11 +497,11 @@ public:
///< more details)
static bool IsGrid( XNODE* aNode );
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct GRIDS
struct GRIDS : PARSER
{
GRID WorkingGrid;
GRID ScreenGrid; ///< From CADSTAR Help: "There is one Screen Grid, which is
@ -432,11 +514,11 @@ public:
///< set up on the Display dialog within Options(File menu)."
std::vector<GRID> UserGrids; ///< List of predefined grids created by the user
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct SETTINGS
struct SETTINGS : PARSER
{
UNITS Units; ///< Units to display for linear dimensions
long UnitDisplPrecision; ///< Number of decimal points to display for linear dimensions
@ -454,11 +536,12 @@ public:
LONGPOINT DesignRef; ///< Appears to be 0,0 always
LONGPOINT DesignLimit;
bool ParseSubNode( XNODE* aChildNode );
virtual void Parse( XNODE* aNode );
bool ParseSubNode( XNODE* aChildNode, PARSER_CONTEXT* aContext );
virtual void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
/**
* @brief From CADSTAR Help: "Text Alignment enables you to define the position of an alignment
* origin for all text items in CADSTAR. The alignment origin is a point on or within the text
@ -568,7 +651,7 @@ public:
};
struct ATTRIBUTE_LOCATION
struct ATTRIBUTE_LOCATION : PARSER
{
TEXTCODE_ID TextCodeID;
LAYER_ID LayerID;
@ -584,9 +667,9 @@ public:
///< Note that this is different from BOTTOM_LEFT (which is bottom
///< left of the whole text block)
void ParseIdentifiers( XNODE* aNode );
bool ParseSubNode( XNODE* aChildNode );
virtual void Parse( XNODE* aNode );
void ParseIdentifiers( XNODE* aNode, PARSER_CONTEXT* aContext );
bool ParseSubNode( XNODE* aChildNode, PARSER_CONTEXT* aContext );
virtual void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -594,23 +677,23 @@ public:
* @brief NOTE from CADSTAR help: To convert a Part Definition Attribute into a hyperlink, prefix
* the attribute name with "Link "
*/
struct ATTRNAME
struct ATTRNAME : PARSER
{
struct COLUMNORDER
struct COLUMNORDER : PARSER
{
long ID;
long Order;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct COLUMNWIDTH
struct COLUMNWIDTH : PARSER
{
long ID;
long Width;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
ATTRIBUTE_ID ID;
@ -631,11 +714,11 @@ public:
std::vector<COLUMNWIDTH> ColumnWidths;
bool ColumnInvisible = false;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct ATTRIBUTE_VALUE
struct ATTRIBUTE_VALUE : PARSER
{
ATTRIBUTE_ID AttributeID;
wxString Value;
@ -644,7 +727,7 @@ public:
///< i.e. is displayed
ATTRIBUTE_LOCATION AttributeLocation;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -663,30 +746,30 @@ public:
}
ATTRIBUTE_ID AttributeID;
void Parse( XNODE* aNode ) override;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct NETCLASS
struct NETCLASS : PARSER
{
NETCLASS_ID ID;
wxString Name;
std::vector<ATTRIBUTE_VALUE> Attributes;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct SPCCLASSNAME
struct SPCCLASSNAME : PARSER
{
SPACING_CLASS_ID ID;
wxString Name;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct CODEDEFS
struct CODEDEFS : PARSER
{
std::map<LINECODE_ID, LINECODE> LineCodes;
std::map<HATCHCODE_ID, HATCHCODE> HatchCodes;
@ -696,8 +779,7 @@ public:
std::map<NETCLASS_ID, NETCLASS> NetClasses;
std::map<SPACING_CLASS_ID, SPCCLASSNAME> SpacingClassNames;
bool ParseSubNode( XNODE* aChildNode );
virtual void Parse( XNODE* aNode ) = 0;
bool ParseSubNode( XNODE* aChildNode, PARSER_CONTEXT* aContext );
};
/**
@ -721,7 +803,7 @@ public:
static SWAP_RULE ParseSwapRule( XNODE* aNode );
struct REUSEBLOCK
struct REUSEBLOCK : PARSER
{
REUSEBLOCK_ID ID;
wxString Name;
@ -729,14 +811,14 @@ public:
bool Mirror = false;
long OrientAngle = 0;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
/**
* @brief References an element from a design reuse block
*/
struct REUSEBLOCKREF
struct REUSEBLOCKREF : PARSER
{
REUSEBLOCK_ID ReuseBlockID = wxEmptyString;
wxString ItemReference = wxEmptyString; ///< For Components, this references the designator
@ -745,11 +827,11 @@ public:
///< coppers and templates, this parameter is blank.
bool IsEmpty(); ///< Determines if this is empty (i.e. no design reuse associated)
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct GROUP
struct GROUP : PARSER
{
GROUP_ID ID;
wxString Name;
@ -759,11 +841,11 @@ public:
///< is part of another GROUP
REUSEBLOCKREF ReuseBlockRef;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct FIGURE
struct FIGURE : PARSER
{
FIGURE_ID ID;
LINECODE_ID LineCodeID;
@ -776,11 +858,11 @@ public:
bool Fixed = false;
std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE> AttributeValues;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct TEXT
struct TEXT : PARSER
{
TEXT_ID ID;
wxString Text; //TODO: Need to lex/parse to identify design fields and hyperlinks
@ -801,11 +883,11 @@ public:
GROUP_ID GroupID = wxEmptyString; ///< If not empty, this FIGURE is part of a group
REUSEBLOCKREF ReuseBlockRef;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct SYMDEF
struct SYMDEF : PARSER
{
SYMDEF_ID ID;
wxString ReferenceName; ///< This is the name which identifies the symbol in the library
@ -831,13 +913,12 @@ public:
std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE> AttributeValues; ///< These attributes might also
///< have a location
void ParseIdentifiers( XNODE* aNode );
bool ParseSubNode( XNODE* aChildNode );
virtual void Parse( XNODE* aNode ) = 0;
void ParseIdentifiers( XNODE* aNode, PARSER_CONTEXT* aContext );
bool ParseSubNode( XNODE* aChildNode, PARSER_CONTEXT* aContext );
};
struct PART
struct PART : PARSER
{
enum class PIN_TYPE
{
@ -857,20 +938,20 @@ public:
static PIN_TYPE GetPinType( XNODE* aNode );
struct DEFINITION ///< "PARTDEFINITION" node name
struct DEFINITION : PARSER ///< "PARTDEFINITION" node name
{
struct GATE ///< "GATEDEFINITION" node name
struct GATE : PARSER ///< "GATEDEFINITION" node name
{
GATE_ID ID; ///< Usually "A", "B", "C", etc.
wxString Name; ///< Symbol name in the symbol library
wxString Alternate; ///< Symbol alternate name in the symbol library
long PinCount; ///< Number of pins (terminals) in the symbol
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct PIN ///< "PARTDEFINITIONPIN" node name
struct PIN : PARSER ///< "PARTDEFINITIONPIN" node name
{
/**
* @brief Positioning of pin names can be in one of four quadrants
@ -924,30 +1005,30 @@ public:
///< the symbol is added to a schematic design
///< subnode="PINPOSITION"
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct PIN_EQUIVALENCE ///< "PINEQUIVALENCE" Node name (represents "Equivalence")
struct PIN_EQUIVALENCE : PARSER ///< "PINEQUIVALENCE" Node name
{
std::vector<PART_DEFINITION_PIN_ID> PinIDs; ///< All the pins in this vector are
///< equivalent and can be swapped with
///< each other
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct SWAP_GATE ///< "SWAPGATE" Node name (represents an "Element")
struct SWAP_GATE : PARSER ///< "SWAPGATE" Node name (represents an "Element")
{
std::vector<PART_DEFINITION_PIN_ID> PinIDs; ///< The pins in this vector
///< describe a "gate"
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct SWAP_GROUP
struct SWAP_GROUP : PARSER
{
wxString GateName =
wxEmptyString; ///< Optional. If not empty, should match the Name
@ -968,7 +1049,7 @@ public:
///< *all* in another swap gate defined in this
///< vector
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
wxString Name; ///< This name can be different to the PART name
@ -995,18 +1076,18 @@ public:
std::vector<PIN_EQUIVALENCE> PinEquivalences;
std::vector<SWAP_GROUP> SwapGroups;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct PART_PIN ///< "PARTPIN" node name
struct PART_PIN : PARSER ///< "PARTPIN" node name
{
PART_PIN_ID ID;
wxString Name = wxEmptyString;
PIN_TYPE Type = PIN_TYPE::UNCOMMITTED;
wxString Identifier = wxEmptyString;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -1028,21 +1109,21 @@ public:
///< whilst others are defined in
///< the part itself
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct PARTS
struct PARTS : PARSER
{
std::map<PART_ID, PART> PartDefinitions;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct NET
struct NET : PARSER
{
struct JUNCTION ///< "JPT" nodename.
struct JUNCTION : PARSER ///< "JPT" nodename.
{
NETELEMENT_ID ID; ///< First character is "J"
LAYER_ID LayerID;
@ -1052,13 +1133,13 @@ public:
REUSEBLOCKREF ReuseBlockRef;
bool Fixed = false;
void ParseIdentifiers( XNODE* aNode );
bool ParseSubNode( XNODE* aChildNode );
virtual void Parse( XNODE* aNode );
void ParseIdentifiers( XNODE* aNode, PARSER_CONTEXT* aContext );
bool ParseSubNode( XNODE* aChildNode, PARSER_CONTEXT* aContext );
virtual void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct CONNECTION ///< "CONN" nodename
struct CONNECTION : PARSER ///< "CONN" nodename
{
NETELEMENT_ID StartNode;
NETELEMENT_ID EndNode;
@ -1072,9 +1153,8 @@ public:
std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE> AttributeValues; ///< It is possible to add
///< attributes solely to a
///< particular connection
void ParseIdentifiers( XNODE* aNode );
bool ParseSubNode( XNODE* aChildNode );
virtual void Parse( XNODE* aNode ) = 0;
void ParseIdentifiers( XNODE* aNode, PARSER_CONTEXT* aContext );
bool ParseSubNode( XNODE* aChildNode, PARSER_CONTEXT* aContext );
virtual ~CONNECTION() {}
};
@ -1097,13 +1177,12 @@ public:
wxEmptyString; ///< The net might not have a spacing class, in which case it will
///< be wxEmptyString ("SPACINGCLASS" subnode)
void ParseIdentifiers( XNODE* aNode );
bool ParseSubNode( XNODE* aChildNode );
virtual void Parse( XNODE* aNode ) = 0;
void ParseIdentifiers( XNODE* aNode, PARSER_CONTEXT* aContext );
bool ParseSubNode( XNODE* aChildNode, PARSER_CONTEXT* aContext );
};
struct DOCUMENTATION_SYMBOL
struct DOCUMENTATION_SYMBOL : PARSER
{
DOCUMENTATION_SYMBOL_ID ID;
@ -1129,7 +1208,7 @@ public:
std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE> AttributeValues;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -1200,7 +1279,7 @@ public:
* @param aValueToParse
* @throw IO_ERROR if unable to parse or node is not an EVALUE
*/
static void ParseChildEValue( XNODE* aNode, EVALUE& aValueToParse );
static void ParseChildEValue( XNODE* aNode, PARSER_CONTEXT* aContext, EVALUE& aValueToParse );
/**
* @brief if no childs are present, it just returns an empty
@ -1214,8 +1293,8 @@ public:
* - aTestAllChildNodes is true and one of the child nodes is not a valid POINT object
* - aExpectedNumPoints is non-negative and the number of POINT objects found is different
*/
static std::vector<POINT> ParseAllChildPoints( XNODE* aNode, bool aTestAllChildNodes = false,
int aExpectedNumPoints = UNDEFINED_VALUE );
static std::vector<POINT> ParseAllChildPoints( XNODE* aNode, PARSER_CONTEXT* aContext,
bool aTestAllChildNodes = false, int aExpectedNumPoints = UNDEFINED_VALUE );
/**
* @brief if no childs are present, it just returns an empty
@ -1229,7 +1308,7 @@ public:
* - aTestAllChildNodes is true and one of the child nodes is not a valid VERTEX object
*/
static std::vector<VERTEX> ParseAllChildVertices(
XNODE* aNode, bool aTestAllChildNodes = false );
XNODE* aNode, PARSER_CONTEXT* aContext, bool aTestAllChildNodes = false );
/**
* @brief if no childs are present, it just returns an empty
@ -1243,7 +1322,7 @@ public:
* - aTestAllChildNodes is true and one of the child nodes is not a valid CUTOUT object
*/
static std::vector<CUTOUT> ParseAllChildCutouts(
XNODE* aNode, bool aTestAllChildNodes = false );
XNODE* aNode, PARSER_CONTEXT* aContext, bool aTestAllChildNodes = false );
}; // class CADSTAR_ARCHIVE_PARSER
#endif // CADSTAR_ARCHIVE_PARSER_H_

View File

@ -41,7 +41,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::Parse()
{
if( cNode->GetName() == wxT( "HEADER" ) )
{
Header.Parse( cNode );
Header.Parse( cNode, &mContext );
switch( Header.Resolution )
{
@ -56,11 +56,11 @@ void CADSTAR_SCH_ARCHIVE_PARSER::Parse()
}
else if( cNode->GetName() == wxT( "ASSIGNMENTS" ) )
{
Assignments.Parse( cNode );
Assignments.Parse( cNode, &mContext );
}
else if( cNode->GetName() == wxT( "LIBRARY" ) )
{
Library.Parse( cNode );
Library.Parse( cNode, &mContext );
}
else if( cNode->GetName() == wxT( "DEFAULTS" ) )
{
@ -70,15 +70,15 @@ void CADSTAR_SCH_ARCHIVE_PARSER::Parse()
}
else if( cNode->GetName() == wxT( "PARTS" ) )
{
Parts.Parse( cNode );
Parts.Parse( cNode, &mContext );
}
else if( cNode->GetName() == wxT( "SHEETS" ) )
{
Sheets.Parse( cNode );
Sheets.Parse( cNode, &mContext );
}
else if( cNode->GetName() == wxT( "SCHEMATIC" ) )
{
Schematic.Parse( cNode );
Schematic.Parse( cNode, &mContext );
}
else if( cNode->GetName() == wxT( "DISPLAY" ) )
{
@ -140,7 +140,7 @@ bool CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL_SHAPE::IsTermShape( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL_SHAPE::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL_SHAPE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( IsTermShape( aNode ), );
@ -198,7 +198,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL_SHAPE::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::TERMINALCODE::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::TERMINALCODE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "TERMINALCODE" ), );
@ -213,7 +213,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::TERMINALCODE::Parse( XNODE* aNode )
wxString cNodeName = cNode->GetName();
if( TERMINAL_SHAPE::IsTermShape( cNode ) )
Shape.Parse( cNode );
Shape.Parse( cNode, aContext );
else if( cNodeName == wxT( "FILLED" ) )
Filled = true;
else
@ -222,7 +222,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::TERMINALCODE::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::CODEDEFS_SCM::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::CODEDEFS_SCM::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "CODEDEFS" ), );
@ -232,14 +232,14 @@ void CADSTAR_SCH_ARCHIVE_PARSER::CODEDEFS_SCM::Parse( XNODE* aNode )
{
wxString nodeName = cNode->GetName();
if( ParseSubNode( cNode ) ) // in CADSTAR_ARCHIVE_PARSER::CODEDEFS
if( ParseSubNode( cNode, aContext ) ) // in CADSTAR_ARCHIVE_PARSER::CODEDEFS
{
continue;
}
else if( nodeName == wxT( "TERMINALCODE" ) )
{
TERMINALCODE termcode;
termcode.Parse( cNode );
termcode.Parse( cNode, aContext );
TerminalCodes.insert( std::make_pair( termcode.ID, termcode ) );
}
else
@ -250,7 +250,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::CODEDEFS_SCM::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::ASSIGNMENTS_SCM::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::ASSIGNMENTS_SCM::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "ASSIGNMENTS" ), );
@ -261,16 +261,16 @@ void CADSTAR_SCH_ARCHIVE_PARSER::ASSIGNMENTS_SCM::Parse( XNODE* aNode )
{
if( cNode->GetName() == wxT( "CODEDEFS" ) )
{
Codedefs.Parse( cNode );
Codedefs.Parse( cNode, aContext );
}
else if( cNode->GetName() == wxT( "SETTINGS" ) )
{
settingsParsed = true;
Settings.Parse( cNode );
Settings.Parse( cNode, aContext );
}
else if( cNode->GetName() == wxT( "GRIDS" ) )
{
Grids.Parse( cNode );
Grids.Parse( cNode, aContext );
}
else if( cNode->GetName() == wxT( "NETCLASSEDITATTRIBSETTINGS" ) )
{
@ -291,7 +291,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::ASSIGNMENTS_SCM::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "TERMINAL" ), );
@ -311,14 +311,14 @@ void CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL::Parse( XNODE* aNode )
if( cNodeName == wxT( "ORIENT" ) )
OrientAngle = GetXmlAttributeIDLong( cNode, 0 );
else if( cNodeName == wxT( "PT" ) )
Position.Parse( cNode );
Position.Parse( cNode, aContext );
else
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, location );
}
}
void CADSTAR_SCH_ARCHIVE_PARSER::PIN_NUM_LABEL_LOC::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::PIN_NUM_LABEL_LOC::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "PINLABELLOC" )
|| aNode->GetName() == wxT( "PINNUMNAMELOC" ), );
@ -331,7 +331,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::PIN_NUM_LABEL_LOC::Parse( XNODE* aNode )
for( ; cNode; cNode = cNode->GetNext() )
{
if( ParseSubNode( cNode ) )
if( ParseSubNode( cNode, aContext ) )
continue;
else
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
@ -342,11 +342,11 @@ void CADSTAR_SCH_ARCHIVE_PARSER::PIN_NUM_LABEL_LOC::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::SYMDEF_SCM::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::SYMDEF_SCM::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "SYMDEF" ), );
ParseIdentifiers( aNode );
ParseIdentifiers( aNode, aContext );
XNODE* cNode = aNode->GetChildren();
@ -354,26 +354,26 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SYMDEF_SCM::Parse( XNODE* aNode )
{
wxString cNodeName = cNode->GetName();
if( ParseSubNode( cNode ) )
if( ParseSubNode( cNode, aContext ) )
{
continue;
}
else if( cNodeName == wxT( "TERMINAL" ) )
{
TERMINAL term;
term.Parse( cNode );
term.Parse( cNode, aContext );
Terminals.insert( std::make_pair( term.ID, term ) );
}
else if( cNodeName == wxT( "PINLABELLOC" ) )
{
PIN_NUM_LABEL_LOC loc;
loc.Parse( cNode );
loc.Parse( cNode, aContext );
PinLabelLocations.insert( std::make_pair( loc.TerminalID, loc ) );
}
else if( cNodeName == wxT( "PINNUMNAMELOC" ) )
{
PIN_NUM_LABEL_LOC loc;
loc.Parse( cNode );
loc.Parse( cNode, aContext );
PinNumberLocations.insert( std::make_pair( loc.TerminalID, loc ) );
}
else
@ -387,7 +387,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SYMDEF_SCM::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::LIBRARY_SCM::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::LIBRARY_SCM::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "LIBRARY" ), );
@ -400,7 +400,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::LIBRARY_SCM::Parse( XNODE* aNode )
if( cNodeName == wxT( "SYMDEF" ) )
{
SYMDEF_SCM symdef;
symdef.Parse( cNode );
symdef.Parse( cNode, aContext );
SymbolDefinitions.insert( std::make_pair( symdef.ID, symdef ) );
}
else
@ -411,7 +411,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::LIBRARY_SCM::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::SHEETS::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::SHEETS::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "SHEETS" ), );
@ -434,7 +434,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SHEETS::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::COMP::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::COMP::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "COMP" ), );
@ -450,7 +450,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::COMP::Parse( XNODE* aNode )
}
else if( cNode->GetName() == wxT( "ATTRLOC" ) )
{
AttrLoc.Parse( cNode );
AttrLoc.Parse( cNode, aContext );
HasLocation = true;
}
else
@ -461,7 +461,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::COMP::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::PARTREF::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::PARTREF::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "PARTREF" ), );
@ -477,7 +477,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::PARTREF::Parse( XNODE* aNode )
}
else if( cNode->GetName() == wxT( "ATTRLOC" ) )
{
AttrLoc.Parse( cNode );
AttrLoc.Parse( cNode, aContext );
HasLocation = true;
}
else
@ -488,7 +488,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::PARTREF::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::TERMATTR::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::TERMATTR::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "TERMATTR" ), /* void */ );
@ -501,7 +501,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::TERMATTR::Parse( XNODE* aNode )
{
if( !attrParsed && cNode->GetName() == wxT( "ATTR" ) )
{
Value.Parse( cNode );
Value.Parse( cNode, aContext );
attrParsed = true;
}
else
@ -512,7 +512,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::TERMATTR::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::SYMPINNAME_LABEL::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::SYMPINNAME_LABEL::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "SYMPINNAME" ) || aNode->GetName() == wxT( "SYMPINLABEL" ), );
@ -525,7 +525,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SYMPINNAME_LABEL::Parse( XNODE* aNode )
{
if( cNode->GetName() == wxT( "ATTRLOC" ) )
{
AttrLoc.Parse( cNode );
AttrLoc.Parse( cNode, aContext );
HasLocation = true;
}
else
@ -536,7 +536,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SYMPINNAME_LABEL::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::PIN_NUM::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::PIN_NUM::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "PINNUM" ), );
@ -549,7 +549,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::PIN_NUM::Parse( XNODE* aNode )
{
if( cNode->GetName() == wxT( "ATTRLOC" ) )
{
AttrLoc.Parse( cNode );
AttrLoc.Parse( cNode, aContext );
HasLocation = true;
}
else
@ -560,7 +560,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::PIN_NUM::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOLVARIANT::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOLVARIANT::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "SYMBOLVARIANT" ), );
@ -588,7 +588,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOLVARIANT::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::SIGNALREFERENCELINK::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::SIGNALREFERENCELINK::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "SIGNALREFERENCELINK" ), );
@ -600,7 +600,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SIGNALREFERENCELINK::Parse( XNODE* aNode )
for( ; cNode; cNode = cNode->GetNext() )
{
if( ParseSubNode( cNode ) )
if( ParseSubNode( cNode, aContext ) )
continue;
else if( cNode->GetName() == wxT( "SIGREFTEXT" ) )
Text = GetXmlAttributeIDString( aNode, 0 );
@ -613,7 +613,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SIGNALREFERENCELINK::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "SYMBOL" ), );
@ -631,17 +631,17 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::Parse( XNODE* aNode )
if( !originParsed && cNodeName == wxT( "PT" ) )
{
Origin.Parse( cNode );
Origin.Parse( cNode, aContext );
originParsed = true;
}
else if( cNodeName == wxT( "COMP" ) )
{
ComponentRef.Parse( cNode );
ComponentRef.Parse( cNode, aContext );
IsComponent = true;
}
else if( cNodeName == wxT( "PARTREF" ) )
{
PartRef.Parse( cNode );
PartRef.Parse( cNode, aContext );
HasPartRef = true;
}
else if( cNodeName == wxT( "PARTNAMENOTVISIBLE" ) )
@ -659,11 +659,11 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::Parse( XNODE* aNode )
}
else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
{
ReuseBlockRef.Parse( cNode );
ReuseBlockRef.Parse( cNode, aContext );
}
else if( cNodeName == wxT( "SIGNALREFERENCELINK" ) )
{
SigRefLink.Parse( cNode );
SigRefLink.Parse( cNode, aContext );
}
else if( cNodeName == wxT( "ORIENT" ) )
{
@ -693,36 +693,36 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::Parse( XNODE* aNode )
else if( cNodeName == wxT( "SYMBOLVARIANT" ) )
{
IsSymbolVariant = true;
SymbolVariant.Parse( cNode );
SymbolVariant.Parse( cNode, aContext );
}
else if( cNodeName == wxT( "TERMATTR" ) )
{
TERMATTR termattr;
termattr.Parse( cNode );
termattr.Parse( cNode, aContext );
TerminalAttributes.insert( std::make_pair( termattr.TerminalID, termattr ) );
}
else if( cNodeName == wxT( "SYMPINLABEL" ) )
{
SYMPINNAME_LABEL sympinname;
sympinname.Parse( cNode );
sympinname.Parse( cNode, aContext );
PinLabels.insert( std::make_pair( sympinname.TerminalID, sympinname ) );
}
else if( cNodeName == wxT( "SYMPINNAME" ) )
{
SYMPINNAME_LABEL sympinname;
sympinname.Parse( cNode );
sympinname.Parse( cNode, aContext );
PinNames.insert( std::make_pair( sympinname.TerminalID, sympinname ) );
}
else if( cNodeName == wxT( "PINNUM" ) )
{
PIN_NUM pinNum;
pinNum.Parse( cNode );
pinNum.Parse( cNode, aContext );
PinNumbers.insert( std::make_pair( pinNum.TerminalID, pinNum ) );
}
else if( cNodeName == wxT( "ATTR" ) )
{
ATTRIBUTE_VALUE attrVal;
attrVal.Parse( cNode );
attrVal.Parse( cNode, aContext );
AttributeValues.insert( std::make_pair( attrVal.AttributeID, attrVal ) );
}
else
@ -736,7 +736,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::SIGLOC::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::SIGLOC::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "SIGLOC" ), );
@ -747,7 +747,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SIGLOC::Parse( XNODE* aNode )
for( ; cNode; cNode = cNode->GetNext() )
{
if( ParseSubNode( cNode ) )
if( ParseSubNode( cNode, aContext ) )
continue;
else
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
@ -758,7 +758,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SIGLOC::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::BUS::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::BUS::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "BUS" ), );
@ -774,7 +774,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::BUS::Parse( XNODE* aNode )
if( SHAPE::IsShape( cNode ) )
{
Shape.Parse( cNode );
Shape.Parse( cNode, aContext );
}
else if( cNodeName == wxT( "BUSNAME" ) )
{
@ -786,7 +786,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::BUS::Parse( XNODE* aNode )
{
if( subNode->GetName() == wxT( "SIGLOC" ) )
{
BusLabel.Parse( subNode );
BusLabel.Parse( subNode, aContext );
HasBusLabel = true;
}
else
@ -803,7 +803,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::BUS::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::BLOCK::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::BLOCK::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "BLOCK" ), );
@ -839,7 +839,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::BLOCK::Parse( XNODE* aNode )
{
if( subNode->GetName() == wxT( "ATTRLOC" ) )
{
BlockLabel.Parse( subNode );
BlockLabel.Parse( subNode, aContext );
HasBlockLabel = true;
}
else
@ -851,13 +851,13 @@ void CADSTAR_SCH_ARCHIVE_PARSER::BLOCK::Parse( XNODE* aNode )
else if( cNodeName == wxT( "TERMINAL" ) )
{
TERMINAL term;
term.Parse( cNode );
term.Parse( cNode, aContext );
Terminals.insert( std::make_pair( term.ID, term ) );
}
else if( cNodeName == wxT( "FIGURE" ) )
{
FIGURE figure;
figure.Parse( cNode );
figure.Parse( cNode, aContext );
Figures.insert( std::make_pair( figure.ID, figure ) );
}
else
@ -868,7 +868,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::BLOCK::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::SYM_TERM::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::SYM_TERM::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxASSERT( aNode->GetName() == wxT( "TERM" ) );
@ -885,7 +885,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::SYM_TERM::Parse( XNODE* aNode )
if( cNodeName == wxT( "SIGLOC" ) )
{
NetLabel.Parse( cNode );
NetLabel.Parse( cNode, aContext );
HasNetLabel = true;
}
else
@ -896,7 +896,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::SYM_TERM::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::BUS_TERM::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::BUS_TERM::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxASSERT( aNode->GetName() == wxT( "BUSTERM" ) );
@ -914,19 +914,19 @@ void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::BUS_TERM::Parse( XNODE* aNode )
if( cNodeName == wxT( "SIGLOC" ) )
{
NetLabel.Parse( cNode );
NetLabel.Parse( cNode, aContext );
HasNetLabel = true;
}
else if( cNodeName == wxT( "PT" ) )
{
if( !firstPointParsed )
{
FirstPoint.Parse( cNode );
FirstPoint.Parse( cNode, aContext );
firstPointParsed = true;
}
else if( !secondPointParsed )
{
SecondPoint.Parse( cNode );
SecondPoint.Parse( cNode, aContext );
secondPointParsed = true;
}
else
@ -945,7 +945,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::BUS_TERM::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::BLOCK_TERM::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::BLOCK_TERM::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxASSERT( aNode->GetName() == wxT( "BLOCKTERM" ) );
@ -961,7 +961,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::BLOCK_TERM::Parse( XNODE* aNode )
if( cNodeName == wxT( "SIGLOC" ) )
{
NetLabel.Parse( cNode );
NetLabel.Parse( cNode, aContext );
HasNetLabel = true;
}
else
@ -972,9 +972,9 @@ void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::BLOCK_TERM::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::CONNECTION_SCH::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::CONNECTION_SCH::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
ParseIdentifiers( aNode );
ParseIdentifiers( aNode, aContext );
LayerID = GetXmlAttributeIDString( aNode, 3 );
XNODE* cNode = aNode->GetChildren();
@ -983,13 +983,13 @@ void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::CONNECTION_SCH::Parse( XNODE* aNode )
{
wxString cNodeName = cNode->GetName();
if( ParseSubNode( cNode ) )
if( ParseSubNode( cNode, aContext ) )
{
continue;
}
else if( cNodeName == wxT( "PATH" ) )
{
Path = ParseAllChildPoints( cNode, true );
Path = ParseAllChildPoints( cNode, aContext, true );
}
else if( cNodeName == wxT( "GROUPREF" ) )
{
@ -997,7 +997,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::CONNECTION_SCH::Parse( XNODE* aNode )
}
else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
{
ReuseBlockRef.Parse( cNode );
ReuseBlockRef.Parse( cNode, aContext );
}
else if( cNodeName == wxT( "CONLINECODE" ) )
{
@ -1011,9 +1011,9 @@ void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::CONNECTION_SCH::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
ParseIdentifiers( aNode );
ParseIdentifiers( aNode, aContext );
//Parse child nodes
XNODE* cNode = aNode->GetChildren();
@ -1025,41 +1025,41 @@ void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::Parse( XNODE* aNode )
if( cNodeName == wxT( "JPT" ) )
{
JUNCTION_SCH jpt;
jpt.Parse( cNode );
jpt.Parse( cNode, aContext );
Junctions.insert( std::make_pair( jpt.ID, jpt ) );
}
else if( ParseSubNode( cNode ) )
else if( ParseSubNode( cNode, aContext ) )
{
continue;
}
else if( cNodeName == wxT( "TERM" ) )
{
SYM_TERM pin;
pin.Parse( cNode );
pin.Parse( cNode, aContext );
Terminals.insert( std::make_pair( pin.ID, pin ) );
}
else if( cNodeName == wxT( "BUSTERM" ) )
{
BUS_TERM bt;
bt.Parse( cNode );
bt.Parse( cNode, aContext );
BusTerminals.insert( std::make_pair( bt.ID, bt ) );
}
else if( cNodeName == wxT( "BLOCKTERM" ) )
{
BLOCK_TERM bt;
bt.Parse( cNode );
bt.Parse( cNode, aContext );
BlockTerminals.insert( std::make_pair( bt.ID, bt ) );
}
else if( cNodeName == wxT( "DANGLER" ) )
{
DANGLER dang;
dang.Parse( cNode );
dang.Parse( cNode, aContext );
Danglers.insert( std::make_pair( dang.ID, dang ) );
}
else if( cNodeName == wxT( "CONN" ) )
{
CONNECTION_SCH conn;
conn.Parse( cNode );
conn.Parse( cNode, aContext );
Connections.push_back( conn );
}
else
@ -1070,7 +1070,7 @@ void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::SCHEMATIC::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::SCHEMATIC::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxCHECK( aNode->GetName() == wxT( "SCHEMATIC" ), );
@ -1083,60 +1083,60 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SCHEMATIC::Parse( XNODE* aNode )
if( cNodeName == wxT( "GROUP" ) )
{
GROUP group;
group.Parse( cNode );
group.Parse( cNode, aContext );
Groups.insert( std::make_pair( group.ID, group ) );
}
else if( cNodeName == wxT( "REUSEBLOCK" ) )
{
REUSEBLOCK reuseblock;
reuseblock.Parse( cNode );
reuseblock.Parse( cNode, aContext );
ReuseBlocks.insert( std::make_pair( reuseblock.ID, reuseblock ) );
}
else if( cNodeName == wxT( "FIGURE" ) )
{
FIGURE figure;
figure.Parse( cNode );
figure.Parse( cNode, aContext );
Figures.insert( std::make_pair( figure.ID, figure ) );
}
else if( cNodeName == wxT( "SYMBOL" ) )
{
SYMBOL sym;
sym.Parse( cNode );
sym.Parse( cNode, aContext );
Symbols.insert( std::make_pair( sym.ID, sym ) );
}
else if( cNodeName == wxT( "BUS" ) )
{
BUS bus;
bus.Parse( cNode );
bus.Parse( cNode, aContext );
Buses.insert( std::make_pair( bus.ID, bus ) );
}
else if( cNodeName == wxT( "BLOCK" ) )
{
BLOCK block;
block.Parse( cNode );
block.Parse( cNode, aContext );
Blocks.insert( std::make_pair( block.ID, block ) );
}
else if( cNodeName == wxT( "NET" ) )
{
NET_SCH net;
net.Parse( cNode );
net.Parse( cNode, aContext );
Nets.insert( std::make_pair( net.ID, net ) );
}
else if( cNodeName == wxT( "TEXT" ) )
{
TEXT txt;
txt.Parse( cNode );
txt.Parse( cNode, aContext );
Texts.insert( std::make_pair( txt.ID, txt ) );
}
else if( cNodeName == wxT( "DOCSYMBOL" ) )
{
DOCUMENTATION_SYMBOL docsym;
docsym.Parse( cNode );
docsym.Parse( cNode, aContext );
DocumentationSymbols.insert( std::make_pair( docsym.ID, docsym ) );
}
else if( cNodeName == wxT( "VHIERARCHY" ) )
{
VariantHierarchy.Parse( cNode );
VariantHierarchy.Parse( cNode, aContext );
}
else
{
@ -1146,16 +1146,16 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SCHEMATIC::Parse( XNODE* aNode )
}
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::JUNCTION_SCH::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::JUNCTION_SCH::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
CADSTAR_ARCHIVE_PARSER::NET::JUNCTION::Parse( aNode );
CADSTAR_ARCHIVE_PARSER::NET::JUNCTION::Parse( aNode, aContext );
TerminalCodeID = GetXmlAttributeIDString( aNode, 1 );
LayerID = GetXmlAttributeIDString( aNode, 2 );
}
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::DANGLER::Parse( XNODE* aNode )
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::DANGLER::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
{
wxASSERT( aNode->GetName() == wxT( "DANGLER" ) );
@ -1172,12 +1172,12 @@ void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::DANGLER::Parse( XNODE* aNode )
if( cNodeName == wxT( "SIGLOC" ) )
{
NetLabel.Parse( cNode );
NetLabel.Parse( cNode, aContext );
HasNetLabel = true;
}
else if( !positionParsed && cNodeName == wxT( "PT" ) )
{
Position.Parse( cNode );
Position.Parse( cNode, aContext );
positionParsed = true;
}
else

View File

@ -79,7 +79,7 @@ public:
static TERMINAL_SHAPE_TYPE ParseTermShapeType( const wxString& aShapeStr );
struct TERMINAL_SHAPE
struct TERMINAL_SHAPE : PARSER
{
TERMINAL_SHAPE_TYPE ShapeType;
long Size = UNDEFINED_VALUE;
@ -89,18 +89,18 @@ public:
long OrientAngle = 0; ///< 1/1000 of a Degree
static bool IsTermShape( XNODE* aNode );
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct TERMINALCODE
struct TERMINALCODE : PARSER
{
TERMINALCODE_ID ID;
wxString Name;
TERMINAL_SHAPE Shape;
bool Filled = false;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -108,11 +108,11 @@ public:
{
std::map<TERMINALCODE_ID, TERMINALCODE> TerminalCodes;
void Parse( XNODE* aNode ) override;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct ASSIGNMENTS_SCM
struct ASSIGNMENTS_SCM : PARSER
{
CODEDEFS_SCM Codedefs;
GRIDS Grids;
@ -120,18 +120,18 @@ public:
bool NetclassEditAttributeSettings = false; //< Unclear what this does
bool SpacingclassEditAttributeSettings = false; //< Unclear what this does
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct TERMINAL
struct TERMINAL : PARSER
{
TERMINAL_ID ID;
TERMINALCODE_ID TerminalCodeID;
POINT Position; ///< Pad position within the component's coordinate frame.
long OrientAngle = 0;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -139,7 +139,7 @@ public:
{
TERMINAL_ID TerminalID;
void Parse( XNODE* aNode ) override;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -150,71 +150,71 @@ public:
std::map<TERMINAL_ID, PIN_NUM_LABEL_LOC> PinNumberLocations;
void Parse( XNODE* aNode ) override;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct LIBRARY_SCM
struct LIBRARY_SCM : PARSER
{
std::map<SYMDEF_ID, SYMDEF_SCM> SymbolDefinitions;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct SHEETS
struct SHEETS : PARSER
{
std::map<LAYER_ID, SHEET_NAME> SheetNames;
std::vector<LAYER_ID> SheetOrder; ///< A vector to also store the order in which
///< sheets are to be displayed
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct COMP
struct COMP : PARSER
{
wxString Designator = wxEmptyString;
bool ReadOnly = false;
bool HasLocation = false;
ATTRIBUTE_LOCATION AttrLoc;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct PARTREF
struct PARTREF : PARSER
{
PART_ID RefID = wxEmptyString;
bool ReadOnly = false;
bool HasLocation = false;
ATTRIBUTE_LOCATION AttrLoc;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct TERMATTR
struct TERMATTR : PARSER
{
TERMINAL_ID TerminalID;
ATTRIBUTE_VALUE Value;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct SYMPINNAME_LABEL
struct SYMPINNAME_LABEL : PARSER
{
TERMINAL_ID TerminalID;
wxString NameOrLabel;
bool HasLocation = false;
ATTRIBUTE_LOCATION AttrLoc;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct SYMBOLVARIANT
struct SYMBOLVARIANT : PARSER
{
enum class TYPE
{
@ -226,7 +226,7 @@ public:
TYPE Type;
wxString Reference;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -235,20 +235,20 @@ public:
wxString Text; ///< This contains the numbers of the other sheets where the
///< signal reference is present separated by commas
void Parse( XNODE* aNode ) override;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct SYMBOL
struct SYMBOL : PARSER
{
struct PIN_NUM
struct PIN_NUM : PARSER
{
TERMINAL_ID TerminalID;
long PinNum;
bool HasLocation = false;
ATTRIBUTE_LOCATION AttrLoc;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
SYMBOL_ID ID;
@ -289,7 +289,7 @@ public:
///< but only allowing numerical values
std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE> AttributeValues;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -298,11 +298,11 @@ public:
*/
struct SIGLOC : CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_LOCATION
{
void Parse( XNODE* aNode ) override;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct BUS
struct BUS : PARSER
{
BUS_ID ID;
LINECODE_ID LineCodeID;
@ -312,11 +312,11 @@ public:
bool HasBusLabel = false;
SIGLOC BusLabel;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct BLOCK
struct BLOCK : PARSER
{
enum class TYPE
{
@ -336,7 +336,7 @@ public:
std::map<TERMINAL_ID, TERMINAL> Terminals;
std::map<FIGURE_ID, FIGURE> Figures;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -346,10 +346,10 @@ public:
{
TERMINALCODE_ID TerminalCodeID; ///< Usually a circle, but size can be varied
void Parse( XNODE* aNode ) override;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct SYM_TERM ///< "TERM" nodename (represents a pin in a SCH symbol)
struct SYM_TERM : PARSER ///< "TERM" nodename (represents a pin in a SCH symbol)
{
NETELEMENT_ID ID; ///< First character is "P"
SYMBOL_ID SymbolID;
@ -357,10 +357,10 @@ public:
bool HasNetLabel = false;
SIGLOC NetLabel;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct BUS_TERM ///< "BUSTERM" nodename (represents a connetion to a bus)
struct BUS_TERM : PARSER ///< "BUSTERM" nodename (represents a connetion to a bus)
{
NETELEMENT_ID ID; ///< First two characters "BT"
BUS_ID BusID;
@ -369,10 +369,10 @@ public:
bool HasNetLabel = false;
SIGLOC NetLabel;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct BLOCK_TERM ///< "BLOCKTERM" nodename (represents a connetion to a block)
struct BLOCK_TERM : PARSER ///< "BLOCKTERM" nodename (represents a connetion to a block)
{
NETELEMENT_ID ID; ///< First four characters "BLKT"
BLOCK_ID BlockID;
@ -380,11 +380,11 @@ public:
bool HasNetLabel = false;
SIGLOC NetLabel;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct DANGLER ///< "DANGLER" nodename (represents a dangling wire)
struct DANGLER : PARSER ///< "DANGLER" nodename (represents a dangling wire)
{
NETELEMENT_ID ID; ///< First character "D"
TERMINALCODE_ID TerminalCodeID;
@ -393,7 +393,7 @@ public:
bool HasNetLabel = false;
SIGLOC NetLabel;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct CONNECTION_SCH : CADSTAR_ARCHIVE_PARSER::NET::CONNECTION ///< "CONN" nodename
@ -404,7 +404,7 @@ public:
REUSEBLOCKREF ReuseBlockRef;
LINECODE_ID ConnectionLineCode;
void Parse( XNODE* aNode ) override;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
std::map<NETELEMENT_ID, JUNCTION_SCH> Junctions;
@ -414,11 +414,11 @@ public:
std::map<NETELEMENT_ID, DANGLER> Danglers;
std::vector<CONNECTION_SCH> Connections;
void Parse( XNODE* aNode ) override;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct SCHEMATIC
struct SCHEMATIC : PARSER
{
std::map<GROUP_ID, GROUP> Groups;
std::map<REUSEBLOCK_ID, REUSEBLOCK> ReuseBlocks;
@ -432,7 +432,7 @@ public:
VARIANT_HIERARCHY VariantHierarchy;
std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE> AttributeValues;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};

File diff suppressed because it is too large Load Diff

View File

@ -86,7 +86,7 @@ public:
};
struct MATERIAL
struct MATERIAL : PARSER
{
MATERIAL_ID ID;
wxString Name;
@ -95,7 +95,7 @@ public:
EVALUE LossTangent;
EVALUE Resistivity; ///< x10^-8 ohm*metre
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -147,7 +147,7 @@ public:
};
struct LAYER
struct LAYER : PARSER
{
LAYER_ID ID;
wxString Name;
@ -166,48 +166,48 @@ public:
bool ReferencePlane = false;
bool VariantLayer = false;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct LAYERDEFS
struct LAYERDEFS : PARSER
{
std::map<MATERIAL_ID, MATERIAL> Materials;
std::map<LAYER_ID, LAYER> Layers;
std::vector<LAYER_ID> LayerStack;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct COPREASSIGN
struct COPREASSIGN : PARSER
{
LAYER_ID LayerID;
long CopperWidth;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct COPPERCODE
struct COPPERCODE : PARSER
{
COPPERCODE_ID ID;
wxString Name;
long CopperWidth;
std::vector<COPREASSIGN> Reassigns;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct SPACINGCODE
struct SPACINGCODE : PARSER
{
struct REASSIGN
struct REASSIGN : PARSER
{
LAYER_ID LayerID;
long Spacing;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
/**
@ -252,7 +252,7 @@ public:
long Spacing;
std::vector<REASSIGN> Reassigns; ///< Can have different spacings on differnt layers
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -270,7 +270,7 @@ public:
};
struct PAD_SHAPE
struct PAD_SHAPE : PARSER
{
PAD_SHAPE_TYPE ShapeType;
long Size = UNDEFINED_VALUE;
@ -280,20 +280,20 @@ public:
long OrientAngle = 0; ///< 1/1000 of a Degree
static bool IsPadShape( XNODE* aNode );
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct PADREASSIGN
struct PADREASSIGN : PARSER
{
LAYER_ID LayerID;
PAD_SHAPE Shape;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct PADCODE
struct PADCODE : PARSER
{
PADCODE_ID ID;
wxString Name;
@ -310,20 +310,20 @@ public:
std::map<LAYER_ID, PAD_SHAPE> Reassigns;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct VIAREASSIGN
struct VIAREASSIGN : PARSER
{
LAYER_ID LayerID;
PAD_SHAPE Shape;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct VIACODE
struct VIACODE : PARSER
{
VIACODE_ID ID;
wxString Name;
@ -335,11 +335,11 @@ public:
std::map<LAYER_ID, PAD_SHAPE> Reassigns;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct LAYERPAIR
struct LAYERPAIR : PARSER
{
LAYERPAIR_ID ID;
wxString Name;
@ -347,22 +347,22 @@ public:
PHYSICAL_LAYER_ID PhysicalLayerEnd;
VIACODE_ID ViacodeID;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct SPCCLASSSPACE
struct SPCCLASSSPACE : PARSER
{
SPACING_CLASS_ID SpacingClassID1;
SPACING_CLASS_ID SpacingClassID2;
LAYER_ID LayerID; ///< Normally LAY0, which corresponds to (All Layers)
long Spacing;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct RULESET
struct RULESET : PARSER
{
RULESET_ID ID;
wxString Name;
@ -377,7 +377,7 @@ public:
std::map<SPACINGCODE_ID, SPACINGCODE>
SpacingCodes; ///< Overrides these spacing rules in the specific
///< area.
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -392,7 +392,7 @@ public:
LayerPairs; ///< Default vias to use between pairs of layers
std::vector<SPCCLASSSPACE> SpacingClasses;
void Parse( XNODE* aNode ) override;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -415,11 +415,11 @@ public:
bool BackOffJunctions = false;
bool BackOffWidthChange = false;
void Parse( XNODE* aNode ) override;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct ASSIGNMENTS
struct ASSIGNMENTS : PARSER
{
LAYERDEFS Layerdefs;
CODEDEFS_PCB Codedefs;
@ -428,14 +428,14 @@ public:
bool NetclassEditAttributeSettings = false; //< Unclear what this does
bool SpacingclassEditAttributeSettings = false; //< Unclear what this does
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
/**
* @brief A shape of copper in the component footprint. For KiCad import, this could
* be converted to a custom shaped pad (as long as AssociatedPadIDs is not empty)
*/
struct COMPONENT_COPPER
struct COMPONENT_COPPER : PARSER
{
COPPERCODE_ID CopperCodeID;
LAYER_ID LayerID;
@ -443,7 +443,7 @@ public:
SWAP_RULE SwapRule = SWAP_RULE::BOTH;
std::vector<PAD_ID> AssociatedPadIDs;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
/**
@ -452,7 +452,7 @@ public:
* no operations are carried out and where no items are placed by operations such as Placement
* and Routing."
*/
struct COMPONENT_AREA
struct COMPONENT_AREA : PARSER
{
COMP_AREA_ID ID;
LINECODE_ID LineCodeID;
@ -469,7 +469,7 @@ public:
///< by the Auto Router and Route Editor options as the area within
///< which no vias are placed during automatic routing."
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
/**
@ -506,7 +506,7 @@ public:
* at an angle): it is relative to the component as a whole. This is confusing, considering this
* property belongs to the pad...
*/
struct PAD_EXITS
struct PAD_EXITS : PARSER
{
bool FreeAngle = false;
bool North = false;
@ -518,11 +518,11 @@ public:
bool West = false;
bool NorthWest = false;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct COMPONENT_PAD
struct COMPONENT_PAD : PARSER
{
PAD_ID ID;
POINT Position; ///< Pad position within the component's coordinate frame.
@ -549,13 +549,13 @@ public:
///< incorrectly acting on mechanical pads / components that only
///< appear in the PCB design."
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
/**
* @brief Linear, leader (radius/diameter) or angular dimension
*/
struct DIMENSION
struct DIMENSION : PARSER
{
enum class TYPE
{
@ -580,7 +580,7 @@ public:
};
struct ARROW //"DIMARROW"
struct ARROW : PARSER //"DIMARROW"
{
enum class STYLE
{
@ -602,7 +602,7 @@ public:
long LowerAngle; ///< token="ARROWANGLEB"
long ArrowLength; ///< The length of the angled lines that make up the arrow head
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
/**
@ -619,7 +619,7 @@ public:
* Note: the token is "DIMTEXT" in the CADSTAR format, but this has been renamed to
* TEXTFORMAT in the cadstar2kicadplugin for ease of understanding.
*/
struct TEXTFORMAT
struct TEXTFORMAT : PARSER
{
enum class STYLE ///< Token "TXTSTYLE"
{
@ -634,11 +634,11 @@ public:
long TextOffset; ///< Specifies how far above the line the text is (doesn't have
///< an effect on actual position!)
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct EXTENSION_LINE ///< Token "EXTLINE"
struct EXTENSION_LINE : PARSER ///< Token "EXTLINE"
{
LINECODE_ID LineCodeID;
@ -649,11 +649,11 @@ public:
bool SuppressFirst = false; ///< If true, excludes the first extension line (only
///< shows extension line at end)
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct LINE ///< Token can be either "LEADERLINE", "LINEARLINE" or "ANGULARLINE"
struct LINE : PARSER ///< Token can be either "LEADERLINE", "LINEARLINE" or "ANGULARLINE"
{
enum class TYPE
{
@ -688,7 +688,7 @@ public:
///< leader line [param6]
static bool IsLine( XNODE* aNode );
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
TYPE Type;
@ -710,7 +710,7 @@ public:
REUSEBLOCKREF ReuseBlockRef;
static bool IsDimension( XNODE* aNode );
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
/**
@ -781,19 +781,19 @@ public:
std::map<PAD_ID, COMPONENT_PAD> ComponentPads;
std::map<DIMENSION_ID, DIMENSION> Dimensions; ///< inside "DIMENSIONS" subnode
void Parse( XNODE* aNode ) override;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct LIBRARY
struct LIBRARY : PARSER
{
std::map<SYMDEF_ID, SYMDEF_PCB> ComponentDefinitions;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct BOARD
struct BOARD : PARSER
{
BOARD_ID ID;
LINECODE_ID LineCodeID;
@ -805,7 +805,7 @@ public:
REUSEBLOCKREF ReuseBlockRef; ///< Normally BOARD cannot be part of a reuseblock,
///< but included for completeness
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
/**
@ -815,7 +815,7 @@ public:
* and Routing. [...]
* More than one function can be assigned to an area."
*/
struct AREA
struct AREA : PARSER
{
AREA_ID ID;
LINECODE_ID LineCodeID;
@ -849,7 +849,7 @@ public:
REUSEBLOCKREF ReuseBlockRef;
std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE> AttributeValues;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -865,17 +865,17 @@ public:
static TESTLAND_SIDE ParseTestlandSide( XNODE* aNode );
struct PIN_ATTRIBUTE
struct PIN_ATTRIBUTE : PARSER
{
PART_DEFINITION_PIN_ID Pin;
std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE> AttributeValues;
TESTLAND_SIDE TestlandSide = TESTLAND_SIDE::NONE;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct PADEXCEPTION
struct PADEXCEPTION : PARSER
{
PAD_ID ID;
PADCODE_ID PadCode = wxEmptyString; ///< If not empty, override padcode
@ -886,11 +886,11 @@ public:
bool OverrideOrientation = false;
long OrientAngle = 0;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct COMPONENT
struct COMPONENT : PARSER
{
COMPONENT_ID ID;
wxString Name; ///< Designator e.g. "C1", "R1", etc.
@ -922,38 +922,38 @@ public:
std::map<PAD_ID, PADEXCEPTION> PadExceptions; ///< Override pad definitions
///< for this instance
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct TRUNK
struct TRUNK : PARSER
{
TRUNK_ID ID;
wxString Definition; // TODO: more work required to fully parse the TRUNK structure
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct NET_PCB : CADSTAR_ARCHIVE_PARSER::NET
{
struct PIN ///< "PIN" nodename (represents a PAD in a PCB component)
struct PIN : PARSER ///< "PIN" nodename (represents a PAD in a PCB component)
{
NETELEMENT_ID ID; ///< First character is "P"
COMPONENT_ID ComponentID;
PAD_ID PadID;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct JUNCTION_PCB : CADSTAR_ARCHIVE_PARSER::NET::JUNCTION ///< "JPT" nodename
{
TRUNK_ID TrunkID; ///< TRUNKREF Statements
void Parse( XNODE* aNode ) override;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct VIA ///< "VIA" nodename
struct VIA : PARSER ///< "VIA" nodename
{
NETELEMENT_ID ID; ///< First character is "V"
VIACODE_ID ViaCodeID;
@ -965,35 +965,35 @@ public:
TESTLAND_SIDE TestlandSide = TESTLAND_SIDE::NONE;
bool Fixed = false;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct COPPER_TERMINAL ///< "COPTERM" nodename
struct COPPER_TERMINAL : PARSER ///< "COPTERM" nodename
{
NETELEMENT_ID ID; ///< First two character are "CT"
COPPER_ID CopperID;
COPPER_TERM_ID CopperTermNum;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct ROUTE_VERTEX ///< Two sibbling nodes: first node being "ROUTEWIDTH" and next
///< node being a VERTEX (e.g. PT, CWARC, etc.)
struct ROUTE_VERTEX ///< Two sibbling nodes: first node being "ROUTEWIDTH" and
///< next node being a VERTEX (e.g. PT, CWARC, etc.)
{
long RouteWidth;
bool Fixed = false;
VERTEX Vertex;
XNODE* Parse( XNODE* aNode ); ///< Returns a pointer to the last node
XNODE* Parse( XNODE* aNode, PARSER_CONTEXT* aContext ); ///< Returns a pointer to the last node
};
struct ROUTE ///< "ROUTE" nodename
struct ROUTE : PARSER ///< "ROUTE" nodename
{
LAYER_ID LayerID = wxEmptyString;
POINT StartPoint;
std::vector<ROUTE_VERTEX> RouteVertices;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct CONNECTION_PCB : CADSTAR_ARCHIVE_PARSER::NET::CONNECTION ///< "CONN" nodename
@ -1007,7 +1007,7 @@ public:
LAYER_ID UnrouteLayerID = wxEmptyString; ///< See Unrouted member variable.
TRUNK_ID TrunkID; ///< TRUNKREF Statements
void Parse( XNODE* aNode ) override;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
std::map<NETELEMENT_ID, PIN> Pins;
@ -1016,7 +1016,7 @@ public:
std::map<NETELEMENT_ID, COPPER_TERMINAL> CopperTerminals;
std::vector<CONNECTION_PCB> Connections;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
/**
@ -1025,9 +1025,9 @@ public:
* has indeed been "poured", there will be one or more separate COPPER objects linked to the
* TEMPLATE via COPPER::PouredTemplateID
*/
struct TEMPLATE
struct TEMPLATE : PARSER
{
struct POURING
struct POURING : PARSER
{
enum class COPPER_FILL_TYPE
{
@ -1089,7 +1089,7 @@ public:
COPPER_FILL_TYPE FillType = COPPER_FILL_TYPE::FILLED; ///< Assume solid fill
HATCHCODE_ID HatchCodeID = wxEmptyString; ///< Only for FillType = HATCHED
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
TEMPLATE_ID ID;
@ -1105,28 +1105,28 @@ public:
std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE> AttributeValues;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct COPPER
struct COPPER : PARSER
{
struct NETREF
struct NETREF : PARSER
{
struct COPPER_TERM
struct COPPER_TERM : PARSER
{
COPPER_TERM_ID ID;
POINT Location;
bool Fixed = false;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
NET_ID NetID = wxEmptyString;
std::map<COPPER_TERM_ID, COPPER_TERM> CopperTerminals;
bool Fixed = false;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
COPPER_ID ID;
@ -1142,7 +1142,7 @@ public:
std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE> AttributeValues;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -1154,7 +1154,7 @@ public:
};
struct DRILL_TABLE
struct DRILL_TABLE : PARSER
{
DRILL_TABLE_ID ID;
LAYER_ID LayerID;
@ -1167,11 +1167,11 @@ public:
///< is part of a group
REUSEBLOCKREF ReuseBlockRef;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
struct LAYOUT
struct LAYOUT : PARSER
{
NETSYNCH NetSynch = NETSYNCH::UNDEFINED;
@ -1193,7 +1193,7 @@ public:
std::map<DRILL_TABLE_ID, DRILL_TABLE> DrillTables;
VARIANT_HIERARCHY VariantHierarchy;
void Parse( XNODE* aNode );
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};