KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_parser_tool.cpp File Reference
#include <qa_utils/utility_registry.h>
#include <cstdio>
#include <string>
#include <common.h>
#include <core/profile.h>
#include <wx/cmdline.h>
#include <wx/msgout.h>
#include <board_item.h>
#include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.h>
#include <richio.h>
#include <qa_utils/stdstream_line_reader.h>

Go to the source code of this file.

Typedefs

using PARSE_DURATION = std::chrono::microseconds
 

Enumerations

enum  PARSER_RET_CODES { PARSE_FAILED = KI_TEST::RET_CODES::TOOL_SPECIFIC , PARSE_FAILED = KI_TEST::RET_CODES::TOOL_SPECIFIC }
 

Functions

bool parse (std::istream &aStream, bool aVerbose)
 Parse a PCB or footprint file from the given input stream. More...
 
int pcb_parser_main_func (int argc, char **argv)
 

Variables

static const wxCmdLineEntryDesc g_cmdLineDesc []
 
static bool registered
 

Typedef Documentation

◆ PARSE_DURATION

using PARSE_DURATION = std::chrono::microseconds

Definition at line 41 of file pcb_parser_tool.cpp.

Enumeration Type Documentation

◆ PARSER_RET_CODES

Enumerator
PARSE_FAILED 
PARSE_FAILED 

Definition at line 91 of file pcb_parser_tool.cpp.

Function Documentation

◆ parse()

bool parse ( std::istream &  aStream,
bool  aVerbose 
)

Parse a PCB or footprint file from the given input stream.

Parameters
aStreamthe input stream to read from
Returns
success, duration (in us)

Definition at line 50 of file pcb_parser_tool.cpp.

References PCB_IO_KICAD_SEXPR_PARSER::Parse(), STDISTREAM_LINE_READER::SetStream(), and PROF_TIMER::SinceStart().

Referenced by pcb_parser_main_func().

◆ pcb_parser_main_func()

int pcb_parser_main_func ( int  argc,
char **  argv 
)

Definition at line 97 of file pcb_parser_tool.cpp.

References _, KI_TEST::BAD_CMDLINE, g_cmdLineDesc, KI_TEST::OK, and parse().

Variable Documentation

◆ g_cmdLineDesc

const wxCmdLineEntryDesc g_cmdLineDesc[]
static
Initial value:
= {
{ wxCMD_LINE_SWITCH, "h", "help", _( "displays help on the command line parameters" ).mb_str(),
wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
{ wxCMD_LINE_SWITCH, "v", "verbose", _( "print parsing information" ).mb_str() },
{ wxCMD_LINE_PARAM, nullptr, nullptr, _( "input file" ).mb_str(), wxCMD_LINE_VAL_STRING,
wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_PARAM_MULTIPLE },
{ wxCMD_LINE_NONE }
}
#define _(s)

Definition at line 81 of file pcb_parser_tool.cpp.

Referenced by pcb_parser_main_func().

◆ registered

bool registered
static
Initial value:
= UTILITY_REGISTRY::Register( { "pcb_parser",
"Parse a KiCad PCB file",
static bool Register(const KI_TEST::UTILITY_PROGRAM &aProgInfo)
Register a utility program factory function against an ID string.
int pcb_parser_main_func(int argc, char **argv)

Definition at line 156 of file pcb_parser_tool.cpp.