yast2-core
|
YCPValueRep representing a character string of arbitrary length. Whatever internal representation is choosen: It should be possible to switch to 16 bit Unicode strings, when neccessary. More...
#include <YCPString.h>
Public Member Functions | |
bool | isEmpty () const |
bool | isAscii () const |
const string & | value () const |
wstring | wvalue () const |
YCPOrder | compare (const YCPString &v, bool rl=false) const |
const char * | value_cstr () const |
string | toString () const |
std::ostream & | toStream (std::ostream &str) const |
std::ostream & | toXml (std::ostream &str, int indent) const |
YCPValueType | valuetype () const |
![]() | |
const char * | valuetype_str () const |
bool | isVoid () const |
bool | isBoolean () const |
bool | isInteger () const |
bool | isFloat () const |
bool | isString () const |
bool | isByteblock () const |
bool | isPath () const |
bool | isSymbol () const |
bool | isList () const |
bool | isTerm () const |
bool | isMap () const |
bool | isCode () const |
bool | isBreak () const |
bool | isReturn () const |
bool | isEntry () const |
bool | isReference () const |
bool | isExternal () const |
YCPVoid | asVoid () const |
YCPBoolean | asBoolean () const |
YCPInteger | asInteger () const |
YCPFloat | asFloat () const |
YCPString | asString () const |
YCPByteblock | asByteblock () const |
YCPPath | asPath () const |
YCPSymbol | asSymbol () const |
YCPList | asList () const |
YCPTerm | asTerm () const |
YCPMap | asMap () const |
YCPCode | asCode () const |
YCPEntry | asEntry () const |
YCPReference | asReference () const |
YCPExternal | asExternal () const |
bool | equal (const YCPValue &) const |
YCPOrder | compare (const YCPValue &v, bool rl=false) const |
![]() | |
YCPValue | asValue () const |
virtual const YCPElementRep * | shallowCopy () const |
Protected Member Functions | |
YCPStringRep (const string &s) | |
YCPStringRep (const wstring &s) | |
![]() | |
YCPElementRep () | |
virtual | ~YCPElementRep () |
Private Attributes | |
string | v |
bool | is_ascii |
Friends | |
class | YCPString |
YCPValueRep representing a character string of arbitrary length. Whatever internal representation is choosen: It should be possible to switch to 16 bit Unicode strings, when neccessary.
YCP Syntax: Doublequoted ASCII string.
"This is a string", "", "08712345"
|
protected |
Creates a new YCPStringRep from a C++ string.
s | A string that is taken literally as value of the newly create YCPStringRep object. Not expansion of backslashes is done, s is not considered to be enclosed with quotes. If there are quotes, they are considered to be part of the string. The string must be UTF-8 encoded. |
|
protected |
Creates a new YCPStringRep from a C++ wstring.
s | A wstring that is taken literally as value of the newly create YCPStringRep object. Not expansion of backslashes is done, s is not considered to be enclosed with quotes. If there are quotes, they are considered to be part of the string. |
References is_ascii, v, and YaST::wchar2utf8().
Compares two YCPStrings for equality, greaterness or smallerness.
v | value to compare against |
rl | respect locale |
References YaST::utf82wchar(), v, value_cstr(), YO_EQUAL, YO_GREATER, and YO_LESS.
Referenced by isAscii().
|
inline |
Returns true iff the string only contains ASCII characters.
References compare(), is_ascii, str, toStream(), toString(), toXml(), value(), value_cstr(), valuetype(), and wvalue().
bool YCPStringRep::isEmpty | ( | ) | const |
Returns true iff this string is empty.
References v.
|
virtual |
Output value as bytecode to stream
Implements YCPElementRep.
References v, and Bytecode::writeString().
Referenced by isAscii().
|
virtual |
Returns a string representation of the value of this object. It contains enclosing quotes. Newlines and quotes contained in the string itself are quoted with backslashes.
Implements YCPElementRep.
References v.
Referenced by isAscii().
|
virtual |
const string & YCPStringRep::value | ( | ) | const |
const char * YCPStringRep::value_cstr | ( | ) | const |
|
virtual |
Returns YT_STRING. See YCPValueRep::valuetype.
Implements YCPValueRep.
References YT_STRING.
Referenced by isAscii().
wstring YCPStringRep::wvalue | ( | ) | const |
Returns the value of this object in form of a C++ wstring value.
References YaST::utf82wchar(), and v.
Referenced by isAscii().
|
friend |
Referenced by YCPString::YCPString().
|
private |
Referenced by isAscii(), and YCPStringRep().
|
private |
Referenced by compare(), isEmpty(), toStream(), toString(), toXml(), value(), value_cstr(), wvalue(), and YCPStringRep().