Browse Source
Make footprint ID into a generic library ID.
Make footprint ID into a generic library ID.
Rename FPID to LIB_ID as is now used as a generic library identifier and is no longer specific to footprints. Remove all mention of footprint from the new LIB_ID doxygen comments and code. Rename files fpid.h and fpid.cpp to lib_id.h and lib_id.cpp. Rename fp_lib_table.keywords file to lib_table.keywords and adjust CMake build dependencies accordingly. Update all source files effected by the code and file name changes. Update .gitignore for file name changes.pull/3/merge
49 changed files with 451 additions and 437 deletions
-
4.gitignore
-
20common/CMakeLists.txt
-
8common/footprint_info.cpp
-
20common/fp_lib_table.cpp
-
76common/lib_id.cpp
-
0common/lib_table.keywords
-
8common/lib_table_base.cpp
-
4cvpcb/autosel.cpp
-
6cvpcb/autosel.h
-
10cvpcb/class_DisplayFootprintsFrame.cpp
-
2cvpcb/class_footprints_listbox.cpp
-
8cvpcb/cvpcb_mainframe.cpp
-
2cvpcb/cvpcb_mainframe.h
-
26cvpcb/readwrite_dlgs.cpp
-
8eeschema/class_libentry.h
-
26eeschema/symbol_lib_table.cpp
-
5eeschema/symbol_lib_table.h
-
5include/fp_lib_table.h
-
198include/fpid.h
-
216include/lib_id.h
-
8include/lib_table_base.h
-
14include/wxBasePcbFrame.h
-
6pcbnew/build_BOM_from_board.cpp
-
10pcbnew/class_module.h
-
4pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp
-
4pcbnew/dialogs/dialog_fp_lib_table.cpp
-
2pcbnew/eagle_plugin.cpp
-
8pcbnew/exporters/gen_modules_placefile.cpp
-
2pcbnew/github/github_plugin.cpp
-
4pcbnew/gpcb_plugin.cpp
-
4pcbnew/kicad_netlist_reader.cpp
-
7pcbnew/kicad_plugin.cpp
-
8pcbnew/legacy_netlist_reader.cpp
-
18pcbnew/legacy_plugin.cpp
-
18pcbnew/librairi.cpp
-
18pcbnew/loadcmp.cpp
-
16pcbnew/modview_frame.cpp
-
6pcbnew/muonde.cpp
-
14pcbnew/netlist.cpp
-
14pcbnew/netlist_reader.cpp
-
2pcbnew/netlist_reader.h
-
4pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp
-
24pcbnew/pcb_netlist.h
-
2pcbnew/pcb_parser.cpp
-
1pcbnew/pcbnew_config.cpp
-
2pcbnew/python/examples/createFPC40.py
-
2pcbnew/python/plugins/HelpfulFootprintWizardPlugin.py
-
4pcbnew/swig/pcbnew.i
-
10pcbnew/xchgmod.cpp
@ -1,198 +0,0 @@ |
|||
/* |
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> |
|||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net> |
|||
* Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors. |
|||
* |
|||
* 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 2 |
|||
* 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, you may find one here: |
|||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|||
* or you may search the http://www.gnu.org website for the version 2 license, |
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
#ifndef _FPID_H_ |
|||
#define _FPID_H_ |
|||
|
|||
#include <richio.h> |
|||
#include <utf8.h> |
|||
|
|||
/** |
|||
* Class FPID |
|||
* is a Logical Footprint ID and consists of various portions much like a URI. |
|||
* It is a container for the separated portions of a logical footprint id so they |
|||
* can be accessed individually. The various portions of an FPID are: |
|||
* logicalLibraryName (nick name), footprint name, and revision. The logical library |
|||
* name and the footprint name are mandatory. The revision is optional and currently is |
|||
* not used. |
|||
* |
|||
* Example FPID string: |
|||
* "smt:R_0805/rev0". |
|||
* |
|||
* <p> |
|||
* <ul> |
|||
* <li> "smt" is the logical library name used to look up library information saved in the |
|||
* #FP_LIB_TABLE. |
|||
* <li> "R" is the name of the footprint within the library. |
|||
* <li> "rev0" is the revision, which is optional. If missing then its |
|||
* / delimiter should also not be present. A revision must begin with |
|||
* "rev" and be followed by at least one or more decimal digits. |
|||
* </ul> |
|||
* |
|||
* @author Dick Hollenbeck |
|||
*/ |
|||
class FPID |
|||
{ |
|||
public: |
|||
|
|||
FPID() {} |
|||
|
|||
/** |
|||
* Constructor FPID |
|||
* takes \a aId string and parses it. A typical FPID string consists of a |
|||
* library nickname followed by a footprint name. |
|||
* e.g.: "smt:R_0805", or |
|||
* e.g.: "mylib:R_0805" |
|||
* |
|||
* @param aId is a string to be parsed into the FPID object. |
|||
*/ |
|||
FPID( const std::string& aId ) throw( PARSE_ERROR ); |
|||
|
|||
FPID( const wxString& aId ) throw( PARSE_ERROR ); |
|||
|
|||
/** |
|||
* Function Parse |
|||
* [re-]stuffs this FPID with the information from @a aId. |
|||
* |
|||
* @param aId is the string to populate the #FPID object. |
|||
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset into |
|||
* aId at which an error was detected. |
|||
*/ |
|||
int Parse( const UTF8& aId ); |
|||
|
|||
|
|||
/** |
|||
* Function GetLibNickname |
|||
* returns the logical library name portion of a FPID. |
|||
*/ |
|||
const UTF8& GetLibNickname() const |
|||
{ |
|||
return nickname; |
|||
} |
|||
|
|||
/** |
|||
* Function SetLibNickname |
|||
* overrides the logical footprint library name portion of the FPID to @a aNickname. |
|||
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset |
|||
* into the parameter at which an error was detected, usually because it |
|||
* contained '/' or ':'. |
|||
*/ |
|||
int SetLibNickname( const UTF8& aNickname ); |
|||
|
|||
/** |
|||
* Function GetFootprintName |
|||
* returns the footprint name, i.e. footprintName. |
|||
*/ |
|||
const UTF8& GetFootprintName() const { return footprint; } |
|||
|
|||
/** |
|||
* Function SetFootprintName |
|||
* overrides the footprint name portion of the FPID to @a aFootprintName |
|||
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset |
|||
* into the parameter at which an error was detected, usually because it |
|||
* contained '/'. |
|||
*/ |
|||
int SetFootprintName( const UTF8& aFootprintName ); |
|||
|
|||
int SetRevision( const UTF8& aRevision ); |
|||
|
|||
const UTF8& GetRevision() const { return revision; } |
|||
|
|||
UTF8 GetFootprintNameAndRev() const; |
|||
|
|||
/** |
|||
* Function Format |
|||
* returns the fully formatted text of the FPID. |
|||
*/ |
|||
UTF8 Format() const; |
|||
|
|||
/** |
|||
* Function Format |
|||
* returns a wxString in the proper format as an FPID for a combination of |
|||
* aLibNickname, aFootprintName, and aRevision. |
|||
* |
|||
* @throw PARSE_ERROR if any of the pieces are illegal. |
|||
static UTF8 Format( const UTF8& aLibNickname, const UTF8& aFootprintName, |
|||
const UTF8& aRevision = "" ) |
|||
throw( PARSE_ERROR ); |
|||
*/ |
|||
|
|||
/** |
|||
* Function IsValid |
|||
* @return true is the #FPID is valid. |
|||
* |
|||
* A valid #FPID must have both the footprint library nickname and the footprint name |
|||
* defined. The revision field is optional. |
|||
* |
|||
* @note A return value of true does not indicated that the #FPID is a valid #FP_LIB_TABLE |
|||
* entry. |
|||
*/ |
|||
bool IsValid() const { return !nickname.empty() && !footprint.empty(); } |
|||
|
|||
/** |
|||
* Function IsLegacy |
|||
* @return true if the #FPID only has the #footprint name defined. |
|||
*/ |
|||
bool IsLegacy() const { return nickname.empty() && !footprint.empty() && revision.empty(); } |
|||
|
|||
/** |
|||
* Function clear |
|||
* clears the contents of the library nickname, footprint name, and revision strings. |
|||
*/ |
|||
void clear(); |
|||
|
|||
/** |
|||
* Function empty |
|||
* @return a boolean true value if the FPID is empty. Otherwise return false. |
|||
*/ |
|||
bool empty() const { return nickname.empty() && footprint.empty() && revision.empty(); } |
|||
|
|||
/** |
|||
* Function Compare |
|||
* compares the contents of FPID objects by performing a std::string comparison of the |
|||
* library nickname, footprint name, and revision strings respectively. |
|||
* |
|||
* @param aFPID is the FPID to compare against. |
|||
* @return -1 if less than \a aFPID, 1 if greater than \a aFPID, and 0 if equal to \a aFPID. |
|||
*/ |
|||
int compare( const FPID& aFPID ) const; |
|||
|
|||
bool operator < ( const FPID& aFPID ) const { return this->compare( aFPID ) < 0; } |
|||
bool operator > ( const FPID& aFPID ) const { return this->compare( aFPID ) > 0; } |
|||
bool operator ==( const FPID& aFPID ) const { return this->compare( aFPID ) == 0; } |
|||
bool operator !=( const FPID& aFPID ) const { return !(*this == aFPID); } |
|||
|
|||
#if defined(DEBUG) |
|||
static void Test(); |
|||
#endif |
|||
|
|||
protected: |
|||
UTF8 nickname; ///< The nickname of the footprint library or empty. |
|||
UTF8 footprint; ///< The name of the footprint in the logical library. |
|||
UTF8 revision; ///< The footprint revision. |
|||
}; |
|||
|
|||
|
|||
#endif // _FPID_H_ |
|||
@ -0,0 +1,216 @@ |
|||
/* |
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> |
|||
* Copyright (C) 2012-2016 Wayne Stambaugh <stambaughw@verizon.net> |
|||
* Copyright (C) 2010-2016 KiCad Developers, see change_log.txt for contributors. |
|||
* |
|||
* 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 2 |
|||
* 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, you may find one here: |
|||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|||
* or you may search the http://www.gnu.org website for the version 2 license, |
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
#ifndef _LIB_ID_H_ |
|||
#define _LIB_ID_H_ |
|||
|
|||
#include <richio.h> |
|||
#include <utf8.h> |
|||
|
|||
/** |
|||
* Class LIB_ID |
|||
* |
|||
* is a logical library item identifier and consists of various portions much like a URI. |
|||
* It consists of of triad of the library nickname, the name of the item in the library, |
|||
* and an optional revision of the item. This is a generic library identifier that can be |
|||
* used for any type of library that contains multiple named items such as footprint or |
|||
* symbol libraries. |
|||
* |
|||
* Example LIB_ID string: |
|||
* "smt:R_0805/rev0". |
|||
* |
|||
* <p> |
|||
* <ul> |
|||
* <li> "smt" is the logical library name used to look up library information saved in the |
|||
* #LIB_TABLE. |
|||
* <li> "R" is the name of the item within the library. |
|||
* <li> "rev0" is the revision, which is optional. If missing then its |
|||
* / delimiter should also not be present. A revision must begin with |
|||
* "rev" and be followed by at least one or more decimal digits. |
|||
* </ul> |
|||
* |
|||
* @author Dick Hollenbeck |
|||
*/ |
|||
class LIB_ID |
|||
{ |
|||
public: |
|||
|
|||
LIB_ID() {} |
|||
|
|||
/** |
|||
* Constructor LIB_ID |
|||
* |
|||
* takes \a aId string and parses it. A typical LIB_ID string consists of a |
|||
* library nickname followed by a library item name. |
|||
* e.g.: "smt:R_0805", or |
|||
* e.g.: "mylib:R_0805", or |
|||
* e.g.: "ttl:7400" |
|||
* |
|||
* @param aId is a string to be parsed into the LIB_ID object. |
|||
*/ |
|||
LIB_ID( const std::string& aId ) throw( PARSE_ERROR ); |
|||
|
|||
LIB_ID( const wxString& aId ) throw( PARSE_ERROR ); |
|||
|
|||
/** |
|||
* Function Parse |
|||
* |
|||
* [re-]stuffs this LIB_ID with the information from @a aId. |
|||
* |
|||
* @param aId is the string to populate the #LIB_ID object. |
|||
* |
|||
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset into |
|||
* aId at which an error was detected. |
|||
*/ |
|||
int Parse( const UTF8& aId ); |
|||
|
|||
|
|||
/** |
|||
* Function GetLibNickname |
|||
* |
|||
* returns the logical library name portion of a LIB_ID. |
|||
*/ |
|||
const UTF8& GetLibNickname() const |
|||
{ |
|||
return nickname; |
|||
} |
|||
|
|||
/** |
|||
* Function SetLibNickname |
|||
* |
|||
* overrides the logical library name portion of the LIB_ID to @a aNickname. |
|||
* |
|||
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset |
|||
* into the parameter at which an error was detected, usually because it |
|||
* contained '/' or ':'. |
|||
*/ |
|||
int SetLibNickname( const UTF8& aNickname ); |
|||
|
|||
/** |
|||
* Function GetLibItemName |
|||
* |
|||
* @return the library item name, i.e. footprintName. |
|||
*/ |
|||
const UTF8& GetLibItemName() const { return item_name; } |
|||
|
|||
/** |
|||
* Function SetLibItemName |
|||
* |
|||
* overrides the library item name portion of the LIB_ID to @a aLibItemName |
|||
* |
|||
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset |
|||
* into the parameter at which an error was detected, usually because it |
|||
* contained '/'. |
|||
*/ |
|||
int SetLibItemName( const UTF8& aLibItemName ); |
|||
|
|||
int SetRevision( const UTF8& aRevision ); |
|||
|
|||
const UTF8& GetRevision() const { return revision; } |
|||
|
|||
UTF8 GetLibItemNameAndRev() const; |
|||
|
|||
/** |
|||
* Function Format |
|||
* |
|||
* @return the fully formatted text of the LIB_ID. |
|||
*/ |
|||
UTF8 Format() const; |
|||
|
|||
/** |
|||
* Function Format |
|||
* |
|||
* @return a string in the proper format as an LIB_ID for a combination of |
|||
* aLibNickname, aLibItemName, and aRevision. |
|||
* |
|||
* @throw PARSE_ERROR if any of the pieces are illegal. |
|||
static UTF8 Format( const UTF8& aLibNickname, const UTF8& aLibItemName, |
|||
const UTF8& aRevision = "" ) |
|||
throw( PARSE_ERROR ); |
|||
*/ |
|||
|
|||
/** |
|||
* Function IsValid |
|||
* |
|||
* @return true is the #LIB_ID is valid. |
|||
* |
|||
* A valid #LIB_ID must have both the library nickname and the library item name defined. |
|||
* The revision field is optional. |
|||
* |
|||
* @note A return value of true does not indicated that the #LIB_ID is a valid #LIB_TABLE |
|||
* entry. |
|||
*/ |
|||
bool IsValid() const { return !nickname.empty() && !item_name.empty(); } |
|||
|
|||
/** |
|||
* Function IsLegacy |
|||
* |
|||
* @return true if the #LIB_ID only has the #item_name name defined. |
|||
*/ |
|||
bool IsLegacy() const { return nickname.empty() && !item_name.empty() && revision.empty(); } |
|||
|
|||
/** |
|||
* Function clear |
|||
* |
|||
* clears the contents of the library nickname, library entry name, and revision strings. |
|||
*/ |
|||
void clear(); |
|||
|
|||
/** |
|||
* Function empty |
|||
* |
|||
* @return a boolean true value if the LIB_ID is empty. Otherwise return false. |
|||
*/ |
|||
bool empty() const { return nickname.empty() && item_name.empty() && revision.empty(); } |
|||
|
|||
/** |
|||
* Function Compare |
|||
* |
|||
* compares the contents of LIB_ID objects by performing a std::string comparison of the |
|||
* library nickname, library entry name, and revision strings respectively. |
|||
* |
|||
* @param aLibId is the LIB_ID to compare against. |
|||
* |
|||
* @return -1 if less than \a aLibId, 1 if greater than \a aLibId, and 0 if equal to \a aLibId. |
|||
*/ |
|||
int compare( const LIB_ID& aLIB_ID ) const; |
|||
|
|||
bool operator < ( const LIB_ID& aLibId ) const { return this->compare( aLibId ) < 0; } |
|||
bool operator > ( const LIB_ID& aLibId ) const { return this->compare( aLibId ) > 0; } |
|||
bool operator ==( const LIB_ID& aLibId ) const { return this->compare( aLibId ) == 0; } |
|||
bool operator !=( const LIB_ID& aLibId ) const { return !(*this == aLibId); } |
|||
|
|||
#if defined(DEBUG) |
|||
static void Test(); |
|||
#endif |
|||
|
|||
protected: |
|||
UTF8 nickname; ///< The nickname of the library or empty. |
|||
UTF8 item_name; ///< The name of the entry in the logical library. |
|||
UTF8 revision; ///< The revision of the entry. |
|||
}; |
|||
|
|||
|
|||
#endif // _LIB_ID_H_ |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue