30 #ifndef _PCBNEW_PARSER_H_ 31 #define _PCBNEW_PARSER_H_ 37 #include <pcb_lexer.h> 39 #include <unordered_map> 90 PushReader( aReader );
99 if( aBoard !=
nullptr )
132 if( ( aNetCode >= 0 ) && ( aNetCode < (
int)
m_netCodes.size() ) )
220 template<
class T,
class M>
253 void parseXY(
int* aX,
int* aY );
278 NeedNUMBER( aExpected );
301 double int_limit = std::numeric_limits<int>::max() * 0.7071;
302 return KiROUND( Clamp<double>( -int_limit, retval, int_limit ) );
312 double int_limit = std::numeric_limits<int>::max() * 0.7071;
316 return KiROUND( Clamp<double>( -int_limit, retval, int_limit ) );
326 return (
int)strtol( CurText(),
NULL, 10 );
331 NeedNUMBER( aExpected );
338 return strtol( CurText(),
NULL, 16 );
355 typedef std::unordered_map< std::string, LSET >
LSET_MAP;
356 typedef std::unordered_map< wxString, KIID >
KIID_MAP;
388 #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()
Parse 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.
A set of BOARD_ITEMs (i.e., without duplicates).
Read a Pcbnew s-expression formatted LINE_READER object and returns the appropriate BOARD_ITEM object...
std::vector< KIID > memberUuids
wxPoint parseXY()
Parse a coordinate pair (xy X Y) in board units (mm).
void createOldLayerMapping(std::unordered_map< std::string, std::string > &aMap)
Create a mapping from the (short-lived) bug where layer names were translated.
void parseEDA_TEXT(EDA_TEXT *aText)
Parse 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,...
void skipCurrent()
Skip the current token level, i.e search for the RIGHT parenthesis which closes the current descripti...
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()
Parse the layer definition of a BOARD_ITEM object.
FOOTPRINT * parseFOOTPRINT(wxArrayString *aInitialComments=0)
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)
Set aLineReader into the parser, and returns the previous one, if any.
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)
< Convert net code using the mapping table if available, otherwise returns unchanged net code if < 0 ...
void parseGeneralSection()
void init()
Clear and re-establish 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)
Add aValue value in netcode mapping (m_netCodes) at aIndex.
double parseDouble(PCB_KEYS_T::T aToken)
double parseDouble()
Parse the current token as an ASCII numeric string with possible leading whitespace into a double pre...
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)
Parse 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)