|
KiCad PCB EDA Suite
|
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and from wxString, to and from std::string, and has non-mutating iteration over Unicode characters. More...
#include <utf8.h>
Classes | |
| class | uni_iter |
| uni_iter is a non-mutating iterator that walks through unicode code points in the UTF8 encoded string. More... | |
Public Member Functions | |
| UTF8 (const wxString &o) | |
| UTF8 (const char *txt) | |
| This is a constructor for which you could end up with non-UTF8 encoding, but that would be your fault. | |
| UTF8 (const wchar_t *txt) | |
| For use with _() function on wx 2.8. | |
| UTF8 (const std::string &o) | |
| UTF8 (const UTF8 &o) | |
| UTF8 () | |
| ~UTF8 () | |
| const char * | c_str () const |
| bool | empty () const |
| std::string::size_type | find (char c) const |
| std::string::size_type | find (char c, size_t s) const |
| void | clear () |
| std::string::size_type | length () const |
| std::string::size_type | size () const |
| int | compare (const std::string &s) const |
| bool | operator== (const UTF8 &rhs) const |
| bool | operator== (const std::string &rhs) const |
| bool | operator== (const char *s) const |
| bool | operator!= (const UTF8 &rhs) const |
| bool | operator< (const UTF8 &rhs) const |
| bool | operator> (const UTF8 &rhs) const |
| std::string::size_type | find_first_of (const std::string &str, std::string::size_type pos=0) const |
| UTF8 & | operator+= (const UTF8 &str) |
| UTF8 & | operator+= (char ch) |
| UTF8 & | operator+= (const char *s) |
| UTF8 & | operator+= (unsigned w_ch) |
| Append a wide (unicode) char to the UTF8 string. | |
| UTF8 & | operator= (const wxString &o) |
| UTF8 & | operator= (const std::string &o) |
| UTF8 & | operator= (const char *s) |
| UTF8 & | operator= (char c) |
| UTF8 & | operator= (const UTF8 &aOther) |
| UTF8 & | operator= (UTF8 &&aOther) noexcept |
| std::string | substr (size_t pos=0, size_t len=npos) const |
| operator const std::string & () const | |
| wxString | wx_str () const |
| operator wxString () const | |
| std::string::const_iterator | begin () const |
| std::string::const_iterator | end () const |
| uni_iter | ubegin () const |
| Returns a uni_iter initialized to the start of "this" UTF8 byte sequence. | |
| uni_iter | uend () const |
| Return a uni_iter initialized to the end of "this" UTF8 byte sequence. | |
Static Public Member Functions | |
| static int | uni_forward (const unsigned char *aSequence, unsigned *aResult=nullptr) |
| Advance over a single UTF8 encoded multibyte character, capturing the Unicode character as it goes, and returning the number of bytes consumed. | |
Static Public Attributes | |
| static constexpr std::string::size_type | npos = -1 |
Protected Attributes | |
| std::string | m_s |
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and from wxString, to and from std::string, and has non-mutating iteration over Unicode characters.
I've been careful to supply only conversion facilities and not try and duplicate wxString() with many member functions. There are multiple ways to create text into a std::string without the need of too many member functions:
Because this class uses no virtuals, it should be possible to cast any std::string into a UTF8 using this kind of cast: (UTF8 &) without construction or copying being the effect of the cast. Be sure the source std::string holds UTF8 encoded text before you do that.
| UTF8::UTF8 | ( | const wxString & | o | ) |
Definition at line 35 of file utf8.cpp.
References m_s.
Referenced by operator!=(), operator+=(), operator+=(), operator+=(), operator+=(), operator<(), operator=(), operator=(), operator=(), operator=(), operator=(), operator=(), operator==(), operator>(), and UTF8().
|
inline |
This is a constructor for which you could end up with non-UTF8 encoding, but that would be your fault.
Definition at line 73 of file utf8.h.
References c_str(), m_s, and MAYBE_VERIFY_UTF8.
| UTF8::UTF8 | ( | const wchar_t * | txt | ) |
|
inline |
Definition at line 83 of file utf8.h.
References c_str(), m_s, and MAYBE_VERIFY_UTF8.
|
inline |
|
inline |
Definition at line 215 of file utf8.h.
References m_s.
Referenced by LIBRARY_TABLE::FormatOptions().
|
inline |
Definition at line 104 of file utf8.h.
References m_s.
Referenced by SCH_IO_DATABASE::cacheLib(), PCB_IO_EAGLE::centerBoard(), LIB_ID::Format(), PCB_IO_KICAD_SEXPR::format(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), PCB_IO_CADSTAR_ARCHIVE::LoadBoard(), DSN::SPECCTRA_DB::makeIMAGE(), operator wxString(), operator+=(), operator+=(), operator+=(), operator=(), operator=(), operator=(), operator=(), operator=(), DIALOG_EXCHANGE_FOOTPRINTS::processFootprint(), CVPCB_MAINFRAME::readNetListAndFpFiles(), CVPCB_MAINFRAME::refreshAfterSymbolSearch(), SCH_IO_KICAD_SEXPR::saveGroup(), setPartIdNameAndMetadata(), SCH_BASE_FRAME::setSymWatcher(), FOOTPRINT_EDIT_FRAME::UpdateTitle(), UTF8(), UTF8(), UTF8(), and wx_str().
|
inline |
|
inline |
Definition at line 105 of file utf8.h.
References m_s.
Referenced by PCB_IO_EAGLE::centerBoard(), SCH_SCREENS::GetLibNicknames(), SCH_SCREENS::HasNoFullyDefinedLibIds(), FOOTPRINT_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_CONTROL::Init(), PCB_IO_CADSTAR_ARCHIVE::LoadBoard(), PCB_EDIT_FRAME::OpenProjectFiles(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), PCBNEW_JOBS_HANDLER::runFpLibMerge(), LIB_TREE::setState(), FOOTPRINT_EDIT_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), FOOTPRINT_EDITOR_CONTROL::tryToSaveFootprintInLibrary(), and FOOTPRINT_EDIT_FRAME::UpdateTitle().
|
inline |
Definition at line 216 of file utf8.h.
References m_s.
Referenced by LIBRARY_TABLE::FormatOptions().
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 111 of file utf8.h.
References m_s.
Referenced by PLACE_FILE_EXPORTER::GenPositionData().
|
inline |
|
inline |
Definition at line 119 of file utf8.h.
References operator==(), and UTF8().
|
inline |
|
inline |
| UTF8 & UTF8::operator+= | ( | unsigned | w_ch | ) |
|
inline |
|
inline |
|
inline |
|
inline |
| UTF8 & UTF8::operator= | ( | const wxString & | o | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 112 of file utf8.h.
References m_s.
Referenced by LIB_ID::Format(), LIBRARY_TABLE::FormatOptions(), guessNickname(), and LoadNetlistFootprints().
|
inline |
Definition at line 201 of file utf8.h.
Referenced by PDF_OUTLINE_FONT_MANAGER::EncodeString(), operator+=(), LIB_ID::Parse(), PDF_OUTLINE_FONT_SUBSET::sanitizeFontName(), and PDF_PLOTTER::Text().
|
inline |
Returns a uni_iter initialized to the start of "this" UTF8 byte sequence.
Definition at line 301 of file utf8.h.
References m_s.
Referenced by KIGFX::OPENGL_GAL::computeBitmapTextSize(), and LIB_ID::FixIllegalChars().
|
inline |
Return a uni_iter initialized to the end of "this" UTF8 byte sequence.
Definition at line 309 of file utf8.h.
References m_s.
Referenced by KIGFX::OPENGL_GAL::computeBitmapTextSize(), and LIB_ID::FixIllegalChars().
|
static |
Advance over a single UTF8 encoded multibyte character, capturing the Unicode character as it goes, and returning the number of bytes consumed.
| aSequence | is the UTF8 byte sequence, must be aligned on start of character. |
| aResult | is where to put the unicode character, and may be NULL if no interest. |
Definition at line 63 of file utf8.cpp.
Referenced by IsUTF8(), UTF8::uni_iter::operator*(), UTF8::uni_iter::operator++(), UTF8::uni_iter::operator++(), and UTF8::uni_iter::operator->().
| wxString UTF8::wx_str | ( | ) | const |
Definition at line 41 of file utf8.cpp.
References c_str().
Referenced by COMPONENTS_MANAGER::AddComponent(), SCH_SCREEN::AddLibSymbol(), BOARD_NETLIST_UPDATER::addNewFootprint(), CVPCB_ASSOCIATION_TOOL::Associate(), CVPCB_MAINFRAME::AssociateFootprint(), BASIC_FOOTPRINT_INFO::BASIC_FOOTPRINT_INFO(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), PANEL_DESIGN_BLOCK_LIB_TABLE::browseLibrariesHandler(), PANEL_FP_LIB_TABLE::browseLibrariesHandler(), SCH_SCREENS::ChangeSymbolLibNickname(), DIPTRACE::SCH_PARSER::componentSymbolName(), CADSTAR_SCH_ARCHIVE_LOADER::CreateLibName(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), PCBNEW_JOBS_HANDLER::doFpExportSvg(), SYMBOL_SAVE_AS_HANDLER::DoSave(), BOARD::ExchangeFootprint(), LIB_TREE_MODEL_ADAPTER::FindItem(), LEGACY_SYMBOL_LIBS::FindLibSymbol(), RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(), LEGACY_SYMBOL_LIB::FindSymbol(), SCH_IO_KICAD_SEXPR::Format(), DESIGN_BLOCK_TREE_MODEL_ADAPTER::GenerateInfo(), DESIGN_BLOCK_PANE::GetDesignBlock(), DIPTRACE::SCH_PARSER::getLibName(), SCH_IO_ALTIUM::getLibName(), SCH_IO_EAGLE::getLibName(), SCH_IO_GEDA::getLibName(), GetSafeRootSymbol(), PCB_IO_KICAD_LEGACY::loadFOOTPRINT(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), PCB_IO_KICAD_LEGACY::loadFP_SHAPE(), LoadNetlistFootprints(), PCB_IO_KICAD_LEGACY::loadPAD(), SCH_IO_DATABASE::loadSymbolFromRow(), SCH_EDIT_FRAME::OpenProjectFiles(), PANEL_SYMBOL_CHOOSER::populateFootprintSelector(), CVPCB_MAINFRAME::readNetListAndFpFiles(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), BOARD_NETLIST_UPDATER::replaceFootprint(), SYMBOL_EDIT_FRAME::Revert(), PCBNEW_JOBS_HANDLER::runFpLibMerge(), SCH_IO_KICAD_SEXPR_LIB_CACHE::SaveSymbol(), SCH_IO_KICAD_SEXPR::saveSymbol(), SchGetLibSymbol(), PCB_BASE_FRAME::SelectFootprintFromLibrary(), LIB_SYMBOL::SetLibId(), DIALOG_EDIT_SYMBOLS_LIBID::setLibIdByBrowser(), LIB_SYMBOL::SetName(), FOOTPRINTS_LISTBOX::SetSelectedFootprint(), PANEL_SYMBOL_CHOOSER::showFootprintFor(), BOARD_NETLIST_UPDATER::testConnectivity(), DIALOG_PLUGIN_OPTIONS::TransferDataFromWindow(), and BOARD_NETLIST_UPDATER::UpdateNetlist().
|
protected |
Definition at line 325 of file utf8.h.
Referenced by begin(), c_str(), clear(), compare(), empty(), end(), find(), find(), find_first_of(), length(), operator const std::string &(), operator+=(), operator+=(), operator+=(), operator+=(), operator<(), operator=(), operator=(), operator=(), operator=(), operator=(), operator=(), operator==(), operator==(), operator==(), operator>(), size(), substr(), ubegin(), uend(), UTF8(), UTF8(), UTF8(), UTF8(), and UTF8().
|
staticconstexpr |
Definition at line 157 of file utf8.h.
Referenced by LIB_ID::Parse(), and substr().