KiCad PCB EDA Suite
FUTURE_FORMAT_ERROR Struct Reference

Struct FUTURE_FORMAT_ERROR variant of PARSE_ERROR indicating that a syntax or related error was likely caused by a file generated by a newer version of KiCad than this. More...

#include <ki_exception.h>

Inheritance diagram for FUTURE_FORMAT_ERROR:
PARSE_ERROR IO_ERROR

Public Member Functions

 FUTURE_FORMAT_ERROR (const PARSE_ERROR &aParseError, const wxString &aRequiredVersion)
 
 ~FUTURE_FORMAT_ERROR () throw ()
 
void init (const wxString &aProblem, const char *aThrowersFile, const char *aThrowersFunction, int aThrowersLineNumber, const wxString &aSource, const char *aInputLine, int aLineNumber, int aByteIndex)
 
void init (const wxString &aProblem, const char *aThrowersFile, const char *aThrowersFunction, int aThrowersLineNumber)
 
const wxString ParseProblem ()
 
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

wxString requiredVersion
 version or date of KiCad required to open file More...
 
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 Attributes

wxString parseProblem
 
wxString problem
 
wxString where
 

Detailed Description

Struct FUTURE_FORMAT_ERROR variant of PARSE_ERROR indicating that a syntax or related error was likely caused by a file generated by a newer version of KiCad than this.

Can be used to generate more informative error messages.

Definition at line 181 of file ki_exception.h.

Constructor & Destructor Documentation

◆ FUTURE_FORMAT_ERROR()

FUTURE_FORMAT_ERROR::FUTURE_FORMAT_ERROR ( const PARSE_ERROR aParseError,
const wxString &  aRequiredVersion 
)

Definition at line 96 of file exceptions.cpp.

97  :
98  PARSE_ERROR(), requiredVersion( aRequiredVersion )
99 {
100  // Avoid double-printing the error message
101  bool wrapped_same_type = !!( dynamic_cast<const FUTURE_FORMAT_ERROR *>( &aParseError ) );
102 
103  if( wrapped_same_type )
104  {
105  problem = aParseError.Problem();
106  }
107  else
108  {
109  problem.Printf( _( "KiCad was unable to open this file, as it was created with a more\n"
110  "recent version than the one you are running.\n"
111  "To open it you will need to upgrade KiCad to a more recent version.\n\n"
112  "Date of KiCad version required (or newer): %s\n\n"
113  "Full error text:\n%s" ),
114  requiredVersion, aParseError.Problem() );
115  }
116 
117  lineNumber = aParseError.lineNumber;
118  byteIndex = aParseError.byteIndex;
119  inputLine = aParseError.inputLine;
120 }
virtual const wxString Problem() const
what was the problem?
Definition: exceptions.cpp:45
int lineNumber
at which line number, 1 based index.
Definition: ki_exception.h:125
wxString requiredVersion
version or date of KiCad required to open file
Definition: ki_exception.h:183
#define _(s)
Definition: 3d_actions.cpp:33
int byteIndex
at which byte offset within the line, 1 based index
Definition: ki_exception.h:126
std::string inputLine
problem line of input [say, from a LINE_READER].
Definition: ki_exception.h:132
wxString problem
Definition: ki_exception.h:111

References _, PARSE_ERROR::byteIndex, PARSE_ERROR::inputLine, PARSE_ERROR::lineNumber, IO_ERROR::Problem(), IO_ERROR::problem, and requiredVersion.

◆ ~FUTURE_FORMAT_ERROR()

FUTURE_FORMAT_ERROR::~FUTURE_FORMAT_ERROR ( )
throw (
)
inline

Definition at line 186 of file ki_exception.h.

186 {}

Member Function Documentation

◆ init() [1/2]

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

Definition at line 52 of file exceptions.cpp.

54 {
55  problem = aProblem;
56 
57  // The throwers filename is a full filename, depending on Kicad source location.
58  // a short filename will be printed (it is better for user, the full filename has no meaning).
59  wxString srcname = aThrowersFile;
60 
61  where.Printf( _( "from %s : %s() line:%d" ),
62  srcname.AfterLast( '/' ),
63  wxString( aThrowersFunction ),
64  aThrowersLineNumber );
65 }
#define _(s)
Definition: 3d_actions.cpp:33
wxString where
Definition: ki_exception.h:112
wxString problem
Definition: ki_exception.h:111

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

