Ipelib
|
#include <ipebase.h>
Public Member Functions | |
String () noexcept | |
String (const char *str) noexcept | |
String (const char *str, int len) noexcept | |
String (const String &rhs) noexcept | |
String (const String &rhs, int index, int len) noexcept | |
String & | operator= (const String &rhs) noexcept |
~String () noexcept | |
char | operator[] (int i) const noexcept |
bool | empty () const noexcept |
const char * | data () const noexcept |
int | size () const noexcept |
void | operator+= (const String &rhs) noexcept |
void | operator+= (const char *rhs) noexcept |
void | operator+= (char ch) noexcept |
String | substr (int i, int len=-1) const noexcept |
String | left (int i) const noexcept |
String | right (int i) const noexcept |
bool | operator!= (const String &rhs) const noexcept |
bool | operator!= (const char *rhs) const noexcept |
int | find (char ch) const noexcept |
int | rfind (char ch) const noexcept |
int | find (const char *rhs) const noexcept |
void | erase () noexcept |
void | append (const String &rhs) noexcept |
void | append (const char *rhs) noexcept |
void | append (char ch) noexcept |
void | appendUtf8 (uint16_t ch) noexcept |
bool | hasPrefix (const char *rhs) const noexcept |
bool | operator== (const String &rhs) const noexcept |
bool | operator== (const char *rhs) const noexcept |
bool | operator< (const String &rhs) const noexcept |
String | operator+ (const String &rhs) const noexcept |
int | unicode (int &index) const noexcept |
String | getLine (int &index) const noexcept |
const char * | z () const noexcept |
Static Public Member Functions | |
static String | withData (char *data, int len=0) noexcept |
Strings and buffers.
String is is an implicitly shared byte string. It is designed to be efficient for strings of arbitrary length, and supposed to be passed by value (the size of String is a single pointer). Sharing is implicit—the string creates its own representation as soon as it is modified.
String can be used for binary data. For text, it is usually assumed that the string is UTF-8 encoded, but only the unicode member function actually requires this. In particular, all indices into the string are byte indices, not Unicode character indices.
|
noexcept |
Construct an empty string.
|
noexcept |
Construct a string by making copy of str.
|
noexcept |
Construct string by making copy of str with given len.
|
noexcept |
Copy constructor. This only copies the reference and takes constant time.
|
noexcept |
Construct a substring.
index must be >= 0. len can be negative or too large to return entire string.
|
noexcept |
Destruct string if reference count has reached zero.
|
staticnoexcept |
Construct string by taking ownership of given data.
|
inlinenoexcept |
Return character at index i.
|
inlinenoexcept |
Is the string empty?
References ipe::size().
Referenced by ipe::Latex::addPageNumber(), ipe::PdfWriter::createBookmarks(), ipe::Latex::createLatexSource(), ipe::PdfWriter::createNamedDests(), ipe::PdfWriter::createPageView(), ipe::PdfWriter::createTrailer(), ipe::Document::findPage(), ipe::Page::findView(), ipe::Attribute::makeColor(), ipe::Attribute::makeDashStyle(), ipe::Attribute::makeScalar(), ipe::Attribute::makeTextSize(), ipe::Object::Object(), ipe::XmlParser::parseAttributes(), ipe::ImlParser::parseObject(), ipe::ImlParser::parsePage(), ipe::ImlParser::parseStyle(), ipe::ImlParser::parseView(), ipe::Platform::runLatex(), ipe::Document::runLatexAsync(), ipe::Page::saveAsXml(), ipe::StyleSheet::saveAsXml(), ipe::Document::saveAsXml(), ipe::Group::saveAsXml(), ipe::Object::saveAttributesAsXml(), and ipe::Repository::toIndex().
|
inlinenoexcept |
Return read-only pointer to the data.
Referenced by ipe::Bitmap::Bitmap(), ipe::PdfWriter::createPageView(), ipe::PdfWriter::createXmlStream(), ipe::Platform::fileExists(), ipe::PdfDict::inflate(), ipe::Platform::listDirectory(), ipe::PdfWriter::PdfWriter(), ipe::Bitmap::readJpeg(), ipe::Platform::realPath(), ipe::Platform::runLatex(), and z().
|
inlinenoexcept |
Return number of bytes in the string.
Referenced by ipe::Bitmap::Bitmap(), ipe::PdfDict::count(), ipe::Latex::createLatexSource(), ipe::PdfWriter::createPageView(), ipe::PdfWriter::createXmlStream(), ipe::PdfString::decode(), ipe::CairoPainter::doDrawText(), ipe::Document::formatFromFilename(), ipe::Lex::getFixed(), ipe::PdfDict::inflate(), ipe::Platform::ipeDrive(), ipe::Platform::latexDirectory(), ipe::XmlParser::parsePCDATA(), ipe::XmlParser::parseToTag(), ipe::PdfWriter::PdfWriter(), ipe::Stream::putString(), ipe::FileStream::putString(), ipe::Stream::putXmlString(), ipe::Bitmap::readJpeg(), ipe::Platform::runLatex(), ipe::Document::saveAsXml(), ipe::Path::saveAsXml(), ipe::StringStream::tell(), and ipe::Text::Text().
|
inlinenoexcept |
Operator syntax for append.
|
inlinenoexcept |
Operator syntax for append.
|
inlinenoexcept |
Operator syntax for append.
|
inlinenoexcept |
Create substring.
Referenced by ipe::Latex::createLatexSource(), ipe::PdfWriter::createPageView(), ipe::Painter::dashStyle(), ipe::Document::fileFormat(), ipe::Lex::getFixed(), ipe::PdfParser::getObject(), ipe::Platform::latexDirectory(), ipe::Platform::latexPath(), ipe::Lex::nextToken(), ipe::PdfFile::parse(), ipe::Platform::runLatex(), ipe::Document::runLatexAsync(), ipe::StyleSheet::saveAsXml(), ipe::Path::saveAsXml(), and ipe::Text::Text().
|
inlinenoexcept |
Create substring at the left.
Referenced by ipe::Latex::createLatexSource(), ipe::PdfWriter::createPageView(), ipe::CairoPainter::doDrawText(), ipe::Platform::ipeDrive(), ipe::Platform::latexDirectory(), ipe::Platform::latexPath(), ipe::Platform::realPath(), and ipe::Platform::runLatex().
|
noexcept |
Create substring at the right.
Returns the entire string if i is larger than its length.
References ipe::size().
Referenced by ipe::Document::formatFromFilename(), and ipe::Platform::latexDirectory().
|
inlinenoexcept |
Operator !=.
|
inlinenoexcept |
Operator !=.
|
noexcept |
Return index of first occurrence of ch.
Return -1 if character does not appear.
References ipe::size().
Referenced by ipe::Latex::createLatexSource(), ipe::Painter::dashStyle(), ipe::CairoPainter::doDrawText(), ipe::Reference::flagsFromName(), ipe::PdfFile::parse(), ipe::Document::runLatexAsync(), and ipe::StyleSheet::saveAsXml().
|
noexcept |
Return index of last occurrence of ch.
Return -1 if character does not appear.
References ipe::size().
|
noexcept |
Return index of first occurrence of rhs.
Return -1 if not substring is not present.
References ipe::size().
|
noexcept |
Make string empty.
Referenced by ipe::Latex::createLatexSource(), and ipe::PdfParser::getToken().
|
noexcept |
Append rhs to this string.
Referenced by ipe::PdfParser::getToken(), operator+(), and ipe::Platform::readFile().
|
noexcept |
Append rhs to this string.
|
noexcept |
Append ch to this string.
|
noexcept |
Append a single unicode character ch in UTF-8 encoding.
Referenced by ipe::PdfString::decode().
|
noexcept |
Does string start with this prefix? (bytewise comparison)
References ipe::size().
Referenced by ipe::Latex::createLatexSource(), ipe::PdfString::decode(), ipe::Attribute::isMidArrow(), and ipe::Document::runLatexAsync().
|
noexcept |
Equality operator (bytewise comparison).
References ipe::size().
|
noexcept |
Equality operator (bytewise comparison).
References ipe::size().
|
noexcept |
Inequality operator (bytewise comparison).
References ipe::size().
Concatenate this string with rhs.
References append().
|
noexcept |
Return Unicode value from UTF-8 string.
The index is incremented to the next UTF-8 character. This returns 0xfffd if there is any problem in parsing UTF-8.
|
noexcept |
Return line starting at position index. Index is updated to point to next line.
References ipe::size().
|
noexcept |
Return a C style string with final zero byte.
References data().
Referenced by ipe::PdfResources::collect(), ipe::CairoPainter::doDrawText(), ipe::Face::Face(), ipe::Platform::fileExists(), ipe::Lex::getFixed(), ipe::Lex::getHexNumber(), ipe::Lex::getInt(), ipe::Platform::latexDirectory(), ipe::Platform::listDirectory(), ipe::QIpe(), ipe::Platform::readFile(), ipe::Platform::realPath(), ipe::Platform::runLatex(), ipe::Document::runLatexAsync(), ipe::PdfResources::show(), ipe::Platform::toDouble(), ipe::Platform::toNumber(), and ipe::Face::~Face().