30#ifndef _PCBNEW_PARSER_H_
31#define _PCBNEW_PARSER_H_
41#include <unordered_map>
77 std::function<
bool( wxString,
int, wxString, wxString )>* aQueryUserCallback,
121 if( ( aNetCode >= 0 ) && ( aNetCode < (
int)
m_netCodes.size() ) )
214 template<
class T,
class M>
247 void parseXY(
int* aX,
int* aY );
297 return (
int)strtol( CurText(),
nullptr, 10 );
302 NeedNUMBER( aExpected );
309 return strtol( CurText(),
nullptr, 16 );
326 typedef std::unordered_map< std::string, LSET >
LSET_MAP;
327 typedef std::unordered_map< wxString, KIID >
KIID_MAP;
333 using CLOCK = std::chrono::steady_clock;
336 using TIME_PT = std::chrono::time_point<CLOCK>;
Container for design settings for a BOARD object.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Information pertinent to a Pcbnew printed circuit board.
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
LSET is a set of PCB_LAYER_IDs.
Object to handle a bitmap image that can be inserted in a PCB.
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...
bool parsePAD_option(PAD *aPad)
PCB_TRACK * parsePCB_TRACK()
PCB_LAYER_ID parseBoardItemLayer()
Parse the layer definition of a BOARD_ITEM object.
void parseRenderCache(EDA_TEXT *text)
Parse the render cache for any object derived from EDA_TEXT.
PCB_SHAPE * parsePCB_SHAPE()
int parseInt(const char *aExpected)
LSET_MAP m_layerMasks
map layer names to their masks
void init()
Clear and re-establish m_layerMap with the default layer names.
PAD * parsePAD(FOOTPRINT *aParent=nullptr)
ZONE * parseZONE(BOARD_ITEM_CONTAINER *aParent)
FOOTPRINT * parseFOOTPRINT_unchecked(wxArrayString *aInitialComments=nullptr)
void parseEDA_TEXT(EDA_TEXT *aText)
Parse the common settings for any object derived from EDA_TEXT.
PCB_TEXTBOX * parsePCB_TEXTBOX()
int m_requiredVersion
set to the KiCad format version this board requires
int parseBoardUnits()
Parse the current token as an ASCII numeric string with possible leading whitespace into a double pre...
std::pair< wxString, wxString > parseProperty()
bool IsTooRecent()
Return whether a version number, if any was parsed, was too recent.
TIME_PT m_lastProgressTime
for progress reporting
std::chrono::milliseconds TIMEOUT
The clock used for the timestamp (guaranteed to be monotonic).
FP_SHAPE * parseFP_SHAPE()
std::unordered_map< std::string, LSET > LSET_MAP
std::vector< GROUP_INFO > m_groupInfos
BOARD * parseBOARD_unchecked()
int getNetCode(int aNetCode)
< Convert net code using the mapping table if available, otherwise returns unchanged net code if < 0 ...
PCB_TEXT * parsePCB_TEXT()
bool m_appendToExisting
reading into an existing board; reset UUIDs
std::set< wxString > m_undefinedLayers
set of layers not defined in layers section
void parseDefaults(BOARD_DESIGN_SETTINGS &aSettings)
void parseOutlinePoints(SHAPE_LINE_CHAIN &aPoly)
Parses possible outline points and stores them into aPoly.
bool m_tooRecent
true if version parses as later than supported
std::function< bool(wxString aTitle, int aIcon, wxString aMsg, wxString aAction)> * m_queryUserCallback
FP_TEXTBOX * parseFP_TEXTBOX()
bool m_showLegacySegmentZoneWarning
PCB_TARGET * parsePCB_TARGET()
FP_3DMODEL * parse3DModel()
void parseGROUP(BOARD_ITEM *aParent)
LSET parseBoardItemLayersAsMask()
Parse the layers definition of a BOARD_ITEM object.
VECTOR2I parseXY()
Parse a coordinate pair (xy X Y) in board units (mm).
std::unordered_map< std::string, PCB_LAYER_ID > LAYER_ID_MAP
std::chrono::time_point< CLOCK > TIME_PT
std::unordered_map< wxString, KIID > KIID_MAP
The type of progress bar timeout.
PCB_PARSER(LINE_READER *aReader, BOARD *aAppendToMe, std::function< bool(wxString, int, wxString, wxString)> *aQueryUserCallback, PROGRESS_REPORTER *aProgressReporter=nullptr, unsigned aLineCount=0)
PCB_BITMAP * parsePCB_BITMAP(BOARD_ITEM *aParent)
PCB_DIMENSION_BASE * parseDIMENSION(BOARD_ITEM *aParent, bool aInFP)
wxString GetRequiredVersion()
Return a string representing the version of KiCad required to open this file.
bool m_showLegacy5ZoneWarning
FOOTPRINT * parseFOOTPRINT(wxArrayString *aInitialComments=nullptr)
void resolveGroups(BOARD_ITEM *aParent)
Called after parsing a footprint definition or board to build the group membership lists.
PROGRESS_REPORTER * m_progressReporter
optional; may be nullptr
T lookUpLayer(const M &aMap)
Parse the current token for the layer definition of a BOARD_ITEM object.
std::vector< int > m_netCodes
net codes mapping for boards being loaded
std::chrono::steady_clock CLOCK
The type of the time stamps.
void parseGeneralSection()
void createOldLayerMapping(std::unordered_map< std::string, std::string > &aMap)
Create a mapping from the (short-lived) bug where layer names were translated.
void parseDefaultTextDims(BOARD_DESIGN_SETTINGS &aSettings, int aLayer)
void parseLayer(LAYER *aLayer)
unsigned m_lineCount
for progress reporting
void skipCurrent()
Skip the current token level, i.e search for the RIGHT parenthesis which closes the current descripti...
LAYER_ID_MAP m_layerIndices
map layer name to it's index
void pushValueIntoMap(int aIndex, int aValue)
Add aValue value in netcode mapping (m_netCodes) at aIndex.
int parseBoardUnits(PCB_KEYS_T::T aToken)
A progress reporter interface for use in multi-threaded environments.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Handle a list of polygons defining a copper zone.
PCB_LAYER_ID
A quick note on layer IDs:
const char * GetTokenText(T aTok)
The DSN namespace and returns the C string representing a SPECCTRA_DB::keyword.
Container to hold information pertinent to a layer of a BOARD.
std::vector< KIID > memberUuids