31 #ifndef CLASS_LIBRARY_H 32 #define CLASS_LIBRARY_H 35 #include <boost/ptr_container/ptr_vector.hpp> 36 #include <wx/filename.h> 54 #define LIB_VERSION_MAJOR 2 55 #define LIB_VERSION_MINOR 4 58 #define LIBFILE_IDENT "EESchema-LIBRARY Version" 60 #define LIB_VERSION( major, minor ) ( major * 100 + minor ) 62 #define IS_LIB_CURRENT_VERSION( major, minor ) \ 64 LIB_VERSION( major1, minor1 ) == \ 65 LIB_VERSION( LIB_VERSION_MAJOR, LIB_VERSION_MINOR) \ 74 #define USE_OLD_DOC_FILE_FORMAT( major, minor ) \ 75 ( LIB_VERSION( major, minor ) <= LIB_VERSION( 2, 4 ) ) 155 static wxString
dummy;
174 bool operator() (
const wxString& aItem1,
const wxString& aItem2 )
const 176 return aItem1 < aItem2;
240 wxString* aPaths, wxArrayString* aNames=
NULL );
248 static const wxString
CacheName(
const wxString& aFullProjectFilename );
296 const wxString& aLibraryName = wxEmptyString );
325 SCH_IO_MGR::SCH_FILE_T aPluginType = SCH_IO_MGR::SCH_LEGACY );
337 void Create(
const wxString& aFileName = wxEmptyString );
354 void Save(
bool aSaveDocFile =
true );
373 void GetParts( std::vector<LIB_PART*>& aPart)
const;
468 #endif // CLASS_LIBRARY_H const wxString GetName() const
Return the file name without path or extension.
wxString GetFullFileName() const
Return the full file library name with path and extension.
int m_mod_hash
incremented each time library is changed.
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
LIB_PART * ReplacePart(LIB_PART *aOldPart, LIB_PART *aNewPart)
Replace an existing part entry in the library.
SCH_LIB_TYPE type
Library type indicator.
std::unique_ptr< SCH_PLUGIN > m_plugin
static void LibNamesAndPaths(PROJECT *aProject, bool doSave, wxString *aPaths, wxArrayString *aNames=NULL)
Save or load the names of the currently configured part libraries (without paths).
void FilterPowerParts(bool aFilterEnable)
set the filtering of power parts
Container for project specific data.
const wxString & GetLibSource() const
bool m_filterPowerParts
true to filter (show only) power parts
void LoadAllLibraries(PROJECT *aProject, bool aShowProgress=true)
Load all of the project's libraries into this container, which should be cleared before calling it.
static int s_modify_generation
helper for GetModifyHash()
void Save(bool aSaveDocFile=true)
bool isModified
Library modification status.
PART_LIB * GetCacheLibrary()
void LoadFrom(const wxString &aLibName)
add a lib name to the allowed libraries
std::map< wxString, LIB_PART *, LibPartMapSort > LIB_PART_MAP
Part map used by part library object.
wxArrayString GetLibraryNames(bool aSorted=true)
Return the list of part library file names without path and extension.
int GetModifyHash()
Return the modification hash for all libraries.
wxString header
first line of loaded library.
void FindLibraryNearEntries(std::vector< LIB_PART * > &aCandidates, const wxString &aEntryName, const wxString &aLibraryName=wxEmptyString)
Search all libraries in the list for a LIB_PART using a case insensitive comparison.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
LIB_PART * RemovePart(LIB_PART *aEntry)
Safely remove aEntry from the library and return the next entry.
A logical library item identifier and consists of various portions much like a URI.
bool operator==(const PART_LIB &aLibrary, const wxString &aName)
Case insensitive library name comparison.
PART_LIB * FindLibrary(const wxString &aName)
Find a part library by aName.
static const wxString CacheName(const wxString &aFullProjectFilename)
Return the name of the cache library after potentially fixing it from an older naming scheme.
void GetPartNames(wxArrayString &aNames) const
Load a string array with the names of all the entries in this library.
std::vector< LIB_PART * > LIB_PARTS
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
void AddLib(const wxString &aLibName)
add a lib name to the allowed libraries
void EnableBuffering(bool aEnable=true)
SCH_IO_MGR::SCH_FILE_T GetPluginType() const
void ClearLibList()
Clear the allowed libraries list (allows all libs)
Base class that schematic file and library loading and saving plugins should derive from.
const wxString GetLogicalName() const
Return the logical name of the library.
wxDateTime timeStamp
Library save time and date.
PART_LIB * AddLibrary(const wxString &aFileName)
Allocate and adds a part library to the library list.
static PART_LIB * LoadLibrary(const wxString &aFileName)
Allocate and load a symbol library file.
Define a library symbol object.
boost::ptr_vector< PART_LIB > PART_LIBS_BASE
std::unique_ptr< PROPERTIES > m_properties
Library properties.
LIB_PART * FindLibPart(const LIB_ID &aLibId, const wxString &aLibraryName=wxEmptyString)
Search all libraries in the list for a part.
SCH_IO_MGR::SCH_FILE_T m_pluginType
bool GetFilterPowerParts() const
LIB_PART * FindPart(const wxString &aName) const
Find LIB_PART by aName.
wxArrayString m_allowedLibs
a list of lib names to list some libraries if empty: no filter
A SCH_PLUGIN derivation for loading schematic files created before the new s-expression file format.
wxFileName fileName
Library file name.
void GetParts(std::vector< LIB_PART * > &aPart) const
Load a vector with all the entries in this library.
A collection of PART_LIB objects.
void AddPart(LIB_PART *aPart)
Add aPart entry to library.
PART_LIB(SCH_LIB_TYPE aType, const wxString &aFileName, SCH_IO_MGR::SCH_FILE_T aPluginType=SCH_IO_MGR::SCH_LEGACY)
int versionMinor
Library minor version number.
bool operator()(const wxString &aItem1, const wxString &aItem2) const
const wxArrayString & GetAllowedLibList() const
PART_LIB * FindLibraryByFullFileName(const wxString &aFullFileName)
void SetPluginType(SCH_IO_MGR::SCH_FILE_T aPluginType)
A PROJECT can hold stuff it knows nothing about, in the form of _ELEM derivatives.
void SetFileName(const wxString &aFileName)
void Create(const wxString &aFileName=wxEmptyString)
Object used to load, save, search, and otherwise manipulate symbol library files.
int versionMajor
Library major version number.
bool operator!=(const PART_LIB &aLibrary, const wxString &aName)