30 #ifndef _PCBNEW_PARSER_H_ 31 #define _PCBNEW_PARSER_H_ 37 #include <pcb_lexer.h> 39 #include <unordered_map> 71 typedef std::unordered_map< std::string, PCB_LAYER_ID >
LAYER_ID_MAP;
72 typedef std::unordered_map< std::string, LSET >
LSET_MAP;
73 typedef std::unordered_map< wxString, KIID >
KIID_MAP;
105 if( ( aNetCode >= 0 ) && ( aNetCode < (
int)
m_netCodes.size() ) )
194 template<
class T,
class M>
230 void parseXY(
int* aX,
int* aY );
257 NeedNUMBER( aExpected );
280 double int_limit = std::numeric_limits<int>::max() * 0.7071;
281 return KiROUND( Clamp<double>( -int_limit, retval, int_limit ) );
291 double int_limit = std::numeric_limits<int>::max() * 0.7071;
296 return KiROUND( Clamp<double>( -int_limit, retval, int_limit ) );
306 return (
int)strtol( CurText(),
NULL, 10 );
311 NeedNUMBER( aExpected );
318 return strtol( CurText(),
NULL, 16 );
337 PCB_LEXER( aReader ),
355 PushReader( aReader );
364 if( aBoard !=
nullptr )
394 #endif // _PCBNEW_PARSER_H_
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
std::unordered_map< wxString, KIID > KIID_MAP
LSET parseBoardItemLayersAsMask()
Function parseBoardItemLayersAsMask parses the layers definition of a BOARD_ITEM object.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
static constexpr double IU_PER_MM
Mock up a conversion function.
PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates)
PCB_PARSER reads a Pcbnew s-expression formatted LINE_READER object and returns the appropriate BOARD...
std::vector< KIID > memberUuids
wxPoint parseXY()
Function parseXY parses a coordinate pair (xy X Y) in board units (mm).
void createOldLayerMapping(std::unordered_map< std::string, std::string > &aMap)
Creates a mapping from the (short-lived) bug where layer names were translated TODO: Remove this once...
void parseEDA_TEXT(EDA_TEXT *aText)
Function parseEDA_TEXT parses the common settings for any object derived from EDA_TEXT.
bool m_tooRecent
true if version parses as later than supported
PCB_SHAPE * parsePCB_SHAPE()
int parseBoardUnits(PCB_KEYS_T::T aToken)
std::unordered_map< std::string, LSET > LSET_MAP
std::unordered_map< std::string, PCB_LAYER_ID > LAYER_ID_MAP
FP_SHAPE * parseFP_SHAPE()
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
KIID_MAP m_resetKIIDMap
if resetting UUIDs, record new ones to update groups with
void skipCurrent()
Function skipCurrent Skip the current token level, i.e search for the RIGHT parenthesis which closes ...
bool parsePAD_option(PAD *aPad)
PCB_LAYER_ID
A quick note on layer IDs:
wxString GetRequiredVersion()
Return a string representing the version of kicad required to open this file.
LSET is a set of PCB_LAYER_IDs.
void SetBoard(BOARD *aBoard)
std::pair< wxString, wxString > parseProperty()
PCB_TEXT * parsePCB_TEXT()
PCB_PARSER(LINE_READER *aReader=NULL)
PCB_TARGET * parsePCB_TARGET()
PCB_LAYER_ID parseBoardItemLayer()
Function parseBoardItemLayer parses the layer definition of a BOARD_ITEM object.
FOOTPRINT * parseFOOTPRINT(wxArrayString *aInitialComments=0)
Function parseFOOTPRINT.
std::vector< GROUP_INFO > m_groupInfos
PAD * parsePAD(FOOTPRINT *aParent=NULL)
FOOTPRINT * parseFOOTPRINT_unchecked(wxArrayString *aInitialComments=0)
ZONE handles a list of polygons defining a copper zone.
bool m_showLegacyZoneWarning
LINE_READER * SetLineReader(LINE_READER *aReader)
Function SetLineReader sets aLineReader into the parser, and returns the previous one,...
void parseDefaults(BOARD_DESIGN_SETTINGS &aSettings)
int parseInt(const char *aExpected)
void parseGROUP(BOARD_ITEM *aParent)
BOARD * parseBOARD_unchecked()
void parseLayer(LAYER *aLayer)
int m_requiredVersion
set to the KiCad format version this board requires
bool IsTooRecent()
Return whether a version number, if any was parsed, was too recent.
void parseDefaultTextDims(BOARD_DESIGN_SETTINGS &aSettings, int aLayer)
Board layer functions and definitions.
Container to hold information pertinent to a layer of a BOARD.
Information pertinent to a Pcbnew printed circuit board.
std::vector< int > m_netCodes
net codes mapping for boards being loaded
int getNetCode(int aNetCode)
Converts net code using the mapping table if available, otherwise returns unchanged net code if < 0 o...
void parseGeneralSection()
void init()
Function init clears and re-establishes m_layerMap with the default layer names.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
void pushValueIntoMap(int aIndex, int aValue)
function pushValueIntoMap Add aValue value in netcode mapping (m_netCodes) at index aIndex ensure the...
double parseDouble(PCB_KEYS_T::T aToken)
double parseDouble()
Function parseDouble parses the current token as an ASCII numeric string with possible leading whites...
const char * GetTokenText(T aTok)
Function GetTokenText is in the DSN namespace and returns the C string representing a SPECCTRA_DB::ke...
LAYER_ID_MAP m_layerIndices
map layer name to it's index
Abstract interface for BOARD_ITEMs capable of storing other items inside.
DIMENSION_BASE * parseDIMENSION()
void resolveGroups(BOARD_ITEM *aParent)
Called after parsing a footprint definition or board to build the group membership lists.
FP_3DMODEL * parse3DModel()
LSET_MAP m_layerMasks
map layer names to their masks
int parseBoardUnits(const char *aExpected)
T lookUpLayer(const M &aMap)
Function lookUpLayer parses the current token for the layer definition of a BOARD_ITEM object.
std::set< wxString > m_undefinedLayers
set of layers not defined in layers section
bool m_resetKIIDs
reading into an existing board; reset UUIDs
double parseDouble(const char *aExpected)
Container for design settings for a BOARD object.
ZONE * parseZONE(BOARD_ITEM_CONTAINER *aParent)