YCPPathRep Class Reference

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>

Inheritance diagram for YCPPathRep:

YCPValueRep YCPElementRep List of all members.

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
string component_str (long index) const
YCPOrder compare (const YCPPath &v) const
string toString () const
std::ostream & toStream (std::ostream &str) const
YCPValueType valuetype () const

Protected Member Functions

 YCPPathRep ()
 YCPPathRep (const char *r)
void append (const Component &c)

Private Attributes

vector< Componentcomponents

Friends

class YCPPath

Classes

struct  Component

Detailed Description

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


Constructor & Destructor Documentation

YCPPathRep::YCPPathRep  )  [protected]
 

Creates a new root path. The ASCII representation of the root path is a single dot.

YCPPathRep::YCPPathRep const char *  r  )  [protected]
 

Creates a new path from its ASCII representation.


Member Function Documentation

void YCPPathRep::append string  c  ) 
 

Appends a component to the path.

void YCPPathRep::append const YCPPath p  ) 
 

Append path to this

void YCPPathRep::append const Component c  )  [protected]
 

Appends component to path.

YCPPath YCPPathRep::at long  index  )  const
 

Returns a postfix of the path. You must check, that the index you give is 0 <= i < length.

Returns:
Postfix path. destroy it after use.

YCPOrder YCPPathRep::compare const YCPPath v  )  const
 

Compares two YCPPaths for equality, greaterness or smallerness.

Parameters:
v value to compare against
Returns:
YO_LESS, if this is smaller than v, YO_EQUAL, if this is equal to v, YO_GREATER, if this is greater to v

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.

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

bool YCPPathRep::isRoot  )  const
 

Returns true, if this is a root path.

long YCPPathRep::length  )  const
 

Returns the length of the path, i.e. the number of components. The root path has length 0.

YCPValue YCPPathRep::select const YCPValue val  ) 
 

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.

std::ostream & YCPPathRep::toStream std::ostream &  str  )  const [virtual]
 

Output value as bytecode to stream

Implements YCPElementRep.

string YCPPathRep::toString  )  const [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.

YCPValueType YCPPathRep::valuetype  )  const [virtual]
 

Returns YT_PATH. See YCPValueRep::valuetype.

Implements YCPValueRep.


Friends And Related Function Documentation

friend class YCPPath [friend]
 


Member Data Documentation

vector<Component> YCPPathRep::components [private]
 


The documentation for this class was generated from the following files:
Generated on Fri Jun 16 18:07:46 2006 for yast2-core by  doxygen 1.4.6