Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Examples

YCPMapRep Class Reference

A mapping from keys to values. A map is also called assiciative array. It is a mapping from a set of keys to a set of values. Each key in a map is unique. Each key is assigned a value. Keys and values may only be String or Integer constants. Elements inside a map are kept in a sorted order based on the key value. More...

#include <YCPMap.h>

Inheritance diagram for YCPMapRep:

YCPValueRep YCPElementRep List of all members.

Public Member Functions

void add (const YCPValue &key, const YCPValue &value)
YCPMap functionalAdd (const YCPValue &key, const YCPValue &value) const
virtual const YCPElementRepshallowCopy () const
void remove (const YCPValue &key)
long size () const
YCPValue value (const YCPValue &key) const
YCPMapIterator begin () const
YCPMapIterator end () const
YCPOrder compare (const YCPMap &v) const
string toString () const
std::ostream & toStream (std::ostream &str) const
YCPValueType valuetype () const

Protected Member Functions

 YCPMapRep ()
 ~YCPMapRep ()

Private Member Functions

YCPMapIterator findKey (const YCPValue &key) const

Private Attributes

YCPValueYCPValueMap stl_map

Detailed Description

A mapping from keys to values. A map is also called assiciative array. It is a mapping from a set of keys to a set of values. Each key in a map is unique. Each key is assigned a value. Keys and values may only be String or Integer constants. Elements inside a map are kept in a sorted order based on the key value.


Constructor & Destructor Documentation

YCPMapRep::YCPMapRep  )  [protected]
 

Creates a new and empty mapping.

YCPMapRep::~YCPMapRep  )  [inline, protected]
 

Cleans up


Member Function Documentation

void YCPMapRep::add const YCPValue key,
const YCPValue value
 

Adds a new key/value pair. If the key is existent, the old entry will be overwritten with the new one.

YCPMapIterator YCPMapRep::begin  )  const
 

Returns a bidirectional STL iterator for the YCPMap that is positioned at the first value pair in the map. (suitable for iterating over all entries)

YCPOrder YCPMapRep::compare const YCPMap v  )  const
 

Compares two YCPMaps for equality, greaterness or smallerness. Comparison is done as follows: shorter < longer pairwise comparison for maps of equal length not being empty

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

YCPMapIterator YCPMapRep::end  )  const
 

Returns a bidirectional STL iterator for the YCPMap that is positioned BEHIND the last value pair in the map. (suitable for iterating over all entries)

YCPMapIterator YCPMapRep::findKey const YCPValue key  )  const [private]
 

Searches the map for a given key and returns an iterator that is positioned at the entry found. If the key can not be found the iterator is positioned at end().

YCPMap YCPMapRep::functionalAdd const YCPValue key,
const YCPValue value
const
 

Is like add, but doesn't change this map. It creates a newly created map.

void YCPMapRep::remove const YCPValue key  ) 
 

Remove a value from the map.

const YCPElementRep * YCPMapRep::shallowCopy  )  const [virtual]
 

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

Reimplemented from YCPElementRep.

long YCPMapRep::size  )  const
 

Returns the number of key/value pairs.

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

Output value as bytecode to stream

Implements YCPElementRep.

string YCPMapRep::toString  )  const [virtual]
 

Returns an ASCII representation of the map. Maps are denoted by a comma separated list of pairs of the form key : value enclosed in $[ ... ]

Implements YCPElementRep.

YCPValue YCPMapRep::value const YCPValue key  )  const
 

Looks for a certain key and returns the value assigned to that key. Returns 0, if the key is not found.

YCPValueType YCPMapRep::valuetype  )  const [virtual]
 

Returns YT_MAP. See YCPValueRep::valuetype.

Implements YCPValueRep.


Member Data Documentation

YCPValueYCPValueMap YCPMapRep::stl_map [private]
 


The documentation for this class was generated from the following files:
Generated on Fri Nov 9 18:15:25 2007 for yast2-core by doxygen 1.3.6