Referenced by IO_ERROR::IO_ERROR().

◆ init() [2/2]

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 
)
inherited

Definition at line 68 of file exceptions.cpp.

72 {
73  parseProblem = aProblem;
74 
75  problem.Printf( _( "%s in \"%s\", line %d, offset %d" ),
76  aProblem,
77  aSource,
78  aLineNumber,
79  aByteIndex );
80 
81  inputLine = aInputLine;
82  lineNumber = aLineNumber;
83  byteIndex = aByteIndex;
84 
85  // The throwers filename is a full filename, depending on Kicad source location.
86  // a short filename will be printed (it is better for user, the full filename has no meaning).
87  wxString srcname = aThrowersFile;
88 
89  where.Printf( _( "from %s : %s() line:%d" ),
90  srcname.AfterLast( '/' ),
91  wxString( aThrowersFunction ),
92  aThrowersLineNumber );
93 }
wxString parseProblem
Definition: ki_exception.h:167
int lineNumber
at which line number, 1 based index.
Definition: ki_exception.h:125
#define _(s)
Definition: 3d_actions.cpp:33
int byteIndex
at which byte offset within the line, 1 based index
Definition: ki_exception.h:126
wxString where
Definition: ki_exception.h:112
std::string inputLine
problem line of input [say, from a LINE_READER].
Definition: ki_exception.h:132
wxString problem
Definition: ki_exception.h:111

References _, PARSE_ERROR::byteIndex, PARSE_ERROR::inputLine, PARSE_ERROR::lineNumber, PARSE_ERROR::parseProblem, IO_ERROR::problem, and IO_ERROR::where.

Referenced by PARSE_ERROR::PARSE_ERROR().

◆ ParseProblem()

const wxString PARSE_ERROR::ParseProblem ( )
inlineinherited

Definition at line 157 of file ki_exception.h.

157 { return parseProblem; }
wxString parseProblem
Definition: ki_exception.h:167

References PARSE_ERROR::parseProblem.

Referenced by PANEL_SETUP_RULES::OnCompile().

◆ Problem()

◆ What()

const wxString IO_ERROR::What ( ) const
virtualinherited

A composite of Problem() and Where()

Definition at line 29 of file exceptions.cpp.

30 {
31 #ifdef DEBUG
32  return wxString( "IO_ERROR: " ) + Problem() + "\n\n" + Where();
33 #else
34  return Problem();
35 #endif
36 }
virtual const wxString Problem() const
what was the problem?
Definition: exceptions.cpp:45
virtual const wxString Where() const
where did the Problem() occur?
Definition: exceptions.cpp:39

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

