IpeString 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 IpeString is a single pointer). Sharing is implicit---the string creates its own representation as soon as it is modified.
IpeString 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.
Ipe is not using the STL string type because the C++ standard does neither guarantee that passing by value is efficient, nor that std::string is efficient for very long strings (although in practice that is probably true). However, IpeString is designed to be plug-in compatible with std::string, so Ipe can switch any time it is deemed appropriate (in particular, unlike the rest of Ipe, IpeString uses lower-case member names!).
|
Return character at index i.
|
|
Is the string empty?
|
|
Return read-only pointer to the data.
|
|
Return number of bytes in the string.
|
|
Operator syntax for append.
|
|
Operator syntax for append.
|
|
Create substring.
|
|
Operator !=.
|
|
Return Unicode value from UTF-8 string. The index is incremented to the next UTF-8 character. |