KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PCB_IO_KICAD_LEGACY Class Reference

A #PLUGIN derivation which could possibly be put into a DLL/DSO. More...

#include <pcb_io_kicad_legacy.h>

Inheritance diagram for PCB_IO_KICAD_LEGACY:
PCB_IO IO_BASE

Public Types

typedef int BIU
 

Public Member Functions

 PCB_IO_KICAD_LEGACY ()
 
 ~PCB_IO_KICAD_LEGACY ()
 
const IO_BASE::IO_FILE_DESC GetBoardFileDesc () const override
 Returns board file description for the PCB_IO.
 
const IO_BASE::IO_FILE_DESC GetLibraryDesc () const override
 Get the descriptor for the library container that this IO plugin operates on.
 
bool CanReadBoard (const wxString &aFileName) const override
 Checks if this PCB_IO can read the specified board file.
 
bool CanReadFootprint (const wxString &aFileName) const override
 Checks if this PCB_IO can read a footprint from specified file or directory.
 
BOARDLoadBoard (const wxString &aFileName, BOARD *aAppendToMe, const std::map< std::string, UTF8 > *aProperties=nullptr, PROJECT *aProject=nullptr) override
 Load information from some input file format that this PCB_IO implementation knows about into either a new BOARD or an existing one.
 
void FootprintEnumerate (wxArrayString &aFootprintNames, const wxString &aLibraryPath, bool aBestEfforts, const std::map< std::string, UTF8 > *aProperties=nullptr) override
 Return a list of footprint names contained within the library at aLibraryPath.
 
FOOTPRINTFootprintLoad (const wxString &aLibraryPath, const wxString &aFootprintName, bool aKeepUUID=false, const std::map< std::string, UTF8 > *aProperties=nullptr) override
 Load a footprint having aFootprintName from the aLibraryPath containing a library format that this PCB_IO knows about.
 
bool DeleteLibrary (const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr) override
 Delete an existing library and returns true, or if library does not exist returns false, or throws an exception if library exists but is read only or cannot be deleted for some other reason.
 
long long GetLibraryTimestamp (const wxString &aLibraryPath) const override
 Generate a timestamp representing all the files in the library (including the library directory).
 
bool IsLibraryWritable (const wxString &aLibraryPath) override
 Return true if the library at aLibraryPath is writable.
 
void SetReader (LINE_READER *aReader)
 
virtual void SetQueryUserCallback (std::function< bool(wxString aTitle, int aIcon, wxString aMessage, wxString aAction)> aCallback)
 Registers a KIDIALOG callback for collecting info from the user.
 
virtual std::vector< FOOTPRINT * > GetImportedCachedLibraryFootprints ()
 Return a container with the cached library footprints generated in the last call to Load.
 