Referenced by SYMBOL_TREE_MODEL_ADAPTER::AddLibrary(), PCB_BASE_EDIT_FRAME::AddLibrary(), PCBNEW_CONTROL::AppendBoard(), PL_EDIT_TOOL::Copy(), SCH_EDIT_FRAME::CreateArchiveLibrary(), DIALOG_PLOT_SCHEMATIC::CreateDXFFile(), DIALOG_PLOT_SCHEMATIC::createHPGLFile(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DIALOG_PLOT_SCHEMATIC::createPDFFile(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), DIALOG_PLOT_SCHEMATIC::createPSFile(), DIALOG_PLOT_SCHEMATIC::createSVGFile(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), PCB_EDIT_FRAME::Export_IDF3(), FOOTPRINT_EDIT_FRAME::ExportFootprint(), PCB_EDIT_FRAME::ExportFootprintsToLibrary(), SYMBOL_EDIT_FRAME::ExportPart(), PCB_EDIT_FRAME::ExportSpecctraFile(), GPCB_PLUGIN::FootprintEnumerate(), LEGACY_PLUGIN::FootprintEnumerate(), EAGLE_PLUGIN::FootprintEnumerate(), PCB_IO::FootprintEnumerate(), FOOTPRINT_INFO_GENERATOR::GenerateHtml(), SYMBOL_LIBRARY_MANAGER::GetAlias(), SYMBOL_LIBRARY_MANAGER::GetBufferedPart(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), SYMBOL_LIBRARY_MANAGER::GetLibrary(), SYMBOL_LIBRARY_MANAGER::getOriginalParts(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), FOOTPRINT_EDIT_FRAME::ImportFootprint(), SYMBOL_EDIT_FRAME::ImportPart(), PCB_EDIT_FRAME::ImportSpecctraSession(), InvokePcbLibTableEditor(), InvokeSchEditSymbolLibTable(), FP_CACHE::Load(), GPCB_FPL_CACHE::Load(), PART_LIBS::LoadAllLibraries(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), SYMBOL_EDIT_FRAME::LoadOneSymbol(), SCH_EDIT_FRAME::LoadSheetFromFile(), SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib(), main(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), APP_SINGLE_TOP::OnInit(), APP_TEST::OnInit(), CV::IFACE::OnKifaceStart(), PCB::IFACE::OnKifaceStart(), SCH::IFACE::OnKifaceStart(), APP_SINGLE_TOP::OnRun(), APP_TEST::OnRun(), APP_KICAD::OnRun(), DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), SYMBOL_GRID_TRICKS::paste_text(), FP_GRID_TRICKS::paste_text(), PROJECT::PcbFootprintLibs(), KIWAY::Player(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), PCB_CALCULATOR_FRAME::ReadDataFile(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::ReadNetlistFromFile(), CVPCB_MAINFRAME::ReadSchematicNetlist(), PCB_EDIT_FRAME::RunEeschema(), SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), FOOTPRINT_EDIT_FRAME::SaveLibraryAs(), SYMBOL_EDIT_FRAME::SaveOneSymbol(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), SCH_BASE_FRAME::saveSymbolLibTables(), SchGetLibPart(), WS_DATA_MODEL::SetPageLayout(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), KICAD_MANAGER_CONTROL::ShowPlayer(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::TransferDataFromWindow(), DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG::TransferDataFromWindow(), DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow(), SCH_SCREEN::UpdateSymbolLinks(), PANEL_SYM_LIB_TABLE::verifyTables(), NETLIST_EXPORTER_KICAD::WriteNetlist(), SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary(), WS_DATA_MODEL_FILEIO::WS_DATA_MODEL_FILEIO(), and WS_DATA_MODEL_STRINGIO::WS_DATA_MODEL_STRINGIO().

◆ Where()

const wxString IO_ERROR::Where ( ) const
virtualinherited

where did the Problem() occur?

Definition at line 39 of file exceptions.cpp.

40 {
41  return where;
42 }
wxString where
Definition: ki_exception.h:112

References IO_ERROR::where.

Referenced by IO_ERROR::What().

Member Data Documentation

◆ byteIndex

int PARSE_ERROR::byteIndex
inherited

at which byte offset within the line, 1 based index

Definition at line 126 of file ki_exception.h.

Referenced by FUTURE_FORMAT_ERROR(), PARSE_ERROR::init(), and PANEL_SETUP_RULES::OnCompile().

◆ inputLine

std::string PARSE_ERROR::inputLine
inherited

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 132 of file ki_exception.h.

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

◆ lineNumber

int PARSE_ERROR::lineNumber
inherited

at which line number, 1 based index.

Definition at line 125 of file ki_exception.h.

Referenced by FUTURE_FORMAT_ERROR(), PARSE_ERROR::init(), and PANEL_SETUP_RULES::OnCompile().

◆ parseProblem

wxString PARSE_ERROR::parseProblem
protectedinherited

Definition at line 167 of file ki_exception.h.

Referenced by PARSE_ERROR::init(), and PARSE_ERROR::ParseProblem().

◆ problem

wxString IO_ERROR::problem
protectedinherited

◆ requiredVersion

wxString FUTURE_FORMAT_ERROR::requiredVersion

version or date of KiCad required to open file

Definition at line 183 of file ki_exception.h.

Referenced by FUTURE_FORMAT_ERROR().

◆ where

wxString IO_ERROR::where
protectedinherited

Definition at line 112 of file ki_exception.h.

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


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