KiCad PCB EDA Suite
No Matches
Go to the documentation of this file.
2 * This program source code file is part of KICAD, a free EDA CAD application.
3 *
4 * Copyright (C) 2011-2012 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
5 * Copyright (C) 2016-2023 Kicad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 *
20 * or you may search the website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
25#ifndef PCB_IO_H_
26#define PCB_IO_H_
28#include <io/io_base.h>
29#include <pcb_io/pcb_io_mgr.h>
31#include <cstdint>
32#include <config.h>
33#include <vector>
34#include <wx/arrstr.h>
35#include <i18n_utility.h>
37class BOARD;
38class FOOTPRINT;
39class STRING_UTF8_MAP;
40class PROJECT;
71class PCB_IO : public IO_BASE
78 {
79 return IO_BASE::IO_FILE_DESC( wxEmptyString, {} );
80 }
87 virtual bool CanReadBoard( const wxString& aFileName ) const;
93 virtual bool CanReadFootprint( const wxString& aFileName ) const;
98 virtual void SetQueryUserCallback( std::function<bool( wxString aTitle, int aIcon,
99 wxString aMessage,
100 wxString aAction )> aCallback )
101 { }
129 virtual BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
130 const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr );
140 virtual std::vector<FOOTPRINT*> GetImportedCachedLibraryFootprints();
160 virtual void SaveBoard( const wxString& aFileName, BOARD* aBoard,
161 const STRING_UTF8_MAP* aProperties = nullptr );
177 virtual void FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath,
178 bool aBestEfforts, const STRING_UTF8_MAP* aProperties = nullptr );
186 virtual long long GetLibraryTimestamp( const wxString& aLibraryPath ) const = 0;
205 virtual void PrefetchLib( const wxString& aLibraryPath,
206 const STRING_UTF8_MAP* aProperties = nullptr );
225 virtual FOOTPRINT* ImportFootprint( const wxString& aFootprintPath, wxString& aFootprintNameOut,
226 const STRING_UTF8_MAP* aProperties = nullptr );
249 virtual FOOTPRINT* FootprintLoad( const wxString& aLibraryPath,
250 const wxString& aFootprintName,
251 bool aKeepUUID = false,
252 const STRING_UTF8_MAP* aProperties = nullptr );
258 virtual const FOOTPRINT* GetEnumeratedFootprint( const wxString& aLibraryPath,
259 const wxString& aFootprintName,
260 const STRING_UTF8_MAP* aProperties = nullptr );
265 virtual bool FootprintExists( const wxString& aLibraryPath, const wxString& aFootprintName,
266 const STRING_UTF8_MAP* aProperties = nullptr );
284 virtual void FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFootprint,
285 const STRING_UTF8_MAP* aProperties = nullptr );
301 virtual void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName,
302 const STRING_UTF8_MAP* aProperties = nullptr );
331 virtual void GetLibraryOptions( STRING_UTF8_MAP* aListToAppendTo ) const override;
333 virtual ~PCB_IO()
334 {};
337 PCB_IO( const wxString& aName ) : IO_BASE( aName ),
338 m_board( nullptr ),
339 m_props( nullptr )
340 {}
349#endif // PCB_IO_H_
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:282
A base class that BOARD loading and saving plugins should derive from.
Definition: pcb_io.h:72
BOARD * m_board
The board BOARD being worked on, no ownership here.
Definition: pcb_io.h:343
virtual bool CanReadFootprint(const wxString &aFileName) const
Checks if this PCB_IO can read a footprint from specified file or directory.
Definition: pcb_io.cpp:59
const STRING_UTF8_MAP * m_props
Properties passed via Save() or Load(), no ownership, may be NULL.
Definition: pcb_io.h:346
virtual FOOTPRINT * ImportFootprint(const wxString &aFootprintPath, wxString &aFootprintNameOut, const STRING_UTF8_MAP *aProperties=nullptr)
Load a single footprint from aFootprintPath and put its name in aFootprintNameOut.
Definition: pcb_io.cpp:109
virtual long long GetLibraryTimestamp(const wxString &aLibraryPath) const =0
Generate a timestamp representing all the files in the library (including the library directory).
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.
Definition: pcb_io.h:98
virtual bool CanReadBoard(const wxString &aFileName) const
Checks if this PCB_IO can read the specified board file.
Definition: pcb_io.cpp:43
virtual void FootprintEnumerate(wxArrayString &aFootprintNames, const wxString &aLibraryPath, bool aBestEfforts, const STRING_UTF8_MAP *aProperties=nullptr)
Return a list of footprint names contained within the library at aLibraryPath.
Definition: pcb_io.cpp:96
PCB_IO(const wxString &aName)
Definition: pcb_io.h:337
virtual BOARD * LoadBoard(const wxString &aFileName, BOARD *aAppendToMe, const STRING_UTF8_MAP *aProperties=nullptr, PROJECT *aProject=nullptr)
Load information from some input file format that this PCB_IO implementation knows about into either ...
Definition: pcb_io.cpp:75
virtual void GetLibraryOptions(STRING_UTF8_MAP *aListToAppendTo) const override
Append supported PLUGIN options to aListToAppenTo along with internationalized descriptions.
Definition: pcb_io.cpp:174
virtual const FOOTPRINT * GetEnumeratedFootprint(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr)
A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management.
Definition: pcb_io.cpp:133
virtual bool FootprintExists(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr)
Check for the existence of a footprint.
Definition: pcb_io.cpp:142
virtual void SaveBoard(const wxString &aFileName, BOARD *aBoard, const STRING_UTF8_MAP *aProperties=nullptr)
Write aBoard to a storage file in a format that this PCB_IO implementation knows about or it can be u...
Definition: pcb_io.cpp:88
virtual void PrefetchLib(const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
If possible, prefetches the specified library (e.g.
Definition: pcb_io.cpp:104
virtual ~PCB_IO()
Definition: pcb_io.h:333
virtual void FootprintDelete(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr)
Delete aFootprintName from the library at aLibraryPath.
Definition: pcb_io.cpp:166
virtual FOOTPRINT * FootprintLoad(const wxString &aLibraryPath, const wxString &aFootprintName, bool aKeepUUID=false, const STRING_UTF8_MAP *aProperties=nullptr)
Load a footprint having aFootprintName from the aLibraryPath containing a library format that this PC...
Definition: pcb_io.cpp:150
virtual std::vector< FOOTPRINT * > GetImportedCachedLibraryFootprints()
Return a container with the cached library footprints generated in the last call to Load.
Definition: pcb_io.cpp:82
virtual const IO_BASE::IO_FILE_DESC GetBoardFileDesc() const
Returns board file description for the PCB_IO.
Definition: pcb_io.h:77
virtual void FootprintSave(const wxString &aLibraryPath, const FOOTPRINT *aFootprint, const STRING_UTF8_MAP *aProperties=nullptr)
Write aFootprint to an existing library located at aLibraryPath.
Definition: pcb_io.cpp:158
A progress reporter interface for use in multi-threaded environments.
Container for project specific data.
Definition: project.h:62
A name/value tuple with unique names and optional values.
Some functions to handle hotkeys in KiCad.
Container that describes file type info.
Definition: io_base.h:39