virtual void SaveBoard (const wxString &aFileName, BOARD *aBoard, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Write aBoard to a storage file in a format that this PCB_IO implementation knows about or it can be used to write a portion of aBoard to a special kind of export file.
 
virtual void PrefetchLib (const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr)
 If possible, prefetches the specified library (e.g.
 
virtual FOOTPRINTImportFootprint (const wxString &aFootprintPath, wxString &aFootprintNameOut, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Load a single footprint from aFootprintPath and put its name in aFootprintNameOut.
 
virtual const FOOTPRINTGetEnumeratedFootprint (const wxString &aLibraryPath, const wxString &aFootprintName, const std::map< std::string, UTF8 > *aProperties=nullptr)
 A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management.
 
virtual bool FootprintExists (const wxString &aLibraryPath, const wxString &aFootprintName, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Check for the existence of a footprint.
 
virtual void FootprintSave (const wxString &aLibraryPath, const FOOTPRINT *aFootprint, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Write aFootprint to an existing library located at aLibraryPath.
 
virtual void FootprintDelete (const wxString &aLibraryPath, const wxString &aFootprintName, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Delete aFootprintName from the library at aLibraryPath.
 
virtual void GetLibraryOptions (std::map< std::string, UTF8 > *aListToAppendTo) const override
 Append supported PLUGIN options to aListToAppenTo along with internationalized descriptions.
 
const wxString & GetName () const
 Return a brief hard coded name for this IO interface.
 
virtual void SetReporter (REPORTER *aReporter)
 Set an optional reporter for warnings/errors.
 
virtual void SetProgressReporter (PROGRESS_REPORTER *aReporter)
 Set an optional progress reporter.
 
virtual const IO_FILE_DESC GetLibraryFileDesc () const
 Get the descriptor for the individual library elements that this IO plugin operates on.
 
virtual bool CanReadLibrary (const wxString &aFileName) const
 Checks if this IO object can read the specified library file/directory.
 
virtual void CreateLibrary (const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Create a new empty library at aLibraryPath empty.
 
virtual void Report (const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
 
virtual void AdvanceProgressPhase ()
 

Static Public Member Functions

static PCB_LAYER_ID leg_layer2new (int cu_count, int aLayerNum)
 
static LSET leg_mask2new (int cu_count, unsigned aMask)
 

Protected Member Functions

void init (const std::map< std::string, UTF8 > *aProperties)
 initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed.
 
void checkpoint ()
 Converts net code using the mapping table if available, otherwise returns unchanged net code.
 
int getNetCode (int aNetCode)
 
BIU biuParse (const char *aValue, const char **nptrptr=nullptr)
 Parse an ASCII decimal floating point value and scales it into a BIU according to the current value of diskToBui.
 
EDA_ANGLE degParse (const char *aValue, const char **nptrptr=nullptr)
 Parse an ASCII decimal floating point value which is certainly an angle in tenths of a degree.
 
void loadAllSections (bool doAppend)
 
void loadGENERAL ()
 
void loadSETUP ()
 
void loadSHEET ()
 
void load3D (FOOTPRINT *aFootprint)
 
void loadPAD (FOOTPRINT *aFootprint)
 
void loadMODULE_TEXT (PCB_TEXT *aText)
 
void loadFP_SHAPE (FOOTPRINT *aFootprint)
 
void loadPCB_LINE ()
 
void loadNETINFO_ITEM ()
 
void loadPCB_TEXT ()
 
void loadNETCLASS ()
 
void loadFOOTPRINT (FOOTPRINT *aFootprint)
 
void loadTrackList (int aStructType)
 Read a list of segments (Tracks and Vias, or Segzones)
 
void loadZONE_CONTAINER ()
 
void loadDIMENSION ()
 
void loadPCB_TARGET ()
 
void cacheLib (const wxString &aLibraryPath)
 we only cache one footprint library for now, this determines which one.
 

Static Protected Member Functions

static int getVersion (LINE_READER *aReader)
 

Protected Attributes

int m_cu_count
 
wxString m_error
 for throwing exceptions
 
PROGRESS_REPORTERm_progressReporter
 may be NULL, no ownership
 
unsigned m_lastProgressLine
 
unsigned m_lineCount
 for progress reporting
 
LINE_READERm_reader
 no ownership here.
 
FILE * m_fp
 no ownership here.
 
wxString m_field
 reused to stuff FOOTPRINT fields.
 
int m_loading_format_version
 which BOARD_FORMAT_VERSION am I Load()ing?
 
LP_CACHEm_cache
 
bool m_showLegacySegmentZoneWarning
 
std::vector< int > m_netCodes
 net codes mapping for boards being loaded
 
double biuToDisk
 convert from BIUs to disk engineering units with this scale factor
 
double diskToBiu
 convert from disk engineering units to BIUs
 
BOARDm_board
 The board BOARD being worked on, no ownership here.
 
const std::map< std::string, UTF8 > * m_props
 Properties passed via Save() or Load(), no ownership, may be NULL.
 
wxString m_name
 Name of the IO loader.
 
REPORTERm_reporter
 Reporter to log errors/warnings to, may be nullptr.
 

Friends

struct LP_CACHE
 

Detailed Description

A #PLUGIN derivation which could possibly be put into a DLL/DSO.

As with any PLUGIN, there is no UI, i.e. windowing calls allowed.

Definition at line 62 of file pcb_io_kicad_legacy.h.

Member Typedef Documentation

◆ BIU

Definition at line 101 of file pcb_io_kicad_legacy.h.

Constructor & Destructor Documentation

◆ PCB_IO_KICAD_LEGACY()

PCB_IO_KICAD_LEGACY::PCB_IO_KICAD_LEGACY ( )

Definition at line 3294 of file pcb_io_kicad_legacy.cpp.

References init().

◆ ~PCB_IO_KICAD_LEGACY()

PCB_IO_KICAD_LEGACY::~PCB_IO_KICAD_LEGACY ( )

Definition at line 3307 of file pcb_io_kicad_legacy.cpp.

References m_cache.

Member Function Documentation

◆ AdvanceProgressPhase()

void IO_BASE::AdvanceProgressPhase ( )
virtualinherited

◆ biuParse()

BIU PCB_IO_KICAD_LEGACY::biuParse ( const char *  aValue,
const char **  nptrptr = nullptr 
)
protected

Parse an ASCII decimal floating point value and scales it into a BIU according to the current value of diskToBui.

This function is the complement of #fmtBIU(). One has to know what the other is doing.

Parameters
aValueis the ASCII value in C locale form with possible leading whitespace
nptrptrmay be NULL, but if not, then it tells where to put a pointer to the next unconsumed input text. See "man strtod" for more information.
Returns
the converted Board Internal Unit.

Definition at line 2840 of file pcb_io_kicad_legacy.cpp.

References _, diskToBiu, LINE_READER::GetSource(), KiROUND(), LINE_READER::Line(), LINE_READER::LineNumber(), m_error, m_reader, and THROW_IO_ERROR.

Referenced by loadDIMENSION(), loadFOOTPRINT(), loadFP_SHAPE(), loadGENERAL(), loadMODULE_TEXT(), loadNETCLASS(), loadPAD(), loadPCB_LINE(), loadPCB_TARGET(), loadPCB_TEXT(), loadSETUP(), loadTrackList(), and loadZONE_CONTAINER().

◆ cacheLib()

void PCB_IO_KICAD_LEGACY::cacheLib ( const wxString &  aLibraryPath)
protected

we only cache one footprint library for now, this determines which one.

Definition at line 3187 of file pcb_io_kicad_legacy.cpp.

References LP_CACHE::IsModified(), LP_CACHE::Load(), LP_CACHE, m_cache, and LP_CACHE::m_lib_path.

Referenced by FootprintEnumerate(), FootprintLoad(), and IsLibraryWritable().

◆ CanReadBoard()

bool PCB_IO_KICAD_LEGACY::CanReadBoard ( const wxString &  aFileName) const
overridevirtual

Checks if this PCB_IO can read the specified board file.

If not overriden, extension check is used.

Reimplemented from PCB_IO.

Definition at line 414 of file pcb_io_kicad_legacy.cpp.

References PCB_IO::CanReadBoard(), and getVersion().

◆ CanReadFootprint()

bool PCB_IO_KICAD_LEGACY::CanReadFootprint ( const wxString &  aFileName) const
overridevirtual

Checks if this PCB_IO can read a footprint from specified file or directory.

If not overriden, extension check is used.

Reimplemented from PCB_IO.

Definition at line 433 of file pcb_io_kicad_legacy.cpp.

References PCB_IO::CanReadFootprint(), FOOTPRINT_LIBRARY_HEADER, FOOTPRINT_LIBRARY_HEADER_CNT, LINE_READER::Line(), and WHITESPACE_FILTER_READER::ReadLine().

◆ CanReadLibrary()

bool IO_BASE::CanReadLibrary ( const wxString &  aFileName) const
virtualinherited

Checks if this IO object can read the specified library file/directory.

If not overriden, extension check is used.

Note
This is not a check that the file system object is readable by the user, but a check that this IO object can parse the given library.

Reimplemented in SCH_IO_ALTIUM, SCH_IO_CADSTAR_ARCHIVE, SCH_IO_EAGLE, SCH_IO_EASYEDA, SCH_IO_KICAD_LEGACY, PCB_IO_ALTIUM_DESIGNER, PCB_IO_CADSTAR_ARCHIVE, PCB_IO_EAGLE, PCB_IO_EASYEDA, PCB_IO_IPC2581, and PCB_IO_ODBPP.

Definition at line 69 of file io_base.cpp.

References IO_BASE::GetLibraryDesc(), IO_BASE::IO_FILE_DESC::m_ExtensionsInDir, IO_BASE::IO_FILE_DESC::m_FileExtensions, and IO_BASE::IO_FILE_DESC::m_IsFile.

Referenced by SCH_IO_ALTIUM::CanReadLibrary(), SCH_IO_CADSTAR_ARCHIVE::CanReadLibrary(), SCH_IO_EAGLE::CanReadLibrary(), SCH_IO_KICAD_LEGACY::CanReadLibrary(), PCB_IO_ALTIUM_DESIGNER::CanReadLibrary(), PCB_IO_CADSTAR_ARCHIVE::CanReadLibrary(), and PCB_IO_EAGLE::CanReadLibrary().

◆ checkpoint()

void PCB_IO_KICAD_LEGACY::checkpoint ( )
protected

Converts net code using the mapping table if available, otherwise returns unchanged net code.

Definition at line 206 of file pcb_io_kicad_legacy.cpp.

References _, PROGRESS_REPORTER::KeepRefreshing(), LINE_READER::LineNumber(), m_lastProgressLine, m_lineCount, m_progressReporter, m_reader, PROGRESS_REPORTER::SetCurrentProgress(), and THROW_IO_ERROR.

Referenced by loadAllSections(), and loadTrackList().

◆ CreateLibrary()

void IO_BASE::CreateLibrary ( const wxString &  aLibraryPath,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
virtualinherited

Create a new empty library at aLibraryPath empty.

It is an error to attempt to create an existing library or to attempt to create on a "read only" location.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several elements.
aPropertiesis an associative array that can be used to tell the library create function anything special, because it can take any number of additional named tuning arguments that the IO is known to support. The caller continues to own this object (IO may not delete it), and IOs should expect it to be optionally NULL.
Exceptions
IO_ERRORif there is a problem finding the library, or creating it.

Reimplemented in DESIGN_BLOCK_IO, SCH_IO_KICAD_LEGACY, SCH_IO_KICAD_SEXPR, and PCB_IO_KICAD_SEXPR.

Definition at line 46 of file io_base.cpp.

References NOT_IMPLEMENTED.

◆ degParse()

EDA_ANGLE PCB_IO_KICAD_LEGACY::degParse ( const char *  aValue,
const char **  nptrptr = nullptr 
)
protected

Parse an ASCII decimal floating point value which is certainly an angle in tenths of a degree.

Parameters
aValueis the ASCII value in C locale form with possible leading whitespace.
nptrptrmay be NULL, but if not, then it tells where to put a pointer to the next unconsumed input text. See "man strtod" for more information.

Definition at line 2879 of file pcb_io_kicad_legacy.cpp.

References _, LINE_READER::GetSource(), LINE_READER::Line(), LINE_READER::LineNumber(), m_error, m_reader, TENTHS_OF_A_DEGREE_T, and THROW_IO_ERROR.

Referenced by loadDIMENSION(), loadFP_SHAPE(), loadMODULE_TEXT(), loadPAD(), loadPCB_LINE(), and loadPCB_TEXT().

◆ DeleteLibrary()

bool PCB_IO_KICAD_LEGACY::DeleteLibrary ( const wxString &  aLibraryPath,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
overridevirtual

Delete an existing library and returns true, or if library does not exist returns false, or throws an exception if library exists but is read only or cannot be deleted for some other reason.

Parameters
aLibraryPathis a locator for the "library", usually a directory or file which will contain several elements.
aPropertiesis an associative array that can be used to tell the library delete implementation function anything special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Returns
true if library deleted, false if library did not exist.
Exceptions
IO_ERRORif there is a problem deleting an existing library.

Reimplemented from IO_BASE.

Definition at line 3252 of file pcb_io_kicad_legacy.cpp.

References _, m_cache, LP_CACHE::m_lib_path, and THROW_IO_ERROR.

◆ FootprintDelete()

void PCB_IO::FootprintDelete ( const wxString &  aLibraryPath,
const wxString &  aFootprintName,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
virtualinherited

Delete aFootprintName from the library at aLibraryPath.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several footprints.
aFootprintNameis the name of a footprint to delete from the specified library.
aPropertiesis an associative array that can be used to tell the library delete function anything special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif there is a problem finding the footprint or the library, or deleting it.

Reimplemented in PCB_IO_GEDA, and PCB_IO_KICAD_SEXPR.

Definition at line 165 of file pcb_io.cpp.

References NOT_IMPLEMENTED.

◆ FootprintEnumerate()

void PCB_IO_KICAD_LEGACY::FootprintEnumerate ( wxArrayString &  aFootprintNames,
const wxString &  aLibraryPath,
bool  aBestEfforts,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
overridevirtual

Return a list of footprint names contained within the library at aLibraryPath.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several footprints.
aPropertiesis an associative array that can be used to tell the plugin anything needed about how to perform with respect to aLibraryPath. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
aFootprintNamesis the array of available footprint names inside a library.
aBestEffortsif true, don't throw on errors, just return an empty list.
Exceptions
IO_ERRORif the library cannot be found, or footprint cannot be loaded.

Reimplemented from PCB_IO.

Definition at line 3199 of file pcb_io_kicad_legacy.cpp.

References cacheLib(), From_UTF8(), init(), m_cache, LP_CACHE::m_footprints, THROW_IO_ERROR, and IO_ERROR::What().

◆ FootprintExists()

bool PCB_IO::FootprintExists ( const wxString &  aLibraryPath,
const wxString &  aFootprintName,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
virtualinherited

Check for the existence of a footprint.

Reimplemented in PCB_IO_CADSTAR_ARCHIVE, and PCB_IO_KICAD_SEXPR.

Definition at line 141 of file pcb_io.cpp.

References PCB_IO::FootprintLoad().

◆ FootprintLoad()

FOOTPRINT * PCB_IO_KICAD_LEGACY::FootprintLoad ( const wxString &  aLibraryPath,
const wxString &  aFootprintName,
bool  aKeepUUID = false,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
overridevirtual

Load a footprint having aFootprintName from the aLibraryPath containing a library format that this PCB_IO knows about.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several footprints.
aFootprintNameis the name of the footprint to load.
aPropertiesis an associative array that can be used to tell the loader implementation to do something special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
aKeepUUID= true to keep initial items UUID, false to set new UUID normally true if loaded in the footprint editor, false if loaded in the board editor. Make sense only in kicad_plugin
Returns
the FOOTPRINT object if found, caller owns it, else NULL if not found.
Exceptions
IO_ERRORif the library cannot be found or read. No exception is thrown in the case where aFootprintName cannot be found.

Reimplemented from PCB_IO.

Definition at line 3227 of file pcb_io_kicad_legacy.cpp.

References cacheLib(), copy, init(), m_cache, LP_CACHE::m_footprints, and TO_UTF8.

◆ FootprintSave()

void PCB_IO::FootprintSave ( const wxString &  aLibraryPath,
const FOOTPRINT aFootprint,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
virtualinherited

Write aFootprint to an existing library located at aLibraryPath.

If a footprint by the same name already exists, it is replaced.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several footprints.
aFootprintis what to store in the library. The caller continues to own the footprint after this call.
aPropertiesis an associative array that can be used to tell the saver how to save the footprint, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif there is a problem saving.

Reimplemented in PCB_IO_KICAD_SEXPR.

Definition at line 157 of file pcb_io.cpp.

References NOT_IMPLEMENTED.

◆ GetBoardFileDesc()

const IO_BASE::IO_FILE_DESC PCB_IO_KICAD_LEGACY::GetBoardFileDesc ( ) const
inlineoverridevirtual

Returns board file description for the PCB_IO.

Reimplemented from PCB_IO.

Definition at line 70 of file pcb_io_kicad_legacy.h.

References _HKI.

◆ GetEnumeratedFootprint()

const FOOTPRINT * PCB_IO::GetEnumeratedFootprint ( const wxString &  aLibraryPath,
const wxString &  aFootprintName,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
virtualinherited

A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management.

Reimplemented in PCB_IO_KICAD_SEXPR.

Definition at line 132 of file pcb_io.cpp.

References PCB_IO::FootprintLoad().

◆ GetImportedCachedLibraryFootprints()

std::vector< FOOTPRINT * > PCB_IO::GetImportedCachedLibraryFootprints ( )
virtualinherited

Return a container with the cached library footprints generated in the last call to Load.

This function is intended to be used ONLY by the non-KiCad board importers for the purpose of obtaining the footprint library of the design and creating a project-specific library.

Returns
Footprints (caller owns the objects)

Reimplemented in PCB_IO_CADSTAR_ARCHIVE, PCB_IO_EAGLE, PCB_IO_EASYEDA, PCB_IO_EASYEDAPRO, PCB_IO_IPC2581, and PCB_IO_ODBPP.

Definition at line 81 of file pcb_io.cpp.

References NOT_IMPLEMENTED.

◆ GetLibraryDesc()

const IO_BASE::IO_FILE_DESC PCB_IO_KICAD_LEGACY::GetLibraryDesc ( ) const
inlineoverridevirtual

Get the descriptor for the library container that this IO plugin operates on.

Returns
File descriptor for the container of the library elements

Implements IO_BASE.

Definition at line 75 of file pcb_io_kicad_legacy.h.

References _HKI.

◆ GetLibraryFileDesc()

virtual const IO_FILE_DESC IO_BASE::GetLibraryFileDesc ( ) const
inlinevirtualinherited

Get the descriptor for the individual library elements that this IO plugin operates on.

For libraries where all the elements are in a single container (e.g. all elements in a single file), then this will return the descriptor from IO_BASE::GetLibraryDesc().

Returns
File descriptor for the library elements

Reimplemented in PCB_IO_EASYEDA, PCB_IO_EASYEDAPRO, PCB_IO_GEDA, and PCB_IO_KICAD_SEXPR.

Definition at line 106 of file io_base.h.

Referenced by PCB_IO::CanReadFootprint().

◆ GetLibraryOptions()

void PCB_IO::GetLibraryOptions ( std::map< std::string, UTF8 > *  aListToAppendTo) const
overridevirtualinherited

Append supported PLUGIN options to aListToAppenTo along with internationalized descriptions.

Options are typically appended so that a derived #PLUGIN can call its base class function by the same name first, thus inheriting options declared there. Some base class options could pertain to all Footprint*() functions in all derived PLUGINs.

Note
Since aListToAppendTo is a #PROPERTIES object, all options will be unique and last guy wins.
Parameters
aListToAppendToholds a tuple of
option
This eventually is what shows up into the fp-lib-table "options" field, possibly combined with others.
internationalized description
The internationalized description is displayed in DIALOG_PLUGIN_OPTIONS. It may be multi-line and be quite explanatory of the option.

In the future perhaps aListToAppendTo evolves to something capable of also holding a wxValidator for the cells in said dialog: http://forums.wxwidgets.org/viewtopic.php?t=23277&p=104180. This would require a 3 column list, and introducing wx GUI knowledge to PLUGIN, which has been avoided to date.

Reimplemented from IO_BASE.

Definition at line 173 of file pcb_io.cpp.

References _, and IO_BASE::GetLibraryOptions().

◆ GetLibraryTimestamp()

long long PCB_IO_KICAD_LEGACY::GetLibraryTimestamp ( const wxString &  aLibraryPath) const
overridevirtual

Generate a timestamp representing all the files in the library (including the library directory).

Timestamps should not be considered ordered, they either match or they don't.

Implements PCB_IO.

Definition at line 3181 of file pcb_io_kicad_legacy.cpp.

References LP_CACHE::GetTimestamp().

◆ GetName()

const wxString & IO_BASE::GetName ( ) const
inlineinherited

Return a brief hard coded name for this IO interface.

Definition at line 75 of file io_base.h.

Referenced by SCH_IO_ALTIUM::ParseLibFile().

◆ getNetCode()

int PCB_IO_KICAD_LEGACY::getNetCode ( int  aNetCode)
inlineprotected

Definition at line 118 of file pcb_io_kicad_legacy.h.

References m_netCodes.

Referenced by loadPAD(), loadTrackList(), and loadZONE_CONTAINER().

◆ getVersion()

int PCB_IO_KICAD_LEGACY::getVersion ( LINE_READER aReader)
staticprotected

◆ ImportFootprint()

FOOTPRINT * PCB_IO::ImportFootprint ( const wxString &  aFootprintPath,
wxString &  aFootprintNameOut,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
virtualinherited

Load a single footprint from aFootprintPath and put its name in aFootprintNameOut.

If this is a footprint library, the first footprint should be loaded. The default implementation uses FootprintEnumerate and FootprintLoad to load first footprint.

Parameters
aLibraryPathis a path of the footprint file.
aFootprintNameOutis the name output of the loaded footprint.
aPropertiesis an associative array that can be used to tell the loader implementation to do something special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Returns
the FOOTPRINT object if found, caller owns it, else NULL if not found.
Exceptions
IO_ERRORif the footprint cannot be found or read.

Reimplemented in PCB_IO_GEDA, and PCB_IO_KICAD_SEXPR.

Definition at line 108 of file pcb_io.cpp.

References _, PCB_IO::FootprintEnumerate(), and PCB_IO::FootprintLoad().

◆ init()

void PCB_IO_KICAD_LEGACY::init ( const std::map< std::string, UTF8 > *  aProperties)
protected

◆ IsLibraryWritable()

bool PCB_IO_KICAD_LEGACY::IsLibraryWritable ( const wxString &  aLibraryPath)
overridevirtual

Return true if the library at aLibraryPath is writable.

The system libraries are typically read only because of where they are installed..

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several footprints.
Exceptions
IO_ERRORif no library at aLibraryPath exists.

Reimplemented from IO_BASE.

Definition at line 3278 of file pcb_io_kicad_legacy.cpp.

References cacheLib(), init(), m_cache, and LP_CACHE::m_writable.

◆ leg_layer2new()

◆ leg_mask2new()

LSET PCB_IO_KICAD_LEGACY::leg_mask2new ( int  cu_count,
unsigned  aMask 
)
static

Definition at line 367 of file pcb_io_kicad_legacy.cpp.

References ALL_CU_LAYERS, LSET::AllCuMask(), leg_layer2new(), and BASE_SET::set().

Referenced by loadGENERAL(), and loadPAD().

◆ load3D()

◆ loadAllSections()

◆ LoadBoard()

BOARD * PCB_IO_KICAD_LEGACY::LoadBoard ( const wxString &  aFileName,
BOARD aAppendToMe,
const std::map< std::string, UTF8 > *  aProperties = nullptr,
PROJECT aProject = nullptr 
)
overridevirtual

Load information from some input file format that this PCB_IO implementation knows about into either a new BOARD or an existing one.

This may be used to load an entire new BOARD, or to augment an existing one if aAppendToMe is not NULL.

Parameters
aFileNameis the name of the file to use as input and may be foreign in nature or native in nature.
aAppendToMeis an existing BOARD to append to, but if NULL then this means "do not append, rather load anew".
aPropertiesis an associative array that can be used to tell the loader how to load the file, because it can take any number of additional named arguments that the plugin is known to support. These are tuning parameters for the import or load. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
aProjectis the optional PROJECT object primarily used by third party importers.
Returns
the successfully loaded board, or the same one as aAppendToMe if aAppendToMe was not NULL, and caller owns it.
Exceptions
IO_ERRORif there is a problem loading, and its contents should say what went wrong, using line number and character offsets of the input file if possible.

Reimplemented from PCB_IO.

Definition at line 469 of file pcb_io_kicad_legacy.cpp.

References _, getVersion(), ignore_unused(), init(), PROGRESS_REPORTER::KeepRefreshing(), loadAllSections(), PCB_IO::m_board, m_lineCount, m_loading_format_version, m_progressReporter, m_reader, FILE_LINE_READER::ReadLine(), PROGRESS_REPORTER::Report(), FILE_LINE_READER::Rewind(), BOARD::SetFileFormatVersionAtLoad(), BOARD::SetFileName(), and THROW_IO_ERROR.

◆ loadDIMENSION()

◆ loadFOOTPRINT()

◆ loadFP_SHAPE()

◆ loadGENERAL()

◆ loadMODULE_TEXT()

◆ loadNETCLASS()

◆ loadNETINFO_ITEM()

◆ loadPAD()

◆ loadPCB_LINE()

◆ loadPCB_TARGET()

◆ loadPCB_TEXT()

◆ loadSETUP()

void PCB_IO_KICAD_LEGACY::loadSETUP ( )
protected

Definition at line 906 of file pcb_io_kicad_legacy.cpp.

References PADSTACK::ALL_LAYERS, biuParse(), delims, From_UTF8(), BOARD_DESIGN_SETTINGS::GetDefaultZoneSettings(), BOARD::GetDesignSettings(), PCB_PLOT_PARAMS::GetLegacyPlotViaOnMaskLayer(), LINE_READER::GetSource(), hexParse(), intParse(), LAYER_CLASS_COPPER, LAYER_CLASS_EDGES, LAYER_CLASS_OTHERS, LAYER_CLASS_SILK, leg_layer2new(), PCB_IO::m_board, m_cu_count, BOARD::m_LegacyDesignSettingsLoaded, BOARD::m_LegacyNetclassesLoaded, BOARD_DESIGN_SETTINGS::m_LineThickness, BOARD_DESIGN_SETTINGS::m_MicroViasMinDrill, BOARD_DESIGN_SETTINGS::m_MicroViasMinSize, BOARD_DESIGN_SETTINGS::m_MinThroughDrill, BOARD_DESIGN_SETTINGS::m_NetSettings, BOARD_DESIGN_SETTINGS::m_Pad_Master, m_reader, BOARD_DESIGN_SETTINGS::m_SolderMaskExpansion, BOARD_DESIGN_SETTINGS::m_SolderMaskMinWidth, BOARD_DESIGN_SETTINGS::m_SolderPasteMargin, BOARD_DESIGN_SETTINGS::m_SolderPasteMarginRatio, BOARD_DESIGN_SETTINGS::m_TentViasBack, BOARD_DESIGN_SETTINGS::m_TentViasFront, BOARD_DESIGN_SETTINGS::m_TextSize, BOARD_DESIGN_SETTINGS::m_TextThickness, BOARD_DESIGN_SETTINGS::m_TrackMinWidth, BOARD_DESIGN_SETTINGS::m_TrackWidthList, BOARD_DESIGN_SETTINGS::m_ViasDimensionsList, BOARD_DESIGN_SETTINGS::m_ViasMinSize, ZONE_SETTINGS::m_ZoneClearance, PCB_PLOT_PARAMS::Parse(), LAYER::ParseType(), READLINE, GAL_SET::set(), BOARD_DESIGN_SETTINGS::SetAuxOrigin(), BOARD_DESIGN_SETTINGS::SetDefaultZoneSettings(), BOARD_DESIGN_SETTINGS::SetGridOrigin(), BOARD::SetLayerName(), BOARD::SetLayerType(), BOARD::SetPlotOptions(), BOARD::SetVisibleElements(), SZ, TESTLINE, and TESTSUBSTR.

Referenced by loadAllSections().

◆ loadSHEET()

◆ loadTrackList()

void PCB_IO_KICAD_LEGACY::loadTrackList ( int  aStructType)
protected

Read a list of segments (Tracks and Vias, or Segzones)

Parameters
aStructTypeis either PCB_TRACE_T to indicate tracks and vias, or NOT_USED to indicate oldschool zone segments (which are discarded).

Definition at line 2142 of file pcb_io_kicad_legacy.cpp.

References BOARD::Add(), PADSTACK::ALL_LAYERS, B_Cu, biuParse(), checkpoint(), delims, F_Cu, getNetCode(), intParse(), is_leg_copperlayer_valid(), leg_layer2new(), LINE_READER::Line(), PCB_IO::m_board, m_cu_count, m_reader, EDA_ITEM::m_Uuid, NOT_USED, PCB_TRACE_T, PCB_VIA_T, READLINE, PCB_TRACK::SetEnd(), BOARD_ITEM::SetLayer(), BOARD_CONNECTED_ITEM::SetNetCode(), PCB_TRACK::SetPosition(), PCB_TRACK::SetWidth(), SZ, TESTLINE, THROW_IO_ERROR, and via.

Referenced by loadAllSections().

◆ loadZONE_CONTAINER()

◆ PrefetchLib()

void PCB_IO::PrefetchLib ( const wxString &  aLibraryPath,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
virtualinherited

If possible, prefetches the specified library (e.g.

performing downloads). Does not parse. Threadsafe.

This is a no-op for libraries that cannot be prefetched. Plugins that cannot prefetch need not override this; a default no-op is provided.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several footprints.
aPropertiesis an associative array that can be used to tell the plugin anything needed about how to perform with respect to aLibraryPath. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif there is an error prefetching the library.

Definition at line 103 of file pcb_io.cpp.

◆ Report()

void IO_BASE::Report ( const wxString &  aText,
SEVERITY  aSeverity = RPT_SEVERITY_UNDEFINED 
)
virtualinherited

◆ SaveBoard()

void PCB_IO::SaveBoard ( const wxString &  aFileName,
BOARD aBoard,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
virtualinherited

Write aBoard to a storage file in a format that this PCB_IO implementation knows about or it can be used to write a portion of aBoard to a special kind of export file.

Parameters
aFileNameis the name of a file to save to on disk.
aBoardis the class BOARD in memory document tree from which to extract information when writing to aFileName. The caller continues to own the BOARD, and the plugin should refrain from modifying the BOARD if possible.
aPropertiesis an associative array that can be used to tell the saver how to save the file, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it) and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif there is a problem saving or exporting.

Reimplemented in CLIPBOARD_IO, PCB_IO_IPC2581, PCB_IO_KICAD_SEXPR, and PCB_IO_ODBPP.

Definition at line 87 of file pcb_io.cpp.

References NOT_IMPLEMENTED.

◆ SetProgressReporter()

virtual void IO_BASE::SetProgressReporter ( PROGRESS_REPORTER aReporter)
inlinevirtualinherited

Set an optional progress reporter.

Reimplemented in SCH_IO_CADSTAR_ARCHIVE.

Definition at line 85 of file io_base.h.

Referenced by PCB_CONTROL::AppendBoard().

◆ SetQueryUserCallback()

virtual void PCB_IO::SetQueryUserCallback ( std::function< bool(wxString aTitle, int aIcon, wxString aMessage, wxString aAction)>  aCallback)
inlinevirtualinherited

Registers a KIDIALOG callback for collecting info from the user.

Definition at line 97 of file pcb_io.h.

Referenced by PCB_CONTROL::AppendBoard().

◆ SetReader()

void PCB_IO_KICAD_LEGACY::SetReader ( LINE_READER aReader)
inline

Definition at line 103 of file pcb_io_kicad_legacy.h.

References m_reader.

Referenced by LP_CACHE::LoadModules().

◆ SetReporter()

virtual void IO_BASE::SetReporter ( REPORTER aReporter)
inlinevirtualinherited

Set an optional reporter for warnings/errors.

Reimplemented in SCH_IO_CADSTAR_ARCHIVE.

Definition at line 80 of file io_base.h.

Friends And Related Function Documentation

◆ LP_CACHE

friend struct LP_CACHE
friend

Definition at line 64 of file pcb_io_kicad_legacy.h.

Referenced by cacheLib().

Member Data Documentation

◆ biuToDisk

double PCB_IO_KICAD_LEGACY::biuToDisk
protected

convert from BIUs to disk engineering units with this scale factor

Definition at line 202 of file pcb_io_kicad_legacy.h.

Referenced by init().

◆ diskToBiu

double PCB_IO_KICAD_LEGACY::diskToBiu
protected

convert from disk engineering units to BIUs

with this scale factor

Definition at line 205 of file pcb_io_kicad_legacy.h.

Referenced by biuParse(), init(), loadGENERAL(), and LP_CACHE::ReadAndVerifyHeader().

◆ m_board

◆ m_cache

LP_CACHE* PCB_IO_KICAD_LEGACY::m_cache
protected

◆ m_cu_count

◆ m_error

wxString PCB_IO_KICAD_LEGACY::m_error
protected

for throwing exceptions

Definition at line 187 of file pcb_io_kicad_legacy.h.

Referenced by biuParse(), degParse(), loadFP_SHAPE(), loadNETCLASS(), loadPAD(), loadSHEET(), and loadZONE_CONTAINER().

◆ m_field

wxString PCB_IO_KICAD_LEGACY::m_field
protected

reused to stuff FOOTPRINT fields.

Definition at line 195 of file pcb_io_kicad_legacy.h.

Referenced by loadMODULE_TEXT().

◆ m_fp

FILE* PCB_IO_KICAD_LEGACY::m_fp
protected

no ownership here.

Definition at line 193 of file pcb_io_kicad_legacy.h.

◆ m_lastProgressLine

unsigned PCB_IO_KICAD_LEGACY::m_lastProgressLine
protected

Definition at line 189 of file pcb_io_kicad_legacy.h.

Referenced by checkpoint().

◆ m_lineCount

unsigned PCB_IO_KICAD_LEGACY::m_lineCount
protected

for progress reporting

Definition at line 190 of file pcb_io_kicad_legacy.h.

Referenced by checkpoint(), and LoadBoard().

◆ m_loading_format_version

int PCB_IO_KICAD_LEGACY::m_loading_format_version
protected

which BOARD_FORMAT_VERSION am I Load()ing?

Definition at line 196 of file pcb_io_kicad_legacy.h.

Referenced by init(), LoadBoard(), and loadPAD().

◆ m_name

wxString IO_BASE::m_name
protectedinherited

Name of the IO loader.

Definition at line 215 of file io_base.h.

◆ m_netCodes

std::vector<int> PCB_IO_KICAD_LEGACY::m_netCodes
protected

net codes mapping for boards being loaded

Definition at line 200 of file pcb_io_kicad_legacy.h.

Referenced by getNetCode(), loadGENERAL(), and loadNETINFO_ITEM().

◆ m_progressReporter

PROGRESS_REPORTER* PCB_IO_KICAD_LEGACY::m_progressReporter
protected

may be NULL, no ownership

Definition at line 188 of file pcb_io_kicad_legacy.h.

Referenced by checkpoint(), and LoadBoard().

◆ m_props

◆ m_reader

◆ m_reporter

REPORTER* IO_BASE::m_reporter
protectedinherited

Reporter to log errors/warnings to, may be nullptr.

Definition at line 218 of file io_base.h.

Referenced by SCH_IO_ALTIUM::AddLibTextBox(), SCH_IO_CADSTAR_ARCHIVE::ensureLoadedLibrary(), PCB_IO_ALTIUM_DESIGNER::FootprintLoad(), PCB_IO_ALTIUM_CIRCUIT_STUDIO::LoadBoard(), PCB_IO_ALTIUM_CIRCUIT_MAKER::LoadBoard(), PCB_IO_ALTIUM_DESIGNER::LoadBoard(), PCB_IO_SOLIDWORKS::LoadBoard(), SCH_IO_CADSTAR_ARCHIVE::LoadSchematicFile(), SCH_IO_LTSPICE::LoadSchematicFile(), SCH_IO_ALTIUM::ParseAltiumSch(), SCH_IO_ALTIUM::ParseArc(), SCH_IO_ALTIUM::ParseBezier(), SCH_IO_ALTIUM::ParseCircle(), SCH_IO_ALTIUM::ParseComponent(), SCH_IO_ALTIUM::ParseDesignator(), SCH_IO_ALTIUM::ParseEllipse(), SCH_IO_ALTIUM::ParseEllipticalArc(), SCH_IO_ALTIUM::ParseFileName(), SCH_IO_ALTIUM::ParseHarnessConnector(), SCH_IO_ALTIUM::ParseHarnessEntry(), SCH_IO_ALTIUM::ParseHarnessPort(), SCH_IO_ALTIUM::ParseHarnessType(), SCH_IO_ALTIUM::ParseImage(), SCH_IO_ALTIUM::ParseImplementation(), SCH_IO_ALTIUM::ParseLabel(), SCH_IO_ALTIUM::ParseLibFile(), SCH_IO_ALTIUM::ParseLine(), SCH_IO_ALTIUM::ParsePieChart(), SCH_IO_ALTIUM::ParsePin(), SCH_IO_ALTIUM::ParsePolygon(), SCH_IO_ALTIUM::ParsePolyline(), SCH_IO_ALTIUM::ParsePort(), SCH_IO_ALTIUM::ParsePowerPort(), SCH_IO_ALTIUM::ParseRecord(), SCH_IO_ALTIUM::ParseRectangle(), SCH_IO_ALTIUM::ParseRoundRectangle(), SCH_IO_ALTIUM::ParseSheetEntry(), SCH_IO_ALTIUM::ParseSheetName(), SCH_IO_ALTIUM::ParseSignalHarness(), SCH_IO_ALTIUM::ParseStorage(), PCB_IO_ALTIUM_DESIGNER::PCB_IO_ALTIUM_DESIGNER(), PCB_IO_SOLIDWORKS::PCB_IO_SOLIDWORKS(), IO_BASE::Report(), SCH_IO_ALTIUM::SCH_IO_ALTIUM(), SCH_IO_CADSTAR_ARCHIVE::SCH_IO_CADSTAR_ARCHIVE(), SCH_IO_EAGLE::SCH_IO_EAGLE(), SCH_IO_EASYEDA::SCH_IO_EASYEDA(), SCH_IO_EASYEDAPRO::SCH_IO_EASYEDAPRO(), SCH_IO_LTSPICE::SCH_IO_LTSPICE(), and SCH_IO_CADSTAR_ARCHIVE::SetReporter().

◆ m_showLegacySegmentZoneWarning

bool PCB_IO_KICAD_LEGACY::m_showLegacySegmentZoneWarning
protected

Definition at line 198 of file pcb_io_kicad_legacy.h.

Referenced by init(), and loadZONE_CONTAINER().


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