|
yast2-core
|
YCPValueRep representing a data path A YCP path describes a subtree in a YCP data structure. Non-leaf-nodes are values of type list and term. A path is a list of path components. A path component is a symbol or a number. More...
#include <YCPPath.h>
Classes | |
| struct | Component |
Public Member Functions | |
| bool | isRoot () const |
| YCPValue | select (const YCPValue &val) |
| void | append (const YCPPath &p) |
| void | append (string c) |
| long | length () const |
| bool | isPrefixOf (const YCPPath &p) const |
| YCPPath | at (long index) const |
| YCPPath | prefix (long index) const |
| string | component_str (long index) const |
| YCPOrder | compare (const YCPPath &v) const |
| string | toString () const |
| std::ostream & | toStream (std::ostream &str) const |
| std::ostream & | toXml (std::ostream &str, int indent) const |
| YCPValueType | valuetype () const |
Public Member Functions inherited from YCPValueRep | |
| 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 |
Public Member Functions inherited from YCPElementRep | |
| YCPValue | asValue () const |
| virtual const YCPElementRep * | shallowCopy () const |
Protected Member Functions | |
| YCPPathRep () | |
| YCPPathRep (const char *r) | |
| void | append (const Component &c) |
Protected Member Functions inherited from YCPElementRep | |
| YCPElementRep () | |
| virtual | ~YCPElementRep () |
Private Attributes | |
| vector< Component > | components |
Friends | |
| class | YCPPath |
YCPValueRep representing a data path A YCP path describes a subtree in a YCP data structure. Non-leaf-nodes are values of type list and term. A path is a list of path components. A path component is a symbol or a number.
YCPSyntax: A single dot or any sequence of dot-symbol pairs. The symbols may consist of digits, letters and underscores.
. .etc .1.2.127 .etc.fstab.7
|
protected |
Creates a new root path. The ASCII representation of the root path is a single dot.
|
protected |
Creates a new path from its ASCII representation.
References components, and ycp2error.
|
protected |
| void YCPPathRep::append | ( | const YCPPath & | p | ) |
Append path to this
References components.
| void YCPPathRep::append | ( | string | c | ) |
Appends a component to the path.
References SymbolEntry::_nameHash, YCPPathRep::Component::complex, YCPPathRep::Component::component, and components.
| YCPPath YCPPathRep::at | ( | long | index | ) | const |
Returns a postfix of the path. You must check, that the index you give is 0 <= i < length.
References components, and length().
Compares two YCPPaths for equality, greaterness or smallerness.
| v | value to compare against |
References components, YO_EQUAL, YO_GREATER, and YO_LESS.
| string YCPPathRep::component_str | ( | long | index | ) | const |
Returns one component of the path as string. No error check is done for index. You must check yourself that 0 < index < length.
References components.
Referenced by isPrefixOf().
| bool YCPPathRep::isPrefixOf | ( | const YCPPath & | p | ) | const |
Checks if this path is a prefix of path p. This holds, if this path has size n and the first n components of p are exactly those of this path. The root path is prefix of any path. That path .a.b is a prefix of .a.b.c but not of the path .a.bc
References component_str(), and length().
| bool YCPPathRep::isRoot | ( | ) | const |
Returns true, if this is a root path.
References components.
| long YCPPathRep::length | ( | ) | const |
Returns the length of the path, i.e. the number of components. The root path has length 0.
References components.
Referenced by at(), and isPrefixOf().
| YCPPath YCPPathRep::prefix | ( | long | index | ) | const |
Returns a prefix of the path. You must check, that the index you give is 0 <= i < length. Informally, p == p.prefix(i) + p.at(i);
References components.
Selects the subtree of a YCPValueRep, that is denoted by this path. If this is the root path, select(v) simply returns v. If v is a list or a term, the first component of the path selects an element of the list and evalutes recursivly remainingpath->select(list_element). Returns a 0 pointer, if the path was incorrect.
|
virtual |
Output value as bytecode to stream
Implements YCPElementRep.
References components, str, toString(), Bytecode::writeInt32(), and Bytecode::writeString().
Referenced by toXml().
|
virtual |
Returns a string representation of this object, that may be parsed by the YCP parser. A path is denoted by a list symbols or number separated by dots, e.g. . or .12 or .eth0.12
Implements YCPElementRep.
References components.
Referenced by toStream(), and toXml().
|
virtual |
Implements YCPValueRep.
References components, str, toStream(), toString(), and Xmlcode::xmlify().
|
virtual |
|
friend |
|
private |
Referenced by append(), at(), compare(), component_str(), isRoot(), length(), prefix(), toStream(), toString(), toXml(), and YCPPathRep().
1.8.6