Ipelib
|
#include <ipebase.h>
Public Member Functions | |
String () | |
String (const char *str) | |
String (const String &rhs) | |
String (const String &rhs, int index, int len) | |
String & | operator= (const String &rhs) |
~String () | |
char | operator[] (int i) const |
bool | empty () const |
bool | isEmpty () const |
const char * | data () const |
int | size () const |
void | operator+= (const String &rhs) |
void | operator+= (char ch) |
String | substr (int i, int len=-1) const |
String | left (int i) const |
String | right (int i) const |
bool | operator!= (const String &rhs) const |
int | find (char ch) const |
int | rfind (char ch) const |
int | find (const char *rhs) const |
void | erase () |
void | append (const String &rhs) |
void | append (char ch) |
bool | operator== (const String &rhs) const |
bool | operator< (const String &rhs) const |
String | operator+ (const String &rhs) const |
int | unicode (int &index) const |
const char * | z () const |
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.
String::String | ( | const char * | str | ) |
Construct a string by making copy of str.
String::String | ( | const String & | rhs | ) |
Copy constructor. This only copies the reference and takes constant time.
String::String | ( | const String & | rhs, |
int | index, | ||
int | len | ||
) |
Construct a substring.
index must be >= 0. len can be negative or too large to return entire string.
References size().
String::~String | ( | ) |
Destruct string if reference count has reached zero.
|
inline |
Return character at index i.
|
inline |
Is the string empty?
References size().
Referenced by ipe::PdfWriter::createBookmarks(), ipe::PdfWriter::createTrailer(), ipe::Attribute::makeTextSize(), ipe::XmlParser::parseAttributes(), ipe::ImlParser::parsePage(), ipe::ImlParser::parseStyle(), ipe::Document::runLatex(), ipe::Page::saveAsXml(), ipe::StyleSheet::saveAsXml(), and ipe::Document::saveAsXml().
|
inline |
Is the string empty?
References size().
Referenced by ipe::Attribute::makeColor(), ipe::Attribute::makeDashStyle(), ipe::Attribute::makeScalar(), ipe::Object::saveAttributesAsXml(), and ipe::Repository::toIndex().
|
inline |
Return read-only pointer to the data.
Referenced by ipe::Bitmap::Bitmap(), ipe::PdfWriter::createPageView(), ipe::PdfWriter::createXmlStream(), ipe::Bitmap::readJpeg(), ipe::Document::runLatex(), and z().
|
inline |
Return number of bytes in the string.
Referenced by append(), ipe::Bitmap::Bitmap(), ipe::PdfWriter::createBookmarks(), ipe::Latex::createLatexSource(), ipe::PdfWriter::createPageView(), ipe::PdfWriter::createXmlStream(), ipe::CairoPainter::doDrawText(), empty(), ipe::Lex::eos(), find(), ipe::Reference::flagsFromName(), ipe::Document::formatFromFilename(), ipe::Lex::getFixed(), isEmpty(), ipe::Platform::latexDirectory(), operator<(), operator==(), ipe::XmlParser::parsePCDATA(), ipe::XmlParser::parseToTag(), ipe::Stream::putString(), ipe::FileStream::putString(), ipe::Stream::putXmlString(), ipe::Bitmap::readJpeg(), rfind(), right(), ipe::Document::runLatex(), ipe::Platform::runPdfLatex(), ipe::Path::saveAsXml(), String(), ipe::StringStream::tell(), and ipe::PdfString::write().
|
inline |
Operator syntax for append.
References append().
|
inline |
Operator syntax for append.
References append().
|
inline |
Create substring.
References String().
Referenced by ipe::Latex::createLatexSource(), ipe::Painter::dashStyle(), ipe::Document::fileFormat(), ipe::Reference::flagsFromName(), ipe::Lex::getFixed(), ipe::PdfParser::getObject(), ipe::Lex::nextToken(), ipe::Document::runLatex(), ipe::Platform::runPdfLatex(), ipe::Path::saveAsXml(), and ipe::StyleSheet::saveAsXml().
|
inline |
Create substring at the left.
References String().
Referenced by ipe::CairoPainter::doDrawText(), ipe::Reference::flagsFromName(), ipe::Platform::latexDirectory(), and ipe::Document::runLatex().
String String::right | ( | int | i | ) | const |
Create substring at the right.
Returns the entire string if i is larger than its length.
References size(), and String().
Referenced by ipe::Document::formatFromFilename(), and ipe::Platform::latexDirectory().
|
inline |
Operator !=.
int String::find | ( | char | ch | ) | const |
Return index of first occurrence of ch.
Return -1 if character does not appear.
References size().
Referenced by ipe::Painter::dashStyle(), ipe::CairoPainter::doDrawText(), ipe::Reference::flagsFromName(), ipe::Document::runLatex(), and ipe::StyleSheet::saveAsXml().
int String::rfind | ( | char | ch | ) | const |
Return index of last occurrence of ch.
Return -1 if character does not appear.
References size().
Referenced by ipe::Reference::flagsFromName().
int String::find | ( | const char * | rhs | ) | const |
Return index of first occurrence of rhs.
Return -1 if not substring is not present.
References size().
void String::erase | ( | ) |
Make string empty.
Referenced by ipe::PdfParser::getToken().
void String::append | ( | const String & | rhs | ) |
Append rhs to this string.
References size().
Referenced by ipe::PdfParser::getToken(), operator+(), operator+=(), and ipe::Platform::readFile().
void String::append | ( | char | ch | ) |
Append ch to this string.
bool String::operator== | ( | const String & | rhs | ) | const |
Equality operator (bytewise comparison).
References size().
bool String::operator< | ( | const String & | rhs | ) | const |
Inequality operator (bytewise comparison).
References size().
Concatenate this string with rhs.
References append().
int String::unicode | ( | int & | index | ) | const |
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.
Referenced by ipe::Latex::createLatexSource().
const char * String::z | ( | ) | const |
Return a C style string with final zero byte.
References data().
Referenced by ipe::CairoPainter::doDrawText(), ipe::Face::Face(), ipe::Platform::fileExists(), ipe::Lex::getFixed(), ipe::Lex::getHexNumber(), ipe::Lex::getInt(), ipe::PdfParser::getToken(), ipe::Platform::latexDirectory(), ipe::Platform::listDirectory(), ipe::PageSelector::PageSelector(), ipe::PdfFile::parse(), ipe::QIpe(), ipe::Platform::readFile(), ipe::Document::runLatex(), ipe::Platform::runPdfLatex(), and ipe::Platform::toDouble().