KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_io.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2016 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Wayne Stambaugh <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 3
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#ifndef SCH_IO_H_
24#define SCH_IO_H_
25
26#include <io/io_base.h>
27#include <sch_io/sch_io_mgr.h>
28#include <import_export.h>
29#include <map>
30#include <enum_vector.h>
31#include <reporter.h>
32#include <i18n_utility.h>
33#include <wx/arrstr.h>
34
36
58class SCH_IO : public IO_BASE
59{
60public:
61
62 //-----<PUBLIC SCH_IO API>-------------------------------------------------
63
67 virtual const IO_BASE::IO_FILE_DESC GetSchematicFileDesc() const;
68
73 virtual bool CanReadSchematicFile( const wxString& aFileName ) const;
74
84 virtual int GetModifyHash() const = 0;
85
86 virtual void SaveLibrary( const wxString& aFileName,
87 const std::map<std::string, UTF8>* aProperties = nullptr );
88
117 virtual SCH_SHEET* LoadSchematicFile( const wxString& aFileName, SCHEMATIC* aSchematic,
118 SCH_SHEET* aAppendToMe = nullptr,
119 const std::map<std::string, UTF8>* aProperties = nullptr );
120
146 virtual void SaveSchematicFile( const wxString& aFileName, SCH_SHEET* aSheet,
147 SCHEMATIC* aSchematic,
148 const std::map<std::string, UTF8>* aProperties = nullptr );
149
166 virtual void EnumerateSymbolLib( wxArrayString& aSymbolNameList, const wxString& aLibraryPath,
167 const std::map<std::string, UTF8>* aProperties = nullptr );
168
188 virtual void EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
189 const wxString& aLibraryPath,
190 const std::map<std::string, UTF8>* aProperties = nullptr );
191
213 virtual LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, const wxString& aPartName,
214 const std::map<std::string, UTF8>* aProperties = nullptr );
215
237 virtual void SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
238 const std::map<std::string, UTF8>* aProperties = nullptr );
239
258 virtual void DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
259 const std::map<std::string, UTF8>* aProperties = nullptr );
260
285 virtual void GetLibraryOptions( std::map<std::string, UTF8>* aListToAppendTo ) const override;
286
290 virtual bool SupportsSubLibraries() const { return false; }
291
304 virtual void GetSubLibraryNames( std::vector<wxString>& aNames ) {}
305
315 virtual wxString GetSubLibraryDescription( const wxString& aName ) { return wxEmptyString; }
316
326 virtual void GetAvailableSymbolFields( std::vector<wxString>& aNames ) {}
327
340 virtual void GetDefaultSymbolFields( std::vector<wxString>& aNames )
341 {
342 return GetAvailableSymbolFields( aNames );
343 }
344
353 virtual const wxString& GetError() const;
354
360
361 //-----</PUBLIC SCH_IO API>------------------------------------------------
362
363
364 /* The compiler writes the "zero argument" constructor for a SCH_IO
365 automatically if you do not provide one. If you decide you need to
366 provide a zero argument constructor of your own design, that is allowed.
367 It must be public, and it is what the SCH_IO_MGR uses. Parameters may be
368 passed into a SCH_IO via the PROPERTIES variable for any of the public
369 API functions which take one.
370 */
371 virtual ~SCH_IO() { }
372
373protected:
374
375 SCH_IO( const wxString& aName ) : IO_BASE( aName )
376 {}
377};
378
379
380#endif // SCH_IO_H_
IO_BASE()=delete
Define a library symbol object.
Definition lib_symbol.h:85
Holds all the data relating to one schematic.
Definition schematic.h:88
virtual void EnumerateSymbolLib(wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr)
Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.
Definition sch_io.cpp:82
virtual bool SupportsSubLibraries() const
Definition sch_io.h:290
virtual bool CanReadSchematicFile(const wxString &aFileName) const
Checks if this SCH_IO can read the specified schematic file.
Definition sch_io.cpp:45
virtual int GetModifyHash() const =0
Return the modification hash from the library cache.
SCH_IO(const wxString &aName)
Definition sch_io.h:375
virtual SCH_SHEET * LoadSchematicFile(const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const std::map< std::string, UTF8 > *aProperties=nullptr)
Load information from some input file format that this SCH_IO implementation knows about,...
Definition sch_io.cpp:67
virtual void SaveSymbol(const wxString &aLibraryPath, const LIB_SYMBOL *aSymbol, const std::map< std::string, UTF8 > *aProperties=nullptr)
Write aSymbol to an existing library located at aLibraryPath.
Definition sch_io.cpp:108
virtual void GetAvailableSymbolFields(std::vector< wxString > &aNames)
Retrieves a list of (custom) field names that are present on symbols in this library.
Definition sch_io.h:326
virtual void DeleteSymbol(const wxString &aLibraryPath, const wxString &aSymbolName, const std::map< std::string, UTF8 > *aProperties=nullptr)
Delete the entire LIB_SYMBOL associated with aAliasName from the library aLibraryPath.
Definition sch_io.cpp:116
virtual void SaveLibrary(const wxString &aFileName, const std::map< std::string, UTF8 > *aProperties=nullptr)
Definition sch_io.cpp:61
virtual LIB_SYMBOL * LoadSymbol(const wxString &aLibraryPath, const wxString &aPartName, const std::map< std::string, UTF8 > *aProperties=nullptr)
Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this...
Definition sch_io.cpp:100
virtual void GetLibraryOptions(std::map< std::string, UTF8 > *aListToAppendTo) const override
Append supported SCH_IO options to aListToAppenTo along with internationalized descriptions.
Definition sch_io.cpp:124
virtual ~SCH_IO()
Definition sch_io.h:371
virtual void SetLibraryManagerAdapter(SYMBOL_LIBRARY_ADAPTER *aAdapter)
Some library plugins need to interface with other loaded libraries.
Definition sch_io.h:359
virtual void SaveSchematicFile(const wxString &aFileName, SCH_SHEET *aSheet, SCHEMATIC *aSchematic, const std::map< std::string, UTF8 > *aProperties=nullptr)
Write aSchematic to a storage file in a format that this SCH_IO implementation knows about,...
Definition sch_io.cpp:74
virtual const wxString & GetError() const
Return an error string to the caller.
Definition sch_io.cpp:139
virtual wxString GetSubLibraryDescription(const wxString &aName)
Gets a description of a sublibrary.
Definition sch_io.h:315
virtual void GetDefaultSymbolFields(std::vector< wxString > &aNames)
Retrieves a list of (custom) field names that should be shown by default for this library in the symb...
Definition sch_io.h:340
virtual const IO_BASE::IO_FILE_DESC GetSchematicFileDesc() const
Returns schematic file description for the SCH_IO.
Definition sch_io.cpp:39
virtual void GetSubLibraryNames(std::vector< wxString > &aNames)
Retrieves a list of sub-libraries in this library.
Definition sch_io.h:304
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition sch_sheet.h:47
An interface to the global shared library manager that is schematic-specific and linked to one projec...
Some functions to handle hotkeys in KiCad.
Container that describes file type info.
Definition io_base.h:45