YCPTermRep Class Reference

YCPValueRep representing a term. A YCPTermRep is a YCPValue containing a list plus a string representing the term's name. More...

#include <YCPTerm.h>

Inheritance diagram for YCPTermRep:

YCPValueRep YCPElementRep

List of all members.

Public Member Functions

string name () const
YCPList args () const
YCPOrder compare (const YCPTerm &v) const
virtual const YCPElementRepshallowCopy () const
YCPTerm functionalAdd (const YCPValue &value) const
string toString () const
std::ostream & toStream (std::ostream &str) const
std::ostream & toXml (std::ostream &str, int indent) const
bool isEmpty () const
int size () const
void reserve (int size)
YCPValue value (int n) const
void set (const int n, const YCPValue &value)
void add (const YCPValue &value)
YCPValueType valuetype () const

Protected Member Functions

 YCPTermRep (const string &s)
 YCPTermRep (const string &s, const YCPList &l)
 ~YCPTermRep ()

Private Member Functions

void setName (string name)

Private Attributes

Ustring s
YCPList l

Friends

class YCPTerm


Detailed Description

YCPValueRep representing a term. A YCPTermRep is a YCPValue containing a list plus a string representing the term's name.

Constructor & Destructor Documentation

YCPTermRep::YCPTermRep ( const string &  s  )  [protected]

Creates a new and empty term with the string s.

Referenced by shallowCopy().

YCPTermRep::YCPTermRep ( const string &  s,
const YCPList l 
) [protected]

Creates a new term with the string s and argument list l.

YCPTermRep::~YCPTermRep (  )  [inline, protected]

Cleans up


Member Function Documentation

void YCPTermRep::add ( const YCPValue value  ) 

Mapping for the term's list add() function

References YCPList::add(), and l.

YCPList YCPTermRep::args (  )  const

Returns the term's arguments list

References l.

YCPOrder YCPTermRep::compare ( const YCPTerm v  )  const

Compares two YCPTerms for equality, greaterness or smallerness. The relation is lexicographically with respect to 1. the name of the term 2. the list of the term if the names are the same.

(( `alpha() == `alpha() ) == true ) (( `alpha() < `alpha( 1 ) ) == true ) (( `alpha( 1 ) == `alpha( 1 ) ) == true ) (( `alpha( 1 ) < `beta( 1 ) ) == true ) (( `alpha( 1 ) < `alpha( 2 ) ) == true ) (( `alpha( 1 ) < { term b = `beta( 1 ); return b; } ) == true ) term/term (( `alpha( 1 ) > { term b = `beta( 1 ); } ) == true ) term/nil

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 than v

References YCPTerm::args(), l, YCPTerm::name(), name(), YO_GREATER, and YO_LESS.

YCPTerm YCPTermRep::functionalAdd ( const YCPValue value  )  const

Creates a new term, that is identical to this one with but one new value appended. Doesn't change this term.

References Ustring::asString(), YCPList::functionalAdd(), l, s, and YCPTerm.

bool YCPTermRep::isEmpty (  )  const

Mapping for the term's list isEmpty() function

References YCPList::isEmpty(), and l.

string YCPTermRep::name (  )  const

Returns the term's name

References Ustring::asString(), and s.

Referenced by compare().

void YCPTermRep::reserve ( int  size  ) 

Mapping for the term's list reserve (int) function

References l, and YCPList::reserve().

void YCPTermRep::set ( const int  n,
const YCPValue value 
)

Mapping for the term's list set() function

References l, and YCPList::set().

void YCPTermRep::setName ( string  name  )  [private]

Set the new term name

References SymbolEntry::_nameHash, and s.

const YCPElementRep * YCPTermRep::shallowCopy (  )  const [virtual]

Creates a copy of this term, i.e. creates a new term with the same elements and the same name as this one. The elements themselves are not copied, but only cloned!

Reimplemented from YCPElementRep.

References Ustring::asString(), l, s, and YCPTermRep().

int YCPTermRep::size (  )  const

Mapping for the term's list size() function

References l, and YCPList::size().

std::ostream & YCPTermRep::toStream ( std::ostream &  str  )  const [virtual]

Output value as bytecode to stream

Implements YCPElementRep.

References l, s, Bytecode::writeUstring(), and y2debug.

string YCPTermRep::toString ( void   )  const [virtual]

Returns an ASCII representation of the term. Term are denoted by comma separated values enclosed by brackets precedeed by a name, for example `a(1,2) or `b() or `Hugo_17("hirn", c(true)).

Implements YCPElementRep.

References Ustring::asString(), YCPList::commaList(), l, and s.

std::ostream & YCPTermRep::toXml ( std::ostream &  str,
int  indent 
) const [virtual]

Implements YCPValueRep.

References l, and s.

YCPValue YCPTermRep::value ( int  n  )  const

Mapping for the term's list value() function

References l, and YCPList::value().

YCPValueType YCPTermRep::valuetype (  )  const [virtual]

Returns YT_TERM. See YCPValueRep::valuetype.

Implements YCPValueRep.

References YT_TERM.


Friends And Related Function Documentation

friend class YCPTerm [friend]

Referenced by functionalAdd().


Member Data Documentation

YCP list representing the term's arguments

Referenced by add(), args(), compare(), functionalAdd(), isEmpty(), reserve(), set(), shallowCopy(), size(), toStream(), toString(), toXml(), and value().

The terms name

Referenced by functionalAdd(), name(), setName(), shallowCopy(), toStream(), toString(), and toXml().


The documentation for this class was generated from the following files:

Generated on a sunny day for yast2-core by doxygen 1.5.9