KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_plugin.cpp
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 (C) 2016-2021 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 2
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#include <string_utf8_map.h>
24
25#include <sch_io_mgr.h>
26#include <wx/translation.h>
27
28#define FMT_UNIMPLEMENTED wxT( "Plugin \"%s\" does not implement the \"%s\" function." )
29#define NOT_IMPLEMENTED( aCaller ) \
30 THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, \
31 GetName().GetData(), \
32 wxString::FromUTF8( aCaller ).GetData() ) );
33
34
35void SCH_PLUGIN::SaveLibrary( const wxString& aFileName, const STRING_UTF8_MAP* aProperties )
36{
37 NOT_IMPLEMENTED( __FUNCTION__ );
38}
39
40
41SCH_SHEET* SCH_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchematic,
42 SCH_SHEET* aAppendToMe, const STRING_UTF8_MAP* aProperties )
43{
44 NOT_IMPLEMENTED( __FUNCTION__ );
45}
46
47
48void SCH_PLUGIN::Save( const wxString& aFileName, SCH_SHEET* aSheet, SCHEMATIC* aSchematic,
49 const STRING_UTF8_MAP* aProperties )
50{
51 // not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
52 NOT_IMPLEMENTED( __FUNCTION__ );
53}
54
55
56void SCH_PLUGIN::EnumerateSymbolLib( wxArrayString& aAliasNameList,
57 const wxString& aLibraryPath,
58 const STRING_UTF8_MAP* aProperties )
59{
60 // not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
61 NOT_IMPLEMENTED( __FUNCTION__ );
62}
63
64
65void SCH_PLUGIN::EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
66 const wxString& aLibraryPath,
67 const STRING_UTF8_MAP* aProperties )
68{
69 // not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
70 NOT_IMPLEMENTED( __FUNCTION__ );
71}
72
73
74LIB_SYMBOL* SCH_PLUGIN::LoadSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
75 const STRING_UTF8_MAP* aProperties )
76{
77 // not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
78 NOT_IMPLEMENTED( __FUNCTION__ );
79}
80
81
82void SCH_PLUGIN::SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
83 const STRING_UTF8_MAP* aProperties )
84{
85 // not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
86 NOT_IMPLEMENTED( __FUNCTION__ );
87}
88
89
90void SCH_PLUGIN::DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
91 const STRING_UTF8_MAP* aProperties )
92{
93 // not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
94 NOT_IMPLEMENTED( __FUNCTION__ );
95}
96
97
98void SCH_PLUGIN::CreateSymbolLib( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
99{
100 // not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
101 NOT_IMPLEMENTED( __FUNCTION__ );
102}
103
104
105bool SCH_PLUGIN::DeleteSymbolLib( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
106{
107 // not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
108 NOT_IMPLEMENTED( __FUNCTION__ );
109}
110
111
112bool SCH_PLUGIN::IsSymbolLibWritable( const wxString& aLibraryPath )
113{
114 // not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
115 NOT_IMPLEMENTED( __FUNCTION__ );
116}
117
118
119void SCH_PLUGIN::SymbolLibOptions( STRING_UTF8_MAP* aListToAppendTo ) const
120{
121 // Empty for most plugins
122 //
123 // To add a new option override and use example code below:
124 //
125 //(*aListToAppendTo)["new_option_name"] = UTF8( _(
126 // "A nice descrtiption with possibility for <b>bold</b> and other formatting."
127 // ) );
128}
129
130
131bool SCH_PLUGIN::CheckHeader( const wxString& aFileName )
132{
133 // not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
134 NOT_IMPLEMENTED( __FUNCTION__ );
135}
136
137
138const wxString& SCH_PLUGIN::GetError() const
139{
140 // not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
141 NOT_IMPLEMENTED( __FUNCTION__ );
142}
Define a library symbol object.
Definition: lib_symbol.h:99
Holds all the data relating to one schematic.
Definition: schematic.h:72
virtual void EnumerateSymbolLib(wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.
Definition: sch_plugin.cpp:56
virtual void SaveSymbol(const wxString &aLibraryPath, const LIB_SYMBOL *aSymbol, const STRING_UTF8_MAP *aProperties=nullptr)
Write aSymbol to an existing library located at aLibraryPath.
Definition: sch_plugin.cpp:82
virtual void DeleteSymbol(const wxString &aLibraryPath, const wxString &aSymbolName, const STRING_UTF8_MAP *aProperties=nullptr)
Delete the entire LIB_SYMBOL associated with aAliasName from the library aLibraryPath.
Definition: sch_plugin.cpp:90
virtual void SaveLibrary(const wxString &aFileName, const STRING_UTF8_MAP *aProperties=nullptr)
Definition: sch_plugin.cpp:35
virtual void SymbolLibOptions(STRING_UTF8_MAP *aListToAppendTo) const
Append supported SCH_PLUGIN options to aListToAppenTo along with internationalized descriptions.
Definition: sch_plugin.cpp:119
virtual LIB_SYMBOL * LoadSymbol(const wxString &aLibraryPath, const wxString &aPartName, const STRING_UTF8_MAP *aProperties=nullptr)
Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this...
Definition: sch_plugin.cpp:74
virtual const wxString & GetError() const
Return an error string to the caller.
Definition: sch_plugin.cpp:138
virtual void CreateSymbolLib(const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
Create a new empty symbol library at aLibraryPath.
Definition: sch_plugin.cpp:98
virtual void Save(const wxString &aFileName, SCH_SHEET *aSheet, SCHEMATIC *aSchematic, const STRING_UTF8_MAP *aProperties=nullptr)
Write aSchematic to a storage file in a format that this SCH_PLUGIN implementation knows about,...
Definition: sch_plugin.cpp:48
virtual SCH_SHEET * Load(const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const STRING_UTF8_MAP *aProperties=nullptr)
Load information from some input file format that this SCH_PLUGIN implementation knows about,...
Definition: sch_plugin.cpp:41
virtual bool DeleteSymbolLib(const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
Delete an existing symbol library and returns true if successful, or if library does not exist return...
Definition: sch_plugin.cpp:105
virtual bool CheckHeader(const wxString &aFileName)
Return true if the first line in aFileName begins with the expected header.
Definition: sch_plugin.cpp:131
virtual bool IsSymbolLibWritable(const wxString &aLibraryPath)
Return true if the library at aLibraryPath is writable.
Definition: sch_plugin.cpp:112
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:57
A name/value tuple with unique names and optional values.
#define NOT_IMPLEMENTED(aCaller)
Definition: sch_plugin.cpp:29