KiCad PCB EDA Suite
ptree.cpp File Reference
#include <macros.h>
#include <boost/property_tree/ptree.hpp>
#include <cassert>
#include <ptree.h>

Go to the source code of this file.

Macros

#define D(x)
 
#define CTL_OMIT_NL   (1<<0)
 
#define CTL_IN_ATTRS   (1<<1)
 

Typedefs

typedef PTREE::const_iterator CITER
 
typedef PTREE::iterator ITER
 

Functions

void scanList (PTREE *aTree, DSNLEXER *aLexer)
 Function scanList reads a sexpr list from the input stream into a new node with key aLexer->CurText(). More...
 
void scanAtom (PTREE *aTree, const DSNLEXER *aLexer)
 
void Scan (PTREE *aTree, DSNLEXER *aLexer)
 Fill an empty PTREE with information from a KiCad s-expression stream. More...
 
bool isAtom (const CPTREE &aTree)
 
bool isLast (const CPTREE &aTree, CITER it)
 
CITER next (CITER it)
 
static void formatNode (OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const std::string &aKey, const CPTREE &aTree)
 
static void formatList (OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
 
void Format (OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
 Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative. More...
 

Macro Definition Documentation

◆ CTL_IN_ATTRS

#define CTL_IN_ATTRS   (1<<1)

Definition at line 45 of file ptree.cpp.

◆ CTL_OMIT_NL

#define CTL_OMIT_NL   (1<<0)

Definition at line 44 of file ptree.cpp.

◆ D

#define D (   x)

Definition at line 41 of file ptree.cpp.

Typedef Documentation

◆ CITER

typedef PTREE::const_iterator CITER

Definition at line 35 of file ptree.cpp.

◆ ITER

typedef PTREE::iterator ITER

Definition at line 36 of file ptree.cpp.

Function Documentation

◆ Format()

void Format ( OUTPUTFORMATTER out,
int  aNestLevel,
int  aCtl,
const CPTREE aTree 
)

Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.

Definition at line 200 of file ptree.cpp.

201{
202 if( aTree.size() == 1 && !aTree.data().size() )
203 {
204 // The topmost node is basically only a container for the document root.
205 // It anchors the paths which traverse the tree deeper.
206 CITER it = aTree.begin();
207 formatNode( out, aNestLevel, aCtl, it->first, it->second );
208 }
209 else
210 {
211 // This is not expected, neither for sexpr nor xml.
212 formatNode( out, aNestLevel, aCtl, "", aTree );
213 }
214}
PTREE::const_iterator CITER
Definition: ptree.cpp:35
static void formatNode(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const std::string &aKey, const CPTREE &aTree)
Definition: ptree.cpp:166

References formatNode().

Referenced by ACTION_MENU::AddClose(), PROJECT_TREE_PANE::addItemToProjectTree(), GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), SYMBOL_TREE_MODEL_ADAPTER::AddLibraries(), SYMBOL_EDIT_FRAME::AddLibraryFile(), ACTION_MENU::AddQuitOrClose(), DIALOG_MANAGE_REPOSITORIES::addRepository(), ALTIUM_COMPOUND_FILE::ALTIUM_COMPOUND_FILE(), AltiumSpecialStringsToKiCadVariables(), PCB_CONTROL::AppendBoard(), SCH_CONNECTION::AppendInfoToMsgPanel(), CADSTAR_PCB_ARCHIVE_LOADER::applyDimensionSettings(), PANEL_COMMON_SETTINGS::applySettingsToPanel(), HPGL_PLOTTER::Arc(), PROJECT_ARCHIVER::Archive(), KIID::AsLegacyTimestampString(), CVPCB_ASSOCIATION_TOOL::Associate(), CVPCB_MAINFRAME::AssociateFootprint(), AUTOPLACE_TOOL::autoplace(), AR_AUTOPLACER::AutoplaceFootprints(), SYMBOL_EDIT_FRAME::backupFile(), SETTINGS_MANAGER::BackupProject(), BOM_GENERATOR_HANDLER::BOM_GENERATOR_HANDLER(), PIN_TABLE_DATA_MODEL::BoolFromString(), FIELDS_GRID_TABLE< T >::BoolFromString(), BOOST_AUTO_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), PANEL_FP_LIB_TABLE::browseLibrariesHandler(), PANEL_SYM_LIB_TABLE::browseLibrariesHandler(), DIALOG_BOARD_REANNOTATE::BuildFootprintList(), DS_DRAW_ITEM_LIST::BuildFullText(), PNS::buildHullForPrimitiveShape(), PNS_LOG_VIEWER_FRAME::buildListTree(), EAGLE_PLUGIN::cacheLib(), PYTHON_ACTION_PLUGIN::CallMethod(), PYTHON_FOOTPRINT_WIZARD::CallMethod(), FOOTPRINT_EDIT_FRAME::CanCloseFPFromBoard(), SYMBOL_EDIT_FRAME::CanCloseSymbolFromSchematic(), SCH_EDIT_FRAME::canCloseWindow(), PL_EDITOR_FRAME::canCloseWindow(), PCB_EDIT_FRAME::canCloseWindow(), SIM_PLOT_FRAME::canCloseWindow(), FOOTPRINT_EDIT_FRAME::canCloseWindow(), SCH_EDIT_TOOL::ChangeTextType(), CADSTAR_PCB_ARCHIVE_LOADER::checkAndLogHatchCode(), PANEL_SETUP_LAYERS::CheckCopperLayerCount(), EDA_BASE_FRAME::CheckForAutoSaveFile(), BACK_ANNOTATE::checkForUnusedSymbols(), checkGlError(), PANEL_IMAGE_EDITOR::CheckValues(), HPGL_PLOTTER::Circle(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), PDF_PLOTTER::ClosePage(), Collide(), collideSingleShapes(), DRC_RULE_CONDITION::Compile(), DRC_ENGINE::compileRules(), NUMBER_BADGE::computeSize(), ConfigBaseWriteDouble(), ConvertArcCenter(), DIALOG_BOARD_REANNOTATE::CoordTowxString(), ACTION_MENU::create(), MICROWAVE_TOOL::createBaseFootprint(), createBoard(), APPEARANCE_CONTROLS::createControls(), IMPORT_PROJ_HELPER::CreateEmptyDirForProject(), PCB_BASE_EDIT_FRAME::createNewLibrary(), KICAD_MANAGER_FRAME::CreateNewProject(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), CreateShapesSection(), PANEL_GERBVIEW_COLOR_SETTINGS::createSwatches(), SCH_SEXPR_PLUGIN::CreateSymbolLib(), SCH_LEGACY_PLUGIN::CreateSymbolLib(), CADSTAR_PCB_ARCHIVE_LOADER::createUniqueGroupID(), SYMBOL_EDIT_FRAME::DdAddLibrary(), PROJECT_TREE_ITEM::Delete(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), PCM_TASK_MANAGER::deletePackageDirectories(), SCH_SEXPR_PLUGIN_CACHE::DeleteSymbol(), SCH_LEGACY_PLUGIN_CACHE::DeleteSymbol(), SYMBOL_EDIT_FRAME::DeleteSymbolFromLibrary(), SCH_SEXPR_PLUGIN::DeleteSymbolLib(), SCH_LEGACY_PLUGIN::DeleteSymbolLib(), DIALOG_ABOUT::DIALOG_ABOUT(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DIALOG_LOCKED_ITEMS_QUERY::DIALOG_LOCKED_ITEMS_QUERY(), DIALOG_PASTE_SPECIAL::DIALOG_PASTE_SPECIAL(), DIALOG_PCM::DIALOG_PCM(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), KIGFX::PREVIEW::DimensionLabel(), DIALOG_PAD_PROPERTIES::displayPrimitivesList(), CVPCB_MAINFRAME::DisplayStatus(), PGPROPERTY_DISTANCE::DistanceToString(), PCB_EDIT_FRAME::doCloseWindow(), SCH_FIELD::DoHypertextAction(), EDA_3D_CANVAS::DoRePaint(), ACTION_TOOLBAR::doSelectAction(), SELECTION_TOOL::doSelectionMenu(), PCM_TASK_MANAGER::DownloadAndInstall(), PCM_TASK_MANAGER::downloadFile(), PLUGIN_CONTENT_MANAGER::DownloadToStream(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawBoardCharacteristics(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarShape(), drawShapes(), SCH_DRAWING_TOOLS::DrawSheet(), EDIT_TOOL::Duplicate(), DSNLEXER::Duplicate(), WIDGET_HOTKEY_LIST::editItem(), PDF_PLOTTER::EndPlot(), SCH_DATABASE_PLUGIN::ensureConnection(), SCH_DATABASE_PLUGIN::ensureSettings(), PAD_TOOL::EnumeratePads(), SCH_DATABASE_PLUGIN::EnumerateSymbolLib(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckHierSheets(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), DRC_ENGINE::EvalRules(), DIALOG_SIM_SETTINGS::evaluateDCControls(), DRC_ENGINE::EvalZoneConnection(), LIBEVAL::UOP::Exec(), EXCELLON_IMAGE::Execute_EXCELLON_G_Command(), existsOnLayerFunc(), DSNLEXER::Expecting(), FOOTPRINT_EDIT_FRAME::ExportFootprint(), PCB_EDIT_FRAME::ExportFootprintsToLibrary(), DIALOG_EXPORT_SVG::ExportSVGFile(), SCH_EDITOR_CONTROL::ExportSymbolsToLibrary(), PCB_EDIT_FRAME::ExportToGenCAD(), SYMBOL_EDITOR_CONTROL::ExportView(), PLUGIN_CONTENT_MANAGER::fetchPackages(), PLUGIN_CONTENT_MANAGER::FetchRepository(), FILE_LINE_READER::FILE_LINE_READER(), PCB_EDIT_FRAME::Files_io_from_id(), PNS::DIFF_PAIR_PLACER::FindDpPrimitivePair(), FP_LIB_TABLE::FindRow(), EXCELLON_IMAGE::FinishRouteCommand(), PNS::SHOVE::fixupViaCollisions(), HPGL_PLOTTER::FlashPadCircle(), LIB_SYMBOL::Flatten(), FOOTPRINT::Flip(), KIFONT::OUTLINE_FONT::FontLibraryVersion(), GPCB_PLUGIN::FootprintDelete(), PCB_PLUGIN::FootprintDelete(), ALTIUM_DESIGNER_PLUGIN::FootprintEnumerate(), GPCB_PLUGIN::FootprintEnumerate(), PCB_PLUGIN::FootprintLibCreate(), GPCB_PLUGIN::FootprintLibDelete(), PCB_PLUGIN::FootprintLibDelete(), LEGACY_PLUGIN::FootprintLibDelete(), PCB_PLUGIN::FootprintSave(), FootprintWriteShape(), LIBEVAL::UOP::Format(), PCB_PLUGIN::format(), PANEL_PREVIEW_3D_MODEL::formatBoardThicknessValue(), formatCoord(), formatCount(), DIALOG_NET_INSPECTOR::formatCount(), DIALOG_NET_INSPECTOR::formatNetCode(), PANEL_PREVIEW_3D_MODEL::formatOffsetValue(), HIERARCHY_NAVIG_PANEL::formatPageString(), PANEL_PREVIEW_3D_MODEL::formatRotationValue(), PANEL_PREVIEW_3D_MODEL::formatScaleValue(), CVPCB_MAINFRAME::formatSymbolDesc(), formatWildcardExt(), KIFONT::OUTLINE_FONT::FreeTypeVersion(), DSN::SPECCTRA_DB::FromBOARD(), DSN::SPECCTRA_DB::FromSESSION(), GbrMakeProjectGUIDfromString(), WX_HTML_REPORT_BOX::generateHtml(), PLACE_FILE_EXPORTER::GenPositionData(), CURSOR_STORE::Get(), SYMBOL_LIBRARY_MANAGER::GetBufferedSymbol(), GetBuildDate(), GetBuildVersion(), SCH_FIELD::GetCanonicalName(), BACK_ANNOTATE::getChangeList(), FABMASTER::getColFromName(), SCH_SHEET::GetDefaultFieldName(), TEMPLATE_FIELDNAME::GetDefaultFieldName(), TOOL_ACTION::GetDescription(), getFieldFunc(), EDA_BASE_FRAME::GetFileFromHistory(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), FOOTPRINT_LIST::GetFootprintInfo(), GetGerberProtelExtension(), BOARD_INSPECTION_TOOL::getItemDescription(), GetKeyName(), PCAD2KICAD::PCB::GetKiCadLayer(), GetKicadLockFilePath(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadNet(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad(), PCAD2KICAD::PCB::GetLayerNetNameRef(), PCAD2KICAD::PCB::GetLayerType(), SYMBOL_LIBRARY_MANAGER::getLibraryBuffer(), FOOTPRINT::GetLocalClearance(), CADSTAR_SCH_ARCHIVE_LOADER::getLocationOfNetElement(), GetMajorMinorVersion(), DIALOG_SIM_MODEL< T >::getModelPinString(), SCH_SYMBOL::GetMsgPanelInfo(), PCB_GROUP::GetMsgPanelInfo(), BOARD::GetMsgPanelInfo(), FOOTPRINT::GetMsgPanelInfo(), FP_TEXTBOX::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), PAD::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_DIM_LEADER::GetMsgPanelInfo(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), PCB_TEXT::GetMsgPanelInfo(), PCB_TEXTBOX::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), PCB_VIA::GetMsgPanelInfo(), ZONE::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), DRC_CONSTRAINT::GetName(), ALTIUM_PCB::GetNetCode(), CADSTAR_SCH_ARCHIVE_LOADER::getNetName(), FOOTPRINT::GetNextPadNumber(), CADSTAR_PCB_ARCHIVE_LOADER::getPadReference(), PNS::MOUSE_TRAIL_TRACER::GetPosture(), ZONE_SEARCH_HANDLER::GetResultCell(), KIGFX::ACCELERATING_ZOOM_CONTROLLER::GetScaleForRotation(), KIGFX::CONSTANT_ZOOM_CONTROLLER::GetScaleForRotation(), DIALOG_PRINT_GENERIC::getScaleValue(), LIB_FIELD::GetSelectMenuText(), LIB_PIN::GetSelectMenuText(), LIB_SHAPE::GetSelectMenuText(), LIB_TEXT::GetSelectMenuText(), LIB_TEXTBOX::GetSelectMenuText(), SCH_FIELD::GetSelectMenuText(), SCH_LABEL::GetSelectMenuText(), SCH_DIRECTIVE_LABEL::GetSelectMenuText(), SCH_GLOBALLABEL::GetSelectMenuText(), SCH_HIERLABEL::GetSelectMenuText(), SCH_LINE::GetSelectMenuText(), SCH_PIN::GetSelectMenuText(), SCH_SHAPE::GetSelectMenuText(), SCH_SHEET::GetSelectMenuText(), SCH_SHEET_PIN::GetSelectMenuText(), SCH_SYMBOL::GetSelectMenuText(), SCH_TEXT::GetSelectMenuText(), SCH_TEXTBOX::GetSelectMenuText(), GERBER_DRAW_ITEM::GetSelectMenuText(), DS_DRAW_ITEM_LINE::GetSelectMenuText(), DS_DRAW_ITEM_RECT::GetSelectMenuText(), DS_DRAW_ITEM_TEXT::GetSelectMenuText(), PCB_GROUP::GetSelectMenuText(), BOARD::GetSelectMenuText(), FOOTPRINT::GetSelectMenuText(), FP_SHAPE::GetSelectMenuText(), FP_TEXT::GetSelectMenuText(), FP_TEXTBOX::GetSelectMenuText(), PAD::GetSelectMenuText(), PCB_DIMENSION_BASE::GetSelectMenuText(), PCB_MARKER::GetSelectMenuText(), PCB_SHAPE::GetSelectMenuText(), PCB_TEXT::GetSelectMenuText(), PCB_TEXTBOX::GetSelectMenuText(), PCB_TRACK::GetSelectMenuText(), PCB_VIA::GetSelectMenuText(), ZONE::GetSelectMenuText(), GetSemanticVersion(), NGSPICE::GetSettingCommands(), NGSPICE_CIRCUIT_MODEL::GetSheetSimCommand(), DIALOG_SIM_MODEL< T >::getSymbolPinString(), SYMBOL_LIBRARY_MANAGER::GetUniqueLibraryName(), SCH_SYMBOL::GetUnitDisplayName(), LIB_SYMBOL::GetUnitDisplayName(), AM_PARAM::GetValue(), FIELDS_EDITOR_GRID_DATA_MODEL::GetValue(), FIELDS_GRID_TABLE< T >::GetValueAsBool(), FP_TEXT_GRID_TABLE::GetValueAsBool(), FP_TEXT_GRID_TABLE::GetValueAsLong(), PCB_DIMENSION_BASE::GetValueText(), DRC_ITEM::GetViolatingRuleDesc(), GERBVIEW_FRAME::GetVisibleElementColor(), EDA_DRAW_FRAME::GetZoomLevelIndicator(), SYMBOL_EDITOR_EDIT_TOOL::handlePinDuplication(), ALTIUM_PCB::HelperCreateAndAddShape(), ALTIUM_PCB::HelperGetFootprint(), SCH_NAVIGATE_TOOL::HypertextCommand(), IFSTREAM_LINE_READER::IFSTREAM_LINE_READER(), SCH_EDIT_FRAME::importFile(), FOOTPRINT_EDIT_FRAME::ImportFootprint(), SCH_EDITOR_CONTROL::ImportFPAssignments(), FOOTPRINT_FILTER::ITERATOR::increment(), FOOTPRINT::IncrementReference(), DIALOG_FIELD_PROPERTIES::init(), LAYERS_MAP_DIALOG::initDialog(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), DRC_ENGINE::InitEngine(), DIALOG_FOOTPRINT_WIZARD_LIST::initLists(), DIALOG_ANNOTATE::InitValues(), CADSTAR_ARCHIVE_PARSER::InsertAttributeAtEnd(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), BOARD_INSPECTION_TOOL::InspectDRCError(), PCM_TASK_MANAGER::installDownloadedPackage(), PCM_TASK_MANAGER::InstallFromFile(), TEST_EE_ITEM_FIXTURE::Instantiate(), TEST_BOARD_ITEM_FIXTURE::Instantiate(), io_benchmark_func(), GERBVIEW_FRAME::IsElementVisible(), PNS::ROUTER::isStartingPointRoutable(), DIALOG_SIM_MODEL< T >::MODEL_NAME_VALIDATOR::IsValid(), IterateOverPositionsAndReferences(), kiCadComponentRotation(), KIWAY::KiFACE(), DRC_TEST_PROVIDER_CONNECTION_WIDTH::layerDesc(), DRC_TEST_PROVIDER_SLIVER_CHECKER::layerDesc(), LayerName(), LIBEVAL::COMPILER::lexDefault(), GPCB_FPL_CACHE::Load(), FP_CACHE::Load(), SCH_SEXPR_PLUGIN_CACHE::Load(), SCH_LEGACY_PLUGIN_CACHE::Load(), CADSTAR_PCB_ARCHIVE_LOADER::Load(), EAGLE_PLUGIN::Load(), FABMASTER_PLUGIN::Load(), PCB_PLUGIN::Load(), LEGACY_PLUGIN::Load(), SCH_EAGLE_PLUGIN::Load(), IO_MGR::Load(), CADSTAR_SCH_ARCHIVE_LOADER::Load(), RENDER_3D_OPENGL::load3dModels(), SYMBOL_LIBS::LoadAllLibraries(), CADSTAR_ARCHIVE_PARSER::LoadArchiveFile(), CADSTAR_PCB_ARCHIVE_LOADER::loadAreas(), CADSTAR_PCB_ARCHIVE_LOADER::loadBoards(), CADSTAR_PCB_ARCHIVE_LOADER::loadBoardStackup(), CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(), CADSTAR_PCB_ARCHIVE_LOADER::loadComponents(), CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions(), SCH_LEGACY_PLUGIN_CACHE::loadDocs(), CADSTAR_SCH_ARCHIVE_LOADER::loadDocumentationSymbols(), CADSTAR_PCB_ARCHIVE_LOADER::loadDocumentationSymbols(), PANEL_EESCHEMA_ANNOTATION_OPTIONS::loadEEschemaSettings(), EAGLE_PLUGIN::loadElements(), CADSTAR_PCB_ARCHIVE_LOADER::loadFigures(), SCH_LEGACY_PLUGIN::loadFile(), SCH_SEXPR_PLUGIN::loadFile(), LEGACY_PLUGIN::loadFOOTPRINT(), FABMASTER::loadFootprints(), FP_LIB_TABLE::LoadGlobalTable(), SYMBOL_LIB_TABLE::LoadGlobalTable(), CADSTAR_PCB_ARCHIVE_LOADER::loadGroups(), SCH_SEXPR_PLUGIN::loadHierarchy(), DRC_ENGINE::loadImplicitRules(), SCH_EAGLE_PLUGIN::loadInstance(), DIALOG_SIM_MODEL< T >::loadLibrary(), EAGLE_PLUGIN::loadLibrary(), CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryAreas(), CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers(), CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryFigures(), GERBVIEW_FRAME::LoadListOfGerberAndDrillFiles(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), CADSTAR_PCB_ARCHIVE_LOADER::loadNets(), CADSTAR_SCH_ARCHIVE_LOADER::loadPartsLibrary(), SCH_EAGLE_PLUGIN::loadPin(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadPolygon(), SCH_EAGLE_PLUGIN::loadSchematic(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), PANEL_TRACK_WIDTH::LoadSettings(), SCH_EAGLE_PLUGIN::loadSheet(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(), SCH_EDIT_FRAME::LoadSheetFromFile(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheets(), SYMBOL_EDIT_FRAME::LoadSymbol(), SCH_EAGLE_PLUGIN::loadSymbol(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), CADSTAR_PCB_ARCHIVE_LOADER::loadTemplates(), CADSTAR_PCB_ARCHIVE_LOADER::logBoardStackupMessage(), CADSTAR_PCB_ARCHIVE_LOADER::logBoardStackupWarning(), DIALOG_BOARD_REANNOTATE::LogChangePlan(), DIALOG_BOARD_REANNOTATE::LogFootprints(), DIALOG_BOARD_REANNOTATE::MakeSampleText(), DSN::SPECCTRA_DB::makeTRACK(), DSN::SPECCTRA_DB::makeVIA(), PCAD2KICAD::PCB::MapLayer(), SIM_PLOT_FRAME::menuSaveCsv(), HTML_MESSAGE_BOX::MessageSet(), EDA_UNIT_UTILS::UI::MessageTextFromValue(), PROJECT_FILE::MigrateFromLegacy(), SCH_SHEET_LIST::MigrateSimModelNameFields(), DSNLEXER::NeedNUMBER(), DIALOG_SIM_MODEL< T >::newParamProperty(), SIM_PLOT_FRAME::NewPlotPanel(), NormalizePath(), not_implemented(), PANEL_FP_PROPERTIES_3D_MODEL::OnAdd3DModel(), PANEL_SETUP_BOARD_STACKUP::onAddDielectricLayer(), DIALOG_SYMBOL_FIELDS_TABLE::OnAddField(), DIALOG_BOM::OnAddGenerator(), DIALOG_NET_INSPECTOR::onAddNet(), PANEL_SETUP_BOARD_STACKUP::onAdjustDielectricThickness(), PANEL_SETUP_BUSES::OnAliasesGridCellChanging(), DIALOG_SCHEMATIC_SETUP::onAuxiliaryAction(), DIALOG_BOARD_SETUP::onAuxiliaryAction(), DIALOG_EDIT_SYMBOLS_LIBID::onClickOrphansButton(), PNS::SHOVE::onCollidingVia(), PANEL_SETUP_RULES::OnCompile(), DIALOG_LIB_SYMBOL_PROPERTIES::OnDeleteField(), DIALOG_SHEET_PROPERTIES::OnDeleteField(), DIALOG_SYMBOL_PROPERTIES::OnDeleteField(), DIALOG_NET_INSPECTOR::onDeleteNet(), PCM_FP_LIB_TRAVERSER::OnDir(), PANEL_PACKAGES_VIEW::OnDownloadVersionClicked(), DIALOG_DRC::OnDRCItemRClick(), DIALOG_ERC::OnERCItemRClick(), DIALOG_SYMBOL_FIELDS_TABLE::OnExport(), DIALOG_EXPORT_STEP::onExportButton(), PCB_EDIT_FRAME::OnExportIDF3(), PCB_EDIT_FRAME::OnExportVRML(), PCM_SYM_LIB_TRAVERSER::OnFile(), DIALOG_LIB_SYMBOL_PROPERTIES::OnGridCellChanging(), DIALOG_SYMBOL_PROPERTIES::OnGridCellChanging(), DIALOG_CONFIGURE_PATHS::OnGridCellChanging(), KICAD_MANAGER_FRAME::OnIdle(), FOOTPRINT_VIEWER_FRAME::OnIterateFootprintList(), KIGFX::WX_VIEW_CONTROLS::onMotion(), EDA_3D_CANVAS::OnMouseMove(), APPEARANCE_CONTROLS::OnNetGridRightClick(), NUMBER_BADGE::onPaint(), PANEL_SETUP_BOARD_STACKUP::onRemoveDielectricLayer(), DIALOG_SYMBOL_FIELDS_TABLE::OnRemoveField(), PCB_EDIT_FRAME::OnRemoveTeardropTool(), PROJECT_TREE_PANE::onRenameFile(), DIALOG_NET_INSPECTOR::onRenameNet(), DIALOG_ERC::OnRunERCClick(), PCB_EDIT_FRAME::OnRunTeardropTool(), DIALOG_ERC::OnSaveReport(), DIALOG_DRC::OnSaveReport(), DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged(), PANEL_TRACK_WIDTH::OnTWResetButtonClick(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), PANEL_SETUP_NETCLASSES::OnUpdateUI(), PANEL_VIA_SIZE::OnViaResetButtonClick(), BM2CMP_FRAME::OpenProjectFiles(), PL_EDITOR_FRAME::OpenProjectFiles(), EDA_ITEM::operator<(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageText(), EAGLE_PLUGIN::packageWire(), KICAD_NETLIST_PARSER::Parse(), ALTIUM_PCB::Parse(), SYMBOL_LIB_TABLE::Parse(), FP_LIB_TABLE::Parse(), PCAD2KICAD::PCB_PAD::Parse(), PCAD2KICAD::PCB_VIA::Parse(), CADSTAR_ARCHIVE_PARSER::TIMESTAMP::Parse(), CADSTAR_ARCHIVE_PARSER::HEADER::Parse(), CADSTAR_ARCHIVE_PARSER::LINECODE::Parse(), CADSTAR_ARCHIVE_PARSER::HATCHCODE::Parse(), CADSTAR_ARCHIVE_PARSER::EVALUE::Parse(), CADSTAR_ARCHIVE_PARSER::ATTRNAME::Parse(), CADSTAR_ARCHIVE_PARSER::CADSTAR_NETCLASS::Parse(), CADSTAR_ARCHIVE_PARSER::FIGURE::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::TERMINALCODE::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::TERMINAL::Parse(), CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::MATERIAL::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::LAYER::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::PADCODE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::VIACODE::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::LAYERPAIR::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_AREA::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_PAD::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::CADSTAR_BOARD::Parse(), CADSTAR_PCB_ARCHIVE_PARSER::AREA::Parse(), SCH_ALTIUM_PLUGIN::ParseAdditional(), CADSTAR_ARCHIVE_PARSER::ParseAllChildPoints(), SCH_ALTIUM_PLUGIN::ParseArc(), SCH_ALTIUM_PLUGIN::ParseBezier(), PCB_PARSER::parseBOARD_unchecked(), ALTIUM_PCB::ParseClasses6Data(), SCH_ALTIUM_PLUGIN::ParseComponent(), ALTIUM_PCB::ParseComponentsBodies6Data(), DRC_RULES_PARSER::parseConstraint(), SCH_ALTIUM_PLUGIN::ParseDesignator(), DRC_RULES_PARSER::parseDRC_RULE(), SCH_SEXPR_PARSER::parseEDA_TEXT(), SCH_ALTIUM_PLUGIN::ParseEllipse(), SIM_MODEL::parseFieldFloatValue(), SCH_ALTIUM_PLUGIN::ParseFileHeader(), SCH_ALTIUM_PLUGIN::ParseFileName(), ALTIUM_PCB::ParseFootprint(), PCB_PARSER::parseFOOTPRINT_unchecked(), PCB_PARSER::parseFP_TEXT(), PCB_PARSER::parseFP_TEXTBOX(), SCH_ALTIUM_PLUGIN::ParseHarnessEntry(), SCH_ALTIUM_PLUGIN::ParseHarnessPort(), SCH_ALTIUM_PLUGIN::ParseHarnessType(), SCH_ALTIUM_PLUGIN::ParseImage(), SCH_ALTIUM_PLUGIN::ParseImplementation(), parseInt(), SCH_ALTIUM_PLUGIN::ParseLabel(), DRC_RULES_PARSER::parseLayer(), PCB_PARSER::parseLayers(), SIM_MODEL_RAW_SPICE::parseLegacyPinsField(), SCH_ALTIUM_PLUGIN::ParseLine(), ALTIUM_PCB::ParseModelsData(), SCH_ALTIUM_PLUGIN::ParseParameter(), SCH_ALTIUM_PLUGIN::ParsePin(), SIM_MODEL::ParsePinsField(), SCH_ALTIUM_PLUGIN::ParsePolygon(), SCH_ALTIUM_PLUGIN::ParsePolyline(), SCH_ALTIUM_PLUGIN::ParsePort(), SCH_ALTIUM_PLUGIN::ParsePowerPort(), SCH_ALTIUM_PLUGIN::ParseRectangle(), ALTIUM_PCB::ParseRegions6Data(), SCH_ALTIUM_PLUGIN::ParseRoundRectangle(), SCH_SEXPR_PARSER::parseSchematicSymbol(), SCH_ALTIUM_PLUGIN::ParseSheetEntry(), SCH_ALTIUM_PLUGIN::ParseSheetName(), SCH_ALTIUM_PLUGIN::ParseStorage(), SCH_SEXPR_PARSER::ParseSymbol(), CADSTAR_ARCHIVE_PARSER::ParseTextFields(), DRC_RULES_PARSER::parseValueWithUnits(), SCH_EDITOR_CONTROL::Paste(), HPGL_PLOTTER::PenTo(), PGPropertyFactory(), playground_main_func(), SCH_LABEL_BASE::Plot(), SCH_LINE::Plot(), SCH_SHEET::Plot(), SCH_SYMBOL::Plot(), PlotInteractiveLayer(), PLUGIN_CONTENT_MANAGER::PLUGIN_CONTENT_MANAGER(), DIALOG_BOM::pluginInit(), DIALOG_RESCUE_EACH::PopulateInstanceList(), KICAD_MANAGER_FRAME::PrintPrjInfo(), FOOTPRINT_WIZARD_FRAME::Process_Special_Functions(), DRC_ENGINE::ProcessAssertions(), PNS::SHOVE::pushOrShoveVia(), SCH_EDIT_FRAME::PutDataInPreviousState(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), LP_CACHE::ReadAndVerifyHeader(), NETLIST_EXPORTER_SPICE::ReadDirectives(), SIM_LIBRARY_KIBIS::ReadFile(), SPICE_LIBRARY_PARSER::ReadFile(), NETLIST_EXPORTER_SPICE::readLibraryField(), SPICE_MODEL_PARSER::ReadModel(), NETLIST_EXPORTER_SPICE::readModel(), NETLIST_EXPORTER_SPICE::readNameField(), CVPCB_MAINFRAME::readNetListAndFpFiles(), CVPCB_MAINFRAME::readSchematicNetlist(), EXCELLON_IMAGE::readToolInformation(), DIALOG_BOARD_REANNOTATE::ReannotateBoard(), APPEARANCE_CONTROLS::rebuildLayers(), NET_SELECTOR_COMBOPOPUP::rebuildList(), APPEARANCE_CONTROLS::rebuildNets(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), DIALOG_INSPECTOR::ReCreateDesignList(), HPGL_PLOTTER::Rect(), DIALOG_PLOT::reInitDialog(), RENDER_3D_OPENGL::reload(), RENDER_3D_RAYTRACE::Reload(), GPCB_FPL_CACHE::Remove(), FP_CACHE::Remove(), FOOTPRINT_EDITOR_CONTROL::RenameFootprint(), SYMBOL_EDITOR_CONTROL::RenameSymbol(), RENDER_3D_RAYTRACE::render(), BOARD_EDITOR_CONTROL::RepairBoard(), FOOTPRINT_EDITOR_CONTROL::RepairFootprint(), SCH_EDITOR_CONTROL::RepairSchematic(), ReplaceIllegalFileNameChars(), PNS_LOG_PLAYER::ReplayLog(), STATUS_TEXT_REPORTER::Report(), DRC_RULES_PARSER::reportDeprecation(), DRC_RULES_PARSER::reportError(), DRC_TEST_PROVIDER::reportRuleStatistics(), DRC_ENGINE::ReportViolation(), WIDGET_HOTKEY_LIST::resolveKeyConflicts(), SCHEMATIC::ResolveTextVar(), SCH_GLOBALLABEL::ResolveTextVar(), SCH_SHEET::ResolveTextVar(), WIDGET_SAVE_RESTORE::RestoreConfigToControls(), SYMBOL_EDIT_FRAME::Revert(), FOOTPRINT_EDIT_FRAME::RevertFootprint(), PNS::LINE_PLACER::routeStep(), test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run(), TOOL_MANAGER::RunAction(), runDRCProto(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), DRC_ENGINE::RunTests(), SYMBOL_EDIT_FRAME::Save(), SYMBOL_LIB::Save(), PCB_PLUGIN::Save(), FP_CACHE::Save(), IO_MGR::Save(), PCB_BASE_EDIT_FRAME::saveCopyInUndoList(), SCH_EDIT_FRAME::SaveCopyInUndoList(), BITMAP_BASE::SaveData(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), SYMBOL_EDIT_FRAME::saveLibrary(), SYMBOL_LIBRARY_MANAGER::SaveLibrary(), FOOTPRINT_EDIT_FRAME::SaveLibraryAs(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), ROUTER_TOOL::saveRouterDebugLog(), SYMBOL_EDIT_FRAME::saveSymbolAs(), SIM_PLOT_FRAME::saveWorkbook(), SchGetLibSymbol(), SCH_MARKER::Serialize(), PCB_MARKER::Serialize(), GERBVIEW_FRAME::SetElementVisibility(), FOOTPRINT_INFO_GENERATOR::SetHtmlAliasOf(), FOOTPRINT_INFO_GENERATOR::SetHtmlDesc(), FOOTPRINT_INFO_GENERATOR::SetHtmlKeywords(), DIALOG_PCM::setInstalledPackages(), KIWAY::SetLanguage(), PANEL_PACKAGES_VIEW::setPackageDetails(), HTML_WINDOW::SetPage(), DIALOG_PCM::setRepositoryData(), DIALOG_PRINT_GENERIC::setScaleValue(), SYMBOL_EDITOR_EDIT_TOOL::SetUnitDisplayName(), ZONE_SETTINGS::SetupLayersList(), FIELDS_GRID_TABLE< T >::SetValue(), PRIVATE_LAYERS_GRID_TABLE::SetValue(), FP_TEXT_GRID_TABLE::SetValue(), FIELDS_GRID_TABLE< T >::SetValueAsBool(), FP_TEXT_GRID_TABLE::SetValueAsBool(), FP_TEXT_GRID_TABLE::SetValueAsLong(), PNS::SHOVE::shoveIteration(), PNS::SHOVE::ShoveLines(), PNS::SHOVE::shoveLineToHullSet(), PNS::SHOVE::shoveMainLoop(), PNS::SHOVE::ShoveMultiLines(), PNS::SHOVE::ShoveObstacleLine(), showCoord(), COMMON_CONTROL::ShowHelp(), RC_ITEM::ShowReport(), IO_MGR::ShowType(), SCH_IO_MGR::ShowType(), PNS::WALKAROUND::singleStep(), PNS::DRAGGER::Start(), StartPlotBoard(), PCB_BITMAP::SwapData(), SCH_BITMAP::SwapData(), SCH_SHEET::SwapData(), SCH_SHEET_PIN::SwapData(), SYMBOL_EDIT_FRAME::SyncLibraries(), PNS_KICAD_IFACE_BASE::syncZone(), PANEL_SETUP_LAYERS::testLayerNames(), ERC_TESTER::TestMultUnitPinConflicts(), ERC_TESTER::TestPinToPin(), PANEL_PACKAGES_VIEW::toHumanReadableSize(), SPICE_VALUE::ToString(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::TransferDataFromWindow(), DIALOG_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_SCH_IMPORT_SETTINGS::TransferDataFromWindow(), DIALOG_SHEET_PROPERTIES::TransferDataFromWindow(), DIALOG_EXPORT_IDF3::TransferDataFromWindow(), DIALOG_GENCAD_EXPORT_OPTIONS::TransferDataFromWindow(), DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG::TransferDataFromWindow(), DIALOG_IMPORT_SETTINGS::TransferDataFromWindow(), PANEL_SETUP_LAYERS::TransferDataFromWindow(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_SIM_SETTINGS::TransferDataToWindow(), DIALOG_PNS_LENGTH_TUNING_SETTINGS::TransferDataToWindow(), WRL2APPEARANCE::TranslateToSG(), WRL2BOX::TranslateToSG(), WRL2FACESET::TranslateToSG(), WRL2INLINE::TranslateToSG(), WRL2MATERIAL::TranslateToSG(), WRL2SHAPE::TranslateToSG(), WRL2SWITCH::TranslateToSG(), WRL2TRANSFORM::TranslateToSG(), WRL1GROUP::TranslateToSG(), WRL1SEPARATOR::TranslateToSG(), TRANSLINE_IDENT::TRANSLINE_IDENT(), PANEL_TRANSLINE::TranslineTypeSelection(), DSNLEXER::Unexpected(), PCM_TASK_MANAGER::Uninstall(), GL_CONTEXT_MANAGER::UnlockCtx(), PNS::SHOVE::unwindLineStack(), HIGHLIGHT_MENU::update(), ZOOM_MENU::update(), SYMBOL_EDIT_FRAME::UpdateAfterSymbolProperties(), DIALOG_POSITION_RELATIVE::UpdateAnchor(), ACTION_TOOLBAR::UpdateControlWidth(), BM2CMP_FRAME::updateImageInfo(), DIALOG_PAD_PROPERTIES::UpdateLayersDropdown(), ROUTER_TOOL::UpdateMessagePanel(), PCB_CONTROL::UpdateMessagePanel(), SCH_EDIT_FRAME::UpdateNetHighlightStatus(), SCH_EDITOR_CONTROL::updatePastedSheet(), KICAD_MANAGER_FRAME::updatePcmButtonBadge(), DIALOG_PCM::updatePendingActionsTab(), SIM_PLOT_FRAME::updatePlot(), PAGED_DIALOG::UpdateResetButton(), DIALOG_LIB_EDIT_PIN_TABLE::updateSummary(), SCH_EDIT_FRAME::UpdateTitle(), SYMBOL_EDIT_FRAME::updateTitle(), FOOTPRINT_EDIT_FRAME::UpdateTitle(), DIALOG_PCM_PROGRESS::updateUI(), STATUS_TEXT_REPORTER::updateUI(), CONSOLE_PROGRESS_REPORTER::updateUI(), EDA_DRAW_FRAME::UpdateZoomSelectBox(), DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate(), UNIT_BINDER::Validate(), SCH_FIELD_VALIDATOR::Validate(), SPICE_VALIDATOR::Validate(), REGEX_VALIDATOR::Validate(), validateAxisOptions(), PGPROPERTY_ANGLE::ValueToString(), PANEL_SYM_LIB_TABLE::verifyTables(), PANEL_FP_LIB_TABLE::verifyTables(), fontconfig::FONTCONFIG::Version(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), wordbreakMarkup(), SYMBOL_ASYNC_LOADER::worker(), FOOTPRINT_LIST_IMPL::WriteCacheToFile(), NETLIST_EXPORTER_SPICE::writeInclude(), DIALOG_ERC::writeReport(), and ZONE_FILLER_TOOL::ZoneFillDirty().

◆ formatList()

static void formatList ( OUTPUTFORMATTER out,
int  aNestLevel,
int  aCtl,
const CPTREE aTree 
)
static

Definition at line 137 of file ptree.cpp.

138{
139 for( CITER it = aTree.begin(); it != aTree.end(); ++it )
140 {
141 // Processing a tree which was read in with xml_parser?
142 if( it->first == "<xmlattr>" )
143 {
144 formatList( out, aNestLevel, aCtl | CTL_IN_ATTRS, it->second );
145 continue;
146 }
147
148 int ctl = 0;
149
150 if( isLast( aTree, it ) ) // is "it" the last one?
151 {
152 //if( !( aCtl & CTL_IN_ATTRS ) )
153 ctl = CTL_OMIT_NL;
154 }
155 else if( isAtom( next( it )->second ) )
156 {
157 /* if( !( aCtl & CTL_IN_ATTRS ) ) */
158 ctl = CTL_OMIT_NL;
159 }
160
161 formatNode( out, aNestLevel+1, ctl, it->first, it->second );
162 }
163}
bool isLast(const CPTREE &aTree, CITER it)
Definition: ptree.cpp:118
#define CTL_IN_ATTRS
Definition: ptree.cpp:45
static void formatList(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Definition: ptree.cpp:137
bool isAtom(const CPTREE &aTree)
Definition: ptree.cpp:112
CITER next(CITER it)
Definition: ptree.cpp:126
#define CTL_OMIT_NL
Definition: ptree.cpp:44

References CTL_IN_ATTRS, CTL_OMIT_NL, formatList(), formatNode(), isAtom(), isLast(), and next().

Referenced by formatList(), and formatNode().

◆ formatNode()

static void formatNode ( OUTPUTFORMATTER out,
int  aNestLevel,
int  aCtl,
const std::string &  aKey,
const CPTREE aTree 
)
static

Definition at line 166 of file ptree.cpp.

169{
170 if( !isAtom( aTree ) ) // is a list, not an atom
171 {
172 int ctl = CTL_OMIT_NL;
173
174 // aTree is list and its first child is a list
175 if( aTree.size() && !isAtom( aTree.begin()->second ) && !aTree.data().size() )
176 ctl = 0;
177
178 out->Print( aNestLevel, "(%s%s", out->Quotes( aKey ).c_str(), ctl & CTL_OMIT_NL ? "" : "\n" );
179
180 if( aTree.data().size() ) // sexpr format does not use data()
181 {
182 out->Print( 0, " %s%s",
183 out->Quotes( aTree.data() ).c_str(),
184 aTree.size() ? "\n" : ""
185 );
186 }
187
188 formatList( out, aNestLevel, aCtl, aTree );
189
190 out->Print( 0, ")%s", aCtl & CTL_OMIT_NL ? "" : "\n" );
191 }
192
193 else // is an atom, not a list
194 {
195 out->Print( 0, " %s", out->Quotes( aKey ).c_str() );
196 }
197}
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:431
virtual std::string Quotes(const std::string &aWrapee) const
Check aWrapee input string for a need to be quoted (e.g.
Definition: richio.cpp:460

References CTL_OMIT_NL, formatList(), isAtom(), OUTPUTFORMATTER::Print(), and OUTPUTFORMATTER::Quotes().

Referenced by Format(), and formatList().

◆ isAtom()

bool isAtom ( const CPTREE aTree)
inline

Definition at line 112 of file ptree.cpp.

113{
114 return aTree.size() == 0 && aTree.data().size() == 0;
115}

Referenced by formatList(), and formatNode().

◆ isLast()

bool isLast ( const CPTREE aTree,
CITER  it 
)
inline

Definition at line 118 of file ptree.cpp.

119{
120 CITER next = it;
121 ++next;
122 return next == aTree.end();
123}

References next().

Referenced by formatList(), and SIM_VALIDATOR::onKeyDown().

◆ next()

◆ Scan()

void Scan ( PTREE aTree,
DSNLEXER aLexer 
)

Fill an empty PTREE with information from a KiCad s-expression stream.

Use a DSNLEXER with an empty keyword table as aLexer. Useful for parsing s-expression files or strings of arbitrary grammars, say from a file or clipboard. The s-expression must be "KiCad compatible". See Documentation/s-expressions.txt for this KiCad compatible definition (it is the non-specctra mode). And also see in tools/property_tree.cpp for example usage.

FILE* fp = fopen( argv[1], "r" );

static const KEYWORD empty_keywords[1] = {};

DSNLEXER lexer( empty_keywords, 0, fp, wxString( FROM_UTF8( argv[1] ) ) );

try { PTREE doc; Scan( &doc, &lexer ); } catch( const IO_ERROR& ioe ) { fprintf( stderr, "%s\n", TO_UTF8( ioe.errorText ) ); }

Definition at line 86 of file ptree.cpp.

87{
88 int tok = aLexer->CurTok();
89
90 // conditionally read first token.
91 if( tok == DSN_NONE )
92 tok = aLexer->NextTok();
93
94 if( tok == DSN_EOF )
95 {
96 aLexer->Unexpected( DSN_EOF );
97 }
98
99 if( tok == DSN_LEFT )
100 {
101 scanList( aTree, aLexer );
102 }
103 else
104 {
105 scanAtom( aTree, aLexer );
106 }
107}
int NextTok()
Return the next token found in the input file or DSN_EOF when reaching the end of file.
Definition: dsnlexer.cpp:519
int CurTok() const
Return whatever NextTok() returned the last time it was called.
Definition: dsnlexer.h:237
void Unexpected(int aTok) const
Throw an IO_ERROR exception with an input file specific error message.
Definition: dsnlexer.cpp:342
@ DSN_LEFT
Definition: dsnlexer.h:67
@ DSN_NONE
Definition: dsnlexer.h:59
@ DSN_EOF
Definition: dsnlexer.h:69
void scanList(PTREE *aTree, DSNLEXER *aLexer)
Function scanList reads a sexpr list from the input stream into a new node with key aLexer->CurText()...
Definition: ptree.cpp:55
void scanAtom(PTREE *aTree, const DSNLEXER *aLexer)
Definition: ptree.cpp:78

References DSNLEXER::CurTok(), DSN_EOF, DSN_LEFT, DSN_NONE, DSNLEXER::NextTok(), scanAtom(), scanList(), and DSNLEXER::Unexpected().

Referenced by SCH_EDITOR_CONTROL::AssignFootprints(), BACK_ANNOTATE::getPcbModulesFromString(), and scanList().

◆ scanAtom()

void scanAtom ( PTREE aTree,
const DSNLEXER aLexer 
)
inline

Definition at line 78 of file ptree.cpp.

79{
80 const char* key = aLexer->CurText();
81
82 aTree->push_back( PTREE::value_type( key, PTREE() ) );
83}
const char * CurText() const
Return a pointer to the current token's text.
Definition: dsnlexer.h:398
boost::property_tree::ptree PTREE
Definition: ptree.h:52

References DSNLEXER::CurText().

Referenced by Scan().

◆ scanList()

void scanList ( PTREE aTree,
DSNLEXER aLexer 
)
inline

Function scanList reads a sexpr list from the input stream into a new node with key aLexer->CurText().

Definition at line 55 of file ptree.cpp.

56{
57 assert( aLexer->CurTok() == DSN_LEFT );
58
59 int tok = aLexer->NextTok();
60
61 const char* key = aLexer->CurText();
62
63 PTREE* list = &aTree->push_back( PTREE::value_type( key, PTREE() ) )->second;
64
65 if( tok != DSN_RIGHT )
66 {
67 while( ( tok = aLexer->NextTok() ) != DSN_RIGHT )
68 {
69 if( tok == DSN_EOF )
70 aLexer->Unexpected( DSN_EOF );
71
72 Scan( list, aLexer );
73 }
74 }
75}
@ DSN_RIGHT
Definition: dsnlexer.h:66
void Scan(PTREE *aTree, DSNLEXER *aLexer)
Fill an empty PTREE with information from a KiCad s-expression stream.
Definition: ptree.cpp:86

References DSNLEXER::CurText(), DSNLEXER::CurTok(), DSN_EOF, DSN_LEFT, DSN_RIGHT, DSNLEXER::NextTok(), Scan(), and DSNLEXER::Unexpected().

Referenced by Scan().