ContRap-Core
Public Member Functions

crp::List Class Reference

Class List represents list objects. More...

#include <list.h>

Inheritance diagram for crp::List:
crp::Object

Public Member Functions

 List ()
 Creates an empty list.
virtual ~List ()
 List destructor.
 List (const DPtr &first, const DPtr &second=DPtr::bottom, const DPtr &third=DPtr::bottom, const DPtr &fourth=DPtr::bottom)
 Creates a list with several objects.
 List (const List &argument)
 Creates a semantical copy of the list.
virtual void destroy ()
 Destroys the current instance.
virtual std::string get_type_name () const
 Returns the type of the object.
const DPtrfirst () const
 Provides a direct access to the first child (if exists)
DPtrfirst ()
 Provides a direct access to the first child (if exists)
const DPtrsecond () const
 Provides a direct access to the second child (if exists)
DPtrsecond ()
 Provides a direct access to the second child (if exists)
const DPtrthird () const
 Provides a direct access to the third child (if exists)
DPtrthird ()
 Provides a direct access to the third child (if exists)
const DPtrfourth () const
 Provides a direct access to the fourth child (if exists)
DPtrfourth ()
 Provides a direct access to the fourth child (if exists)
SPtr< Listmap (MapFunction function, void *extra=0)
 Applies a function to all the elements of the given list and returns the resulting new list.
DPtrat (size_t index)
 Synonym for the square brackets operator (inefficient)
const DPtrat (size_t index) const
 Synonym for the square brackets operator (inefficient)
const DPtroperator[] (size_t index) const
 Provides a direct access to a child (inefficient)
DPtroperator[] (size_t index)
 Provides a direct access to a child (inefficient)
void erase (List::iterator entry)
 Erases a list entry.
virtual Type get_type () const
 Returns the enumerated type of the object.
void push_back_compare (const DPtr &entry, DPtrCompare compare)
 Adds an element before the given position if no equal element is already inside the list.
virtual std::string to_string () const
 Converts the object to a non-formatted string.

Detailed Description

Class List represents list objects.


Constructor & Destructor Documentation

crp::List::List ( ) [inline]

Creates an empty list.

Parameters:
listStatement which should be treated as a list
virtual crp::List::~List ( ) [virtual]

List destructor.

crp::List::List ( const DPtr first,
const DPtr second = DPtr::bottom,
const DPtr third = DPtr::bottom,
const DPtr fourth = DPtr::bottom 
)

Creates a list with several objects.

Parameters:
first
second
third
fourth
crp::List::List ( const List argument) [inline]

Creates a semantical copy of the list.

Parameters:
argumentStatement which should be treated as a list

Member Function Documentation

DPtr& crp::List::at ( size_t  index) [inline]

Synonym for the square brackets operator (inefficient)

Parameters:
indexIndex of a child
Returns:
Value of the child
const DPtr& crp::List::at ( size_t  index) const [inline]

Synonym for the square brackets operator (inefficient)

Parameters:
indexIndex of a child
Returns:
Value of the child
virtual void crp::List::destroy ( ) [inline, virtual]

Destroys the current instance.

void crp::List::erase ( List::iterator  entry) [inline]

Erases a list entry.

Parameters:
entryEntry iterator
DPtr& crp::List::first ( ) [inline]

Provides a direct access to the first child (if exists)

Returns:
First child
const DPtr& crp::List::first ( ) const [inline]

Provides a direct access to the first child (if exists)

Returns:
First child
const DPtr& crp::List::fourth ( ) const [inline]

Provides a direct access to the fourth child (if exists)

Returns:
First child
DPtr& crp::List::fourth ( ) [inline]

Provides a direct access to the fourth child (if exists)

Returns:
First child
virtual Type crp::List::get_type ( ) const [inline, virtual]

Returns the enumerated type of the object.

Returns:
Type of the object

Reimplemented from crp::Object.

virtual std::string crp::List::get_type_name ( ) const [inline, virtual]

Returns the type of the object.

Returns:
Type of the object

Reimplemented from crp::Object.

SPtr<List> crp::List::map ( MapFunction  function,
void *  extra = 0 
) [inline]

Applies a function to all the elements of the given list and returns the resulting new list.

Parameters:
functionFunction to apply
extraExtra data for the function New list
DPtr& crp::List::operator[] ( size_t  index) [inline]

Provides a direct access to a child (inefficient)

Parameters:
indexIndex of a child
Returns:
Value of the child
const DPtr& crp::List::operator[] ( size_t  index) const [inline]

Provides a direct access to a child (inefficient)

Parameters:
indexIndex of a child
Returns:
Value of the child
void crp::List::push_back_compare ( const DPtr entry,
DPtrCompare  compare 
)

Adds an element before the given position if no equal element is already inside the list.

Parameters:
entryEntry to insert
compareComparison function
DPtr& crp::List::second ( ) [inline]

Provides a direct access to the second child (if exists)

Returns:
First child
const DPtr& crp::List::second ( ) const [inline]

Provides a direct access to the second child (if exists)

Returns:
First child
const DPtr& crp::List::third ( ) const [inline]

Provides a direct access to the third child (if exists)

Returns:
First child
DPtr& crp::List::third ( ) [inline]

Provides a direct access to the third child (if exists)

Returns:
First child
virtual std::string crp::List::to_string ( ) const [inline, virtual]

Converts the object to a non-formatted string.

Returns:
String representation of the object

Reimplemented from crp::Object.


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