28#include <wx/translation.h>
59 if( ( partNdx = aId.
find(
':' ) ) != aId.
npos )
93 m_libraryName( aLibraryName ),
94 m_itemName( aItemName )
139 if( aLibraryName.
size() )
146 wxString::FromUTF8( aLibraryName.
c_str() ), aLibraryName.
c_str(),
163 if(
this == &aLibId )
179 for(
auto& ch : aLibItemName )
210 bool const space_allowed =
true;
211 bool const illegal_filename_chars_allowed =
false;
232 return illegal_filename_chars_allowed;
235 return space_allowed;
245 for(
unsigned ch : aLibraryName )
257 bool const space_allowed =
true;
269 return space_allowed;
280 ? wxString( wxS(
"" ) )
A logical library item identifier and consists of various portions much like a URI.
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
int SetLibItemName(const UTF8 &aLibItemName)
Override the library item name portion of the LIB_ID to aLibItemName.
static int HasIllegalChars(const UTF8 &aLibItemName)
Examine aLibItemName for invalid LIB_ID item name characters.
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
int compare(const LIB_ID &aLibId) const
Compare the contents of LIB_ID objects by performing a std::string comparison of the library nickname...
static bool isLegalChar(unsigned aUniChar)
Tests whether a Unicode character is a legal LIB_ID item name character.
static unsigned FindIllegalLibraryNameChar(const UTF8 &aLibraryName)
Looks for characters that are illegal in library nicknames.
UTF8 m_libraryName
The nickname of the library or empty.
static UTF8 FixIllegalChars(const UTF8 &aLibItemName, bool aLib)
Replace illegal LIB_ID item name characters with underscores '_'.
UTF8 m_itemName
The name of the entry in the logical library.
void clear()
Clear the contents of the library nickname, library entry name.
const wxString GetFullLibraryName() const
UTF8 m_subLibraryName
Optional sub-library name used for grouping within a library.
static bool isLegalLibraryNameChar(unsigned aUniChar)
Tests whether a Unicode character is a legal LIB_ID library nickname character.
uni_iter is a non-mutating iterator that walks through unicode code points in the UTF8 encoded string...
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
static constexpr std::string::size_type npos
std::string::size_type find(char c) const
std::string substr(size_t pos=0, size_t len=npos) const
uni_iter uend() const
Return a uni_iter initialized to the end of "this" UTF8 byte sequence.
int compare(const std::string &s) const
std::string::size_type find_first_of(const std::string &str, std::string::size_type pos=0) const
const char * c_str() const
std::string::size_type size() const
uni_iter ubegin() const
Returns a uni_iter initialized to the start of "this" UTF8 byte sequence.
#define THROW_PARSE_ERROR(aProblem, aSource, aInputLine, aLineNumber, aByteIndex)
static int checkLibNickname(const UTF8 &aField)
This file contains miscellaneous commonly used macros and functions.