KiCad PCB EDA Suite
PARSE_ERROR Struct Reference

Struct PARSE_ERROR contains a filename or source description, a problem input line, a line number, a byte offset, and an error message which contains the the caller's report and his call site information: CPP source file, function, and line number. More...

#include <ki_exception.h>

Inheritance diagram for PARSE_ERROR:
IO_ERROR FUTURE_FORMAT_ERROR

Public Member Functions

 PARSE_ERROR (const wxString &aProblem, const char *aThrowersFile, const char *aThrowersFunction, int aThrowersLineNumber, const wxString &aSource, const char *aInputLine, int aLineNumber, int aByteIndex)
 Constructor which is normally called via the macro THROW_PARSE_ERROR so that FILE and FUNCTION and LINE can be captured from the call site. More...
 
void init (const wxString &aProblem, const char *aThrowersFile, const char *aThrowersFunction, int aThrowersLineNumber, const wxString &aSource, const char *aInputLine, int aLineNumber, int aByteIndex)
 
 ~PARSE_ERROR () throw ()
 
void init (const wxString &aProblem, const char *aThrowersFile, const char *aThrowersFunction, int aThrowersLineNumber)
 
virtual const wxString Problem () const
 what was the problem? More...
 
virtual const wxString Where () const
 where did the Problem() occur? More...
 
virtual const wxString What () const
 A composite of Problem() and Where() More...
 

Public Attributes

int lineNumber
 at which line number, 1 based index. More...
 
int byteIndex
 at which byte offset within the line, 1 based index More...
 
std::string inputLine
 problem line of input [say, from a LINE_READER]. More...
 

Protected Member Functions

 PARSE_ERROR ()
 

Protected Attributes

wxString problem
 
wxString where
 

Detailed Description

Struct PARSE_ERROR contains a filename or source description, a problem input line, a line number, a byte offset, and an error message which contains the the caller's report and his call site information: CPP source file, function, and line number.

Author
Dick Hollenbeck

Definition at line 94 of file ki_exception.h.

Constructor & Destructor Documentation

PARSE_ERROR::PARSE_ERROR ( const wxString &  aProblem,
const char *  aThrowersFile,
const char *  aThrowersFunction,
int  aThrowersLineNumber,
const wxString &  aSource,
const char *  aInputLine,
int  aLineNumber,
int  aByteIndex 
)
inline

Constructor which is normally called via the macro THROW_PARSE_ERROR so that FILE and FUNCTION and LINE can be captured from the call site.

Definition at line 110 of file ki_exception.h.

References init().

114  :
115  IO_ERROR()
116  {
117  init( aProblem, aThrowersFile, aThrowersFunction, aThrowersLineNumber,
118  aSource, aInputLine, aLineNumber, aByteIndex );
119  }
void init(const wxString &aProblem, const char *aThrowersFile, const char *aThrowersFunction, int aThrowersLineNumber, const wxString &aSource, const char *aInputLine, int aLineNumber, int aByteIndex)
Definition: exceptions.cpp:69
PARSE_ERROR::~PARSE_ERROR ( )
throw (
)
inline

Definition at line 126 of file ki_exception.h.

126 {}
PARSE_ERROR::PARSE_ERROR ( )
inlineprotected

Definition at line 129 of file ki_exception.h.

129 : IO_ERROR(), lineNumber( 0 ), byteIndex( 0 ) {}
int lineNumber
at which line number, 1 based index.
Definition: ki_exception.h:96
int byteIndex
at which byte offset within the line, 1 based index
Definition: ki_exception.h:97

Member Function Documentation

void IO_ERROR::init ( const wxString &  aProblem,
const char *  aThrowersFile,
const char *  aThrowersFunction,
int  aThrowersLineNumber 
)
inherited

Definition at line 56 of file exceptions.cpp.

References IO_ERROR::problem, THROWERS_WHERE, and IO_ERROR::where.

Referenced by IO_ERROR::IO_ERROR().

57 {
58  problem = aProblem;
59 
60  // The throwers filename is a full filename, depending on Kicad source location.
61  // a short filename will be printed (it is better for user, the full filename has no meaning).
62  wxString srcname = aThrowersFile;
63 
64  where.Printf( THROWERS_WHERE, srcname.AfterLast( '/' ).GetData(),
65  wxString( aThrowersFunction ).GetData(), aThrowersLineNumber );
66 }
#define THROWERS_WHERE
Definition: exceptions.cpp:29
wxString where
Definition: ki_exception.h:83
wxString problem
Definition: ki_exception.h:82
void PARSE_ERROR::init ( const wxString &  aProblem,
const char *  aThrowersFile,
const char *  aThrowersFunction,
int  aThrowersLineNumber,
const wxString &  aSource,
const char *  aInputLine,
int  aLineNumber,
int  aByteIndex 
)

Definition at line 69 of file exceptions.cpp.

References byteIndex, inputLine, lineNumber, PARSE_PROBLEM, IO_ERROR::problem, THROWERS_WHERE, and IO_ERROR::where.

Referenced by PARSE_ERROR().

74 {
75  problem.Printf( PARSE_PROBLEM, aProblem.GetData(), aSource.GetData(), aLineNumber, aByteIndex );
76 
77  inputLine = aInputLine;
78  lineNumber = aLineNumber;
79  byteIndex = aByteIndex;
80 
81  // The throwers filename is a full filename, depending on Kicad source location.
82  // a short filename will be printed (it is better for user, the full filename has no meaning).
83  wxString srcname = aThrowersFile;
84 
85  where.Printf( THROWERS_WHERE, srcname.AfterLast( '/' ).GetData(),
86  wxString( aThrowersFunction ).GetData(), aThrowersLineNumber );
87 }
int lineNumber
at which line number, 1 based index.
Definition: ki_exception.h:96
#define THROWERS_WHERE
Definition: exceptions.cpp:29
int byteIndex
at which byte offset within the line, 1 based index
Definition: ki_exception.h:97
wxString where
Definition: ki_exception.h:83
std::string inputLine
problem line of input [say, from a LINE_READER].
Definition: ki_exception.h:103
wxString problem
Definition: ki_exception.h:82
#define PARSE_PROBLEM
Definition: exceptions.cpp:30
const wxString IO_ERROR::Problem ( ) const
virtualinherited

what was the problem?

Definition at line 49 of file exceptions.cpp.

References IO_ERROR::problem.

Referenced by FUTURE_FORMAT_ERROR::FUTURE_FORMAT_ERROR(), LIB_EDIT_FRAME::LoadOneSymbol(), BOARD::TracksInNetBetweenPoints(), and IO_ERROR::What().

50 {
51  return problem;
52 }
wxString problem
Definition: ki_exception.h:82
const wxString IO_ERROR::What ( ) const
virtualinherited

A composite of Problem() and Where()

Definition at line 33 of file exceptions.cpp.

References IO_ERROR::Problem(), and IO_ERROR::Where().

Referenced by PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), SCH_EDIT_FRAME::AppendOneEEProject(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), DIALOG_PLOT_SCHEMATIC::CreateDXFFile(), DIALOG_PLOT_SCHEMATIC::createHPGLFile(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DIALOG_PLOT_SCHEMATIC::createPDFFile(), DIALOG_PLOT_SCHEMATIC::createPSFile(), DIALOG_PLOT_SCHEMATIC::createSVGFile(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), PCB_EDIT_FRAME::Export_IDF3(), FOOTPRINT_EDIT_FRAME::Export_Module(), PCB_EDIT_FRAME::ExportSpecctraFile(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_EDIT_FRAME::Import_Module(), PCB_EDIT_FRAME::ImportSpecctraSession(), PART_LIBS::LoadAllLibraries(), PCB_BASE_FRAME::LoadFootprint(), PCB_BASE_FRAME::LoadModuleFromLibrary(), main(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), APP_SINGLE_TOP::OnInit(), CV::IFACE::OnKifaceStart(), SCH::IFACE::OnKifaceStart(), PCB::IFACE::OnKifaceStart(), APP_SINGLE_TOP::OnRun(), APP_KICAD::OnRun(), KICAD_MANAGER_FRAME::OnRunPcbFpEditor(), KICAD_MANAGER_FRAME::OnRunSchLibEditor(), FOOTPRINT_EDIT_FRAME::OnSaveLibraryAs(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), FP_GRID_TRICKS::paste_text(), PROJECT::PcbFootprintLibs(), DIALOG_UPDATE_PCB::PerformUpdate(), PCB_EDIT_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndLinkFiles(), PCB_EDIT_FRAME::ReadPcbNetlist(), CVPCB_MAINFRAME::ReadSchematicNetlist(), GITHUB_GETLIBLIST::remoteGetJSON(), GITHUB_PLUGIN::remoteGetZip(), KICAD_MANAGER_FRAME::RunEeschema(), KICAD_MANAGER_FRAME::RunPcbNew(), FOOTPRINT_EDIT_FRAME::SaveCurrentModule(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), WORKSHEET_LAYOUT::SetDefaultLayout(), WORKSHEET_LAYOUT::SetPageLayout(), DIALOG_NETLIST::verifyFootprints(), WORKSHEET_LAYOUT_FILEIO::WORKSHEET_LAYOUT_FILEIO(), WORKSHEET_LAYOUT_STRINGIO::WORKSHEET_LAYOUT_STRINGIO(), and NETLIST_EXPORTER_KICAD::WriteNetlist().

34 {
35 #ifdef DEBUG
36  return wxString( "IO_ERROR: " ) + Problem() + "\n\n" + Where();
37 #else
38  return Problem();
39 #endif
40 }
virtual const wxString Where() const
where did the Problem() occur?
Definition: exceptions.cpp:43
virtual const wxString Problem() const
what was the problem?
Definition: exceptions.cpp:49
const wxString IO_ERROR::Where ( ) const
virtualinherited

where did the Problem() occur?

Definition at line 43 of file exceptions.cpp.

References IO_ERROR::where.

Referenced by IO_ERROR::What().

44 {
45  return where;
46 }
wxString where
Definition: ki_exception.h:83

Member Data Documentation

int PARSE_ERROR::byteIndex

at which byte offset within the line, 1 based index

Definition at line 97 of file ki_exception.h.

Referenced by FUTURE_FORMAT_ERROR::FUTURE_FORMAT_ERROR(), and init().

std::string PARSE_ERROR::inputLine

problem line of input [say, from a LINE_READER].

this is brought up in original byte format rather than wxString form, incase there was a problem with the encoding, in which case converting to wxString is not reliable in this context.

Definition at line 103 of file ki_exception.h.

Referenced by FUTURE_FORMAT_ERROR::FUTURE_FORMAT_ERROR(), and init().

int PARSE_ERROR::lineNumber

at which line number, 1 based index.

Definition at line 96 of file ki_exception.h.

Referenced by FUTURE_FORMAT_ERROR::FUTURE_FORMAT_ERROR(), and init().

wxString IO_ERROR::problem
protectedinherited
wxString IO_ERROR::where
protectedinherited

Definition at line 83 of file ki_exception.h.

Referenced by IO_ERROR::init(), init(), and IO_ERROR::Where().


The documentation for this struct was generated from the following files: