2016-07-06 09:22:56 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2016 CERN
|
2023-04-22 20:17:08 +00:00
|
|
|
* Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
|
|
|
* @author Wayne Stambaugh <stambaughw@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 3
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2023-12-19 17:39:26 +00:00
|
|
|
#ifndef SCH_IO_H_
|
|
|
|
#define SCH_IO_H_
|
2023-08-26 19:28:53 +00:00
|
|
|
|
2023-12-24 04:31:22 +00:00
|
|
|
#include <io/io_base.h>
|
2023-12-19 17:39:26 +00:00
|
|
|
#include <sch_io/sch_io_mgr.h>
|
2017-05-08 15:11:14 +00:00
|
|
|
#include <import_export.h>
|
2016-07-06 09:22:56 +00:00
|
|
|
#include <map>
|
2017-06-26 11:13:43 +00:00
|
|
|
#include <enum_vector.h>
|
2021-03-31 21:33:30 +00:00
|
|
|
#include <reporter.h>
|
2023-08-26 19:28:53 +00:00
|
|
|
#include <i18n_utility.h>
|
2023-09-08 02:29:40 +00:00
|
|
|
#include <wx/arrstr.h>
|
2016-07-06 09:22:56 +00:00
|
|
|
|
|
|
|
/**
|
2017-06-16 00:31:42 +00:00
|
|
|
* Base class that schematic file and library loading and saving plugins should derive from.
|
2023-09-08 02:29:40 +00:00
|
|
|
* Implementations can provide either LoadSchematicFile() or SaveSchematicFile() functions,
|
2023-12-19 17:39:26 +00:00
|
|
|
* or both. SCH_IOs throw exceptions, so it is best that you wrap your calls to these
|
2016-07-06 09:22:56 +00:00
|
|
|
* functions in a try catch block. Plugins throw exceptions because it is illegal
|
|
|
|
* for them to have any user interface calls in them whatsoever, i.e. no windowing
|
|
|
|
* or screen printing at all.
|
|
|
|
*
|
|
|
|
* <pre>
|
|
|
|
* try
|
|
|
|
* {
|
2023-08-26 19:28:53 +00:00
|
|
|
* SCH_IO_MGR::LoadSchematicFile(...);
|
2016-07-06 09:22:56 +00:00
|
|
|
* or
|
2023-08-26 19:28:53 +00:00
|
|
|
* SCH_IO_MGR::SaveSchematicFile(...);
|
2016-07-06 09:22:56 +00:00
|
|
|
* }
|
|
|
|
* catch( const IO_ERROR& ioe )
|
|
|
|
* {
|
|
|
|
* // grab text from ioe, show in error window.
|
|
|
|
* }
|
|
|
|
* </pre>
|
|
|
|
*/
|
2023-12-24 04:31:22 +00:00
|
|
|
class SCH_IO : public IO_BASE
|
2016-07-06 09:22:56 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2023-12-19 17:39:26 +00:00
|
|
|
//-----<PUBLIC SCH_IO API>-------------------------------------------------
|
2016-07-06 09:22:56 +00:00
|
|
|
|
|
|
|
/**
|
2023-12-19 17:39:26 +00:00
|
|
|
* Returns schematic file description for the #SCH_IO.
|
2023-08-26 19:28:53 +00:00
|
|
|
*/
|
2023-12-27 16:34:59 +00:00
|
|
|
virtual const IO_BASE::IO_FILE_DESC GetSchematicFileDesc() const;
|
2016-07-06 09:22:56 +00:00
|
|
|
|
2020-02-28 14:03:09 +00:00
|
|
|
/**
|
2023-12-19 17:39:26 +00:00
|
|
|
* Checks if this SCH_IO can read the specified schematic file.
|
2023-08-26 19:28:53 +00:00
|
|
|
* If not overriden, extension check is used.
|
2020-02-28 14:03:09 +00:00
|
|
|
*/
|
2023-08-26 19:28:53 +00:00
|
|
|
virtual bool CanReadSchematicFile( const wxString& aFileName ) const;
|
|
|
|
|
2016-10-24 23:18:50 +00:00
|
|
|
/**
|
2017-06-16 00:31:42 +00:00
|
|
|
* Return the modification hash from the library cache.
|
2016-10-24 23:18:50 +00:00
|
|
|
*
|
|
|
|
* @note This is temporary until the new s-expr file format is implement. The new file
|
|
|
|
* format will embed symbols instead of referencing them from the library. This
|
|
|
|
* function can be removed when the new file format is implemented.
|
|
|
|
*
|
|
|
|
* @return the modification hash of the library cache.
|
|
|
|
*/
|
|
|
|
virtual int GetModifyHash() const = 0;
|
|
|
|
|
2022-11-06 16:51:52 +00:00
|
|
|
virtual void SaveLibrary( const wxString& aFileName, const STRING_UTF8_MAP* aProperties = nullptr );
|
2017-01-27 15:56:36 +00:00
|
|
|
|
2016-07-06 09:22:56 +00:00
|
|
|
/**
|
2023-12-19 17:39:26 +00:00
|
|
|
* Load information from some input file format that this #SCH_IO implementation
|
2017-06-16 00:31:42 +00:00
|
|
|
* knows about, into either a new #SCH_SHEET or an existing one. This may be used to load an
|
|
|
|
* entire new #SCH_SHEET, or to augment an existing one if \a aAppendToMe is not NULL.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
|
|
|
* @param aFileName is the name of the file to use as input and may be foreign in
|
2016-10-09 12:29:44 +00:00
|
|
|
* nature or native in nature.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
2021-06-14 18:00:08 +00:00
|
|
|
* @param aKiway is the #KIWAY object used to access the symbol libraries loaded
|
2017-06-16 00:31:42 +00:00
|
|
|
* by the project.
|
|
|
|
*
|
|
|
|
* @param aAppendToMe is an existing #SCH_SHEET to append to, but if NULL then this means
|
2016-10-09 12:29:44 +00:00
|
|
|
* "do not append, rather load anew".
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
2016-10-09 12:29:44 +00:00
|
|
|
* @param aProperties is 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.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
2017-06-16 00:31:42 +00:00
|
|
|
* @return the successfully loaded schematic, or the same one as \a aAppendToMe
|
|
|
|
* if \a aAppendToMe was not NULL, and the caller owns it.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
2016-10-09 12:29:44 +00:00
|
|
|
* @throw IO_ERROR if 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.
|
2016-07-06 09:22:56 +00:00
|
|
|
*/
|
2023-08-26 19:28:53 +00:00
|
|
|
virtual SCH_SHEET* LoadSchematicFile( const wxString& aFileName, SCHEMATIC* aSchematic,
|
|
|
|
SCH_SHEET* aAppendToMe = nullptr,
|
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2016-07-06 09:22:56 +00:00
|
|
|
|
|
|
|
/**
|
2023-12-19 17:39:26 +00:00
|
|
|
* Write \a aSchematic to a storage file in a format that this #SCH_IO implementation
|
2017-06-16 00:31:42 +00:00
|
|
|
* knows about, or it can be used to write a portion of \a aSchematic to a special kind
|
|
|
|
* of export file.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
|
|
|
* @param aFileName is the name of a file to save to on disk.
|
|
|
|
*
|
2020-05-21 03:00:23 +00:00
|
|
|
* @param aSheet is the class #SCH_SHEET in memory document tree from which to extract
|
2016-10-09 12:29:44 +00:00
|
|
|
* information when writing to \a aFileName. The caller continues to
|
|
|
|
* own the SCHEMATIC, and the plugin should refrain from modifying the
|
|
|
|
* SCHEMATIC if possible.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
2020-05-21 03:00:23 +00:00
|
|
|
* @param aSchematic is the #SCHEMATIC object used to access any schematic-wide or project
|
|
|
|
* information needed to save the document.
|
2017-06-16 00:31:42 +00:00
|
|
|
*
|
2016-10-09 12:29:44 +00:00
|
|
|
* @param aProperties is 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
|
2020-04-26 20:53:29 +00:00
|
|
|
* should expect it to be optionally NULL. Set the
|
|
|
|
* #PropSaveCurrentSheetOnly property to only save the current sheet.
|
2021-03-25 14:07:16 +00:00
|
|
|
* Otherwise, all hierarchical sheets are saved.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
|
|
|
* @throw IO_ERROR if there is a problem saving or exporting.
|
|
|
|
*/
|
2023-08-26 19:28:53 +00:00
|
|
|
virtual void SaveSchematicFile( const wxString& aFileName, SCH_SHEET* aSheet,
|
|
|
|
SCHEMATIC* aSchematic,
|
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2016-07-06 09:22:56 +00:00
|
|
|
|
|
|
|
/**
|
2021-06-10 18:51:46 +00:00
|
|
|
* Populate a list of #LIB_SYMBOL alias names contained within the library \a aLibraryPath.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
2021-06-10 18:51:46 +00:00
|
|
|
* @param aSymbolNameList is an array to populate with the #LIB_SYMBOL names associated with
|
2019-11-06 19:15:42 +00:00
|
|
|
* the library.
|
2017-06-16 00:31:42 +00:00
|
|
|
*
|
2016-07-06 09:22:56 +00:00
|
|
|
* @param aLibraryPath is a locator for the "library", usually a directory, file,
|
2021-06-10 18:51:46 +00:00
|
|
|
* or URL containing one or more #LIB_SYMBOL objects.
|
2017-06-16 00:31:42 +00:00
|
|
|
*
|
2016-08-18 23:23:10 +00:00
|
|
|
* @param aProperties is an associative array that can be used to tell the plugin anything
|
2017-06-16 00:31:42 +00:00
|
|
|
* needed about how to perform with respect to \a aLibraryPath. The
|
2016-08-18 23:23:10 +00:00
|
|
|
* caller continues to own this object (plugin may not delete it), and
|
|
|
|
* plugins should expect it to be optionally NULL.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
2016-08-18 23:23:10 +00:00
|
|
|
* @throw IO_ERROR if the library cannot be found, the part library cannot be loaded.
|
2016-07-06 09:22:56 +00:00
|
|
|
*/
|
2021-03-25 14:07:16 +00:00
|
|
|
virtual void EnumerateSymbolLib( wxArrayString& aSymbolNameList, const wxString& aLibraryPath,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2016-08-18 23:23:10 +00:00
|
|
|
|
2017-02-24 16:09:27 +00:00
|
|
|
/**
|
2021-06-10 18:51:46 +00:00
|
|
|
* Populate a list of #LIB_SYMBOL aliases contained within the library \a aLibraryPath.
|
2017-02-24 16:09:27 +00:00
|
|
|
*
|
2021-03-25 14:07:16 +00:00
|
|
|
* @note It is the responsibility of the caller to delete the returned object from the heap.
|
2019-11-06 19:15:42 +00:00
|
|
|
* Failure to do this will result in memory leaks.
|
|
|
|
*
|
2021-06-10 18:51:46 +00:00
|
|
|
* @param aSymbolList is an array to populate with the #LIB_SYMBOL pointers associated with
|
2019-11-06 19:15:42 +00:00
|
|
|
* the library.
|
2017-06-16 00:31:42 +00:00
|
|
|
*
|
2017-02-24 16:09:27 +00:00
|
|
|
* @param aLibraryPath is a locator for the "library", usually a directory, file,
|
2021-06-10 18:51:46 +00:00
|
|
|
* or URL containing one or more #LIB_SYMBOL objects.
|
2017-06-16 00:31:42 +00:00
|
|
|
*
|
2017-02-24 16:09:27 +00:00
|
|
|
* @param aProperties is an associative array that can be used to tell the plugin anything
|
2017-06-16 00:31:42 +00:00
|
|
|
* needed about how to perform with respect to \a aLibraryPath. The
|
2017-02-24 16:09:27 +00:00
|
|
|
* caller continues to own this object (plugin may not delete it), and
|
|
|
|
* plugins should expect it to be optionally NULL.
|
|
|
|
*
|
|
|
|
* @throw IO_ERROR if the library cannot be found, the part library cannot be loaded.
|
|
|
|
*/
|
2021-06-10 18:51:46 +00:00
|
|
|
virtual void EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
|
2021-03-25 14:07:16 +00:00
|
|
|
const wxString& aLibraryPath,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2017-02-24 16:09:27 +00:00
|
|
|
|
2016-07-06 09:22:56 +00:00
|
|
|
/**
|
2021-06-10 18:51:46 +00:00
|
|
|
* Load a #LIB_SYMBOL object having \a aPartName from the \a aLibraryPath containing
|
2023-12-19 17:39:26 +00:00
|
|
|
* a library format that this #SCH_IO knows about.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
|
|
|
* @param aLibraryPath is a locator for the "library", usually a directory, file,
|
2016-09-23 17:28:38 +00:00
|
|
|
* or URL containing several symbols.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
2021-06-10 18:51:46 +00:00
|
|
|
* @param aPartName is the name of the #LIB_SYMBOL to load.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
2016-09-03 18:28:17 +00:00
|
|
|
* @param aProperties is 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.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
2019-11-06 19:15:42 +00:00
|
|
|
* @return the part created on the heap if found caller shares it or NULL if not found.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
2017-06-16 00:31:42 +00:00
|
|
|
* @throw IO_ERROR if the library cannot be found or read. No exception
|
|
|
|
* is thrown in the case where aAliasName cannot be found.
|
2016-07-06 09:22:56 +00:00
|
|
|
*/
|
2021-06-10 18:51:46 +00:00
|
|
|
virtual LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, const wxString& aPartName,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2016-07-06 09:22:56 +00:00
|
|
|
|
|
|
|
/**
|
2021-06-10 18:51:46 +00:00
|
|
|
* Write \a aSymbol to an existing library located at \a aLibraryPath. If a #LIB_SYMBOL
|
2016-10-05 23:28:56 +00:00
|
|
|
* by the same name already exists or there are any conflicting alias names, the new
|
2021-06-10 18:51:46 +00:00
|
|
|
* #LIB_SYMBOL will silently overwrite any existing aliases and/or part because libraries
|
2016-10-05 23:28:56 +00:00
|
|
|
* cannot have duplicate alias names. It is the responsibility of the caller to check
|
|
|
|
* the library for conflicts before saving.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
|
|
|
* @param aLibraryPath is a locator for the "library", usually a directory, file,
|
2016-09-23 17:28:38 +00:00
|
|
|
* or URL containing several symbols.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
2016-09-17 17:31:58 +00:00
|
|
|
* @param aSymbol is what to store in the library. The library is refreshed and the
|
2021-06-10 18:51:46 +00:00
|
|
|
* caller must update any #LIB_SYMBOL pointers that may have changed.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
|
|
|
* @param aProperties is an associative array that can be used to tell the
|
2016-09-17 17:31:58 +00:00
|
|
|
* saver how to save the symbol, 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.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
2016-10-05 23:28:56 +00:00
|
|
|
* @throw IO_ERROR if there is a problem saving.
|
2016-07-06 09:22:56 +00:00
|
|
|
*/
|
2021-06-10 18:51:46 +00:00
|
|
|
virtual void SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2016-07-06 09:22:56 +00:00
|
|
|
|
2016-09-29 22:31:43 +00:00
|
|
|
/**
|
2021-06-10 18:51:46 +00:00
|
|
|
* Delete the entire #LIB_SYMBOL associated with \a aAliasName from the library
|
2017-06-16 00:31:42 +00:00
|
|
|
* \a aLibraryPath.
|
2016-09-29 22:31:43 +00:00
|
|
|
*
|
|
|
|
* @param aLibraryPath is a locator for the "library", usually a directory, file,
|
|
|
|
* or URL containing several symbols.
|
|
|
|
*
|
2021-06-10 18:51:46 +00:00
|
|
|
* @param aSymbolName is the name of a #LIB_SYMBOL associated with it's root #LIB_SYMBOL
|
2019-11-06 19:15:42 +00:00
|
|
|
* object to delete from the specified library.
|
2016-09-29 22:31:43 +00:00
|
|
|
*
|
|
|
|
* @param aProperties is 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.
|
|
|
|
*
|
|
|
|
* @throw IO_ERROR if there is a problem finding the alias or the library or deleting it.
|
|
|
|
*/
|
2019-11-06 19:15:42 +00:00
|
|
|
virtual void DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2016-09-29 22:31:43 +00:00
|
|
|
|
2016-07-06 09:22:56 +00:00
|
|
|
/**
|
2023-12-19 17:39:26 +00:00
|
|
|
* Append supported #SCH_IO options to \a aListToAppenTo along with internationalized
|
|
|
|
* descriptions. Options are typically appended so that a derived SCH_IO can call
|
2016-10-09 12:29:44 +00:00
|
|
|
* its base class function by the same name first, thus inheriting options declared there.
|
|
|
|
* (Some base class options could pertain to all Symbol*() functions in all derived
|
2023-12-19 17:39:26 +00:00
|
|
|
* SCH_IOs.) Note that since aListToAppendTo is a PROPERTIES object, all options
|
2016-10-09 12:29:44 +00:00
|
|
|
* will be unique and last guy wins.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
|
|
|
* @param aListToAppendTo holds a tuple of
|
|
|
|
* <dl>
|
|
|
|
* <dt>option</dt>
|
|
|
|
* <dd>This eventually is what shows up into the fp-lib-table "options"
|
|
|
|
* field, possibly combined with others.</dd>
|
|
|
|
* <dt>internationalized description</dt>
|
2023-05-28 19:10:07 +00:00
|
|
|
* <dd>The internationalized description is displayed in DIALOG_PLUGIN_OPTIONS.
|
2016-07-06 09:22:56 +00:00
|
|
|
* It may be multi-line and be quite explanatory of the option.</dd>
|
|
|
|
* </dl>
|
|
|
|
* <br>
|
2017-06-16 00:31:42 +00:00
|
|
|
* In the future perhaps \a aListToAppendTo evolves to something capable of also
|
2016-07-06 09:22:56 +00:00
|
|
|
* 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
|
2023-12-19 17:39:26 +00:00
|
|
|
* #SCH_IO, which has been avoided to date.
|
2016-07-06 09:22:56 +00:00
|
|
|
*/
|
2023-12-27 00:25:41 +00:00
|
|
|
virtual void GetLibraryOptions( STRING_UTF8_MAP* aListToAppendTo ) const override;
|
2016-07-06 09:22:56 +00:00
|
|
|
|
2022-08-27 03:52:56 +00:00
|
|
|
/**
|
|
|
|
* @return true if this plugin supports libraries that contain sub-libraries.
|
|
|
|
*/
|
|
|
|
virtual bool SupportsSubLibraries() const { return false; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves a list of sub-libraries in this library.
|
|
|
|
*
|
|
|
|
* Some types of symbol library support sub-libraries, which are a single-level organizational
|
|
|
|
* hierarchy that is implementation-defined per plugin. Most of KiCad ignores sub-libraries and
|
|
|
|
* treats the hierarchy between library and symbol as flat, but the sub-libraries are used for
|
|
|
|
* sorting and grouping symbols in the symbol chooser.
|
|
|
|
*
|
|
|
|
* Has no effect if SupportsSubLibraries() returns false.
|
|
|
|
*
|
|
|
|
* @param aNames will be filled with a list of sub-libraries within this symbol library
|
|
|
|
*/
|
|
|
|
virtual void GetSubLibraryNames( std::vector<wxString>& aNames ) {}
|
|
|
|
|
2022-08-28 23:02:12 +00:00
|
|
|
/**
|
|
|
|
* Retrieves a list of (custom) field names that are present on symbols in this library.
|
|
|
|
* The plugin is responsible for guaranteeing that this list contains the set of unique
|
|
|
|
* custom field names present on any symbols contained in the library.
|
|
|
|
*
|
|
|
|
* The required KiCad fields are not included in this list.
|
|
|
|
*
|
|
|
|
* @param aNames will be filled with any custom fields present in this library.
|
|
|
|
*/
|
|
|
|
virtual void GetAvailableSymbolFields( std::vector<wxString>& aNames ) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves a list of (custom) field names that should be shown by default for this library
|
|
|
|
* in the symbol chooser. This list should be a subset of the result returned by
|
|
|
|
* GetAvailableSymbolFields().
|
|
|
|
*
|
|
|
|
* The preference for which fields to hide and show for a given library is stored on a
|
|
|
|
* per-library basis in a user's preferences (or in the project local settings for a project-
|
|
|
|
* local library). The set of fields returned by GetDefaultSymbolFields() will be used if this
|
|
|
|
* preference is missing.
|
|
|
|
*
|
|
|
|
* @param aNames will be filled with the custom field names that should be shown by default
|
|
|
|
*/
|
|
|
|
virtual void GetDefaultSymbolFields( std::vector<wxString>& aNames )
|
|
|
|
{
|
|
|
|
return GetAvailableSymbolFields( aNames );
|
|
|
|
}
|
|
|
|
|
2017-12-07 00:10:45 +00:00
|
|
|
/**
|
|
|
|
* Return an error string to the caller.
|
|
|
|
*
|
|
|
|
* This is useful for schematic loaders that can load partial schematics where throwing
|
|
|
|
* an exception would be problematic such as the KiCad legacy plugin.
|
|
|
|
*
|
|
|
|
* @return an unformatted string containing errors if any.
|
|
|
|
*/
|
|
|
|
virtual const wxString& GetError() const;
|
|
|
|
|
2022-05-29 19:29:32 +00:00
|
|
|
/**
|
|
|
|
* Some library plugins need to have access to their parent library table.
|
|
|
|
* @param aTable is the table this plugin is registered within.
|
|
|
|
*/
|
|
|
|
virtual void SetLibTable( SYMBOL_LIB_TABLE* aTable ) {}
|
|
|
|
|
2023-12-19 17:39:26 +00:00
|
|
|
//-----</PUBLIC SCH_IO API>------------------------------------------------
|
2016-07-06 09:22:56 +00:00
|
|
|
|
|
|
|
|
2023-12-19 17:39:26 +00:00
|
|
|
/* The compiler writes the "zero argument" constructor for a SCH_IO
|
2016-07-06 09:22:56 +00:00
|
|
|
automatically if you do not provide one. If you decide you need to
|
|
|
|
provide a zero argument constructor of your own design, that is allowed.
|
|
|
|
It must be public, and it is what the SCH_IO_MGR uses. Parameters may be
|
2023-12-19 17:39:26 +00:00
|
|
|
passed into a SCH_IO via the PROPERTIES variable for any of the public
|
2016-07-06 09:22:56 +00:00
|
|
|
API functions which take one.
|
|
|
|
*/
|
2023-12-19 17:39:26 +00:00
|
|
|
virtual ~SCH_IO() { }
|
2016-07-06 09:22:56 +00:00
|
|
|
|
2023-12-24 04:31:22 +00:00
|
|
|
protected:
|
|
|
|
|
|
|
|
SCH_IO( const wxString& aName ) : IO_BASE( aName )
|
|
|
|
{}
|
2016-07-06 09:22:56 +00:00
|
|
|
};
|
|
|
|
|
2023-12-19 17:39:26 +00:00
|
|
|
|
|
|
|
#endif // SCH_IO_H_
|