Public Member Functions | Static Public Member Functions | Private Attributes | Friends

alize::XList Class Reference

#include <XList.h>

Inheritance diagram for alize::XList:
Inheritance graph
[legend]
Collaboration diagram for alize::XList:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 XList ()
 XList (const FileName &)
 XList (const FileName &, const Config &)
 XList (const XList &)
const XListoperator= (const XList &c)
bool operator== (const XList &c) const
bool operator!= (const XList &c) const
virtual ~XList ()
void load (const FileName &f, const Config &c)
void save (const FileName &f, const Config &c) const
void save (const FileName &f) const
XLineaddLine (String &key, String &value)
String searchValue (String &index)
XLineaddLine ()
void rewind () const
XLinegetLine (unsigned long lineIndex) const
XLinegetLine () const
XLinegetAllElements () const
unsigned long getLineCount () const
XLinefindLine (const String &key, unsigned long idx=0) const
void reset ()
virtual String toString () const
virtual String getClassName () const

Static Public Member Functions

static XListcreate ()

Private Attributes

RefVector< XLine_vector
unsigned long _current
XLine _line

Friends

class TestXList
class TestXListFileReader

Detailed Description

Class for

Author:
Frederic Wils frederic.wils@lia.univ-avignon.fr
Version:
1.0
Date:
2004

Definition at line 85 of file XList.h.


Constructor & Destructor Documentation

XList::XList (  )

Create an empty list

Definition at line 68 of file XList.cpp.

Referenced by create().

XList::XList ( const FileName f ) [explicit]

Definition at line 71 of file XList.cpp.

References load().

XList::XList ( const FileName f,
const Config c 
) [explicit]

Definition at line 74 of file XList.cpp.

References load().

XList::XList ( const XList l )
XList::~XList (  ) [virtual]

Definition at line 244 of file XList.cpp.

References _vector, and alize::RefVector< T >::deleteAllObjects().


Member Function Documentation

XLine & XList::addLine ( String key,
String value 
)

Appends a new line to the list. The line becomes the current line

Parameters:
keythe key of the line
valuethe value of the line
Returns:
a reference to the XLine object
Author:
richard.dufour@lium.univ-lemans.fr

Definition at line 151 of file XList.cpp.

References _current, _vector, alize::RefVector< T >::addObject(), and create().

Referenced by alize::CmdLine::CmdLine(), alize::Seg::merge(), alize::XListFileReader::readList(), alize::Matrix< T >::saveDT(), and alize::Config::setParam().

XLine & XList::addLine (  )

Appends a new line to the list. The line becomes the current line

Returns:
a reference to the XLine object

Definition at line 142 of file XList.cpp.

References _current, _vector, alize::RefVector< T >::addObject(), and create().

XList & XList::create (  ) [static]

Definition at line 77 of file XList.cpp.

References alize::Object::assertMemoryIsAllocated(), and XList().

Referenced by addLine().

XLine * XList::findLine ( const String key,
unsigned long  idx = 0 
) const

Finds a line. This line becomes the current line

Parameters:
keythe key
idxthe index of the key
Returns:
a pointer to the line if it exists; NULL otherwise

Definition at line 179 of file XList.cpp.

References _current, _vector, alize::XLine::getElement(), alize::XLine::getElementCount(), alize::RefVector< T >::getObject(), NULL, and alize::RefVector< T >::size().

Referenced by alize::Config::existsParam(), and alize::Config::getParam().

XLine & XList::getAllElements (  ) const

Gets all elements of the list.
The current element of the line is the first one.

Returns:
a reference to a XLine object that contains all elements of all lines

Definition at line 193 of file XList.cpp.

References _line, _vector, alize::XLine::addElement(), alize::XLine::getElement(), alize::XLine::getElementCount(), alize::RefVector< T >::getObject(), alize::XLine::reset(), and alize::RefVector< T >::size().

String XList::getClassName (  ) const [virtual]

Returns the name of the class

Returns:
the name of the class of the object as a String

Implements alize::Object.

Definition at line 213 of file XList.cpp.

XLine * XList::getLine (  ) const

Gets the current line. The next line becomes the current line.
The current element of the line is the first one.

Returns:
a pointer to the line if it exists; NULL otherwise

Definition at line 169 of file XList.cpp.

References _current, _vector, alize::RefVector< T >::getObject(), NULL, alize::XLine::rewind(), and alize::RefVector< T >::size().

XLine & XList::getLine ( unsigned long  lineIndex ) const

Gets a line by an index. The line becomes the current line.
The current element of the line is the first one.

Parameters:
lineIndexthe index of the line to get
Returns:
a reference to the XLine object
Exceptions:
IndexOutOfBoundsException

Definition at line 160 of file XList.cpp.

References _current, _vector, alize::RefVector< T >::getObject(), and alize::XLine::rewind().

Referenced by alize::CmdLine::copyIntoConfig(), alize::CmdLine::getContent(), alize::CmdLine::getName(), alize::Config::getParamContent(), alize::Config::getParamName(), alize::CmdLine::isShortOption(), alize::Matrix< T >::loadDT(), alize::Seg::merge(), alize::Config::setParam(), and alize::Config::toString().

unsigned long XList::getLineCount (  ) const

Gets the number of lines in the list

Returns:
the number of lines in the list

Definition at line 211 of file XList.cpp.

References _vector, and alize::RefVector< T >::size().

Referenced by alize::CmdLine::copyIntoConfig(), alize::CmdLine::getOptionCount(), alize::Config::getParamCount(), alize::Seg::merge(), save(), and alize::Config::setParam().

void XList::load ( const FileName f,
const Config c 
)

Loads a XList from a file

Parameters:
fthe file to read
cthe configuration to use
Exceptions:
IOExceptionif an I/O error occurs
FileNotFoundException

Definition at line 115 of file XList.cpp.

References alize::XListFileReader::readList().

Referenced by XList().

bool XList::operator!= ( const XList c ) const

Definition at line 113 of file XList.cpp.

const XList & XList::operator= ( const XList c )
bool XList::operator== ( const XList c ) const
void XList::reset (  )

Remove all lines

Definition at line 205 of file XList.cpp.

References _current, _vector, and alize::RefVector< T >::deleteAllObjects().

Referenced by alize::XListFileReader::readList(), and alize::Config::reset().

void XList::rewind (  ) const

Sets the first line to become the current line

Definition at line 158 of file XList.cpp.

References _current.

Referenced by alize::Matrix< T >::loadDT(), alize::XListFileReader::readList(), alize::Config::setParam(), and alize::Config::toString().

void XList::save ( const FileName f,
const Config c 
) const

Saves this XList in a ascii file

Parameters:
fthe file to create
cthe configuration to use

Definition at line 123 of file XList.cpp.

References _vector, alize::String::c_str(), alize::XLine::getElement(), alize::XLine::getElementCount(), getLineCount(), and alize::RefVector< T >::getObject().

Referenced by alize::Matrix< T >::saveDT().

void XList::save ( const FileName f ) const

Saves this XList in a ascii file

Parameters:
fthe file to create

Definition at line 121 of file XList.cpp.

References save().

Referenced by save().

String XList::searchValue ( String index )

Search the value of an index

Parameters:
indexthe index of the line
Returns:
the value
Author:
richard.dufour@lium.univ-lemans.fr

Definition at line 217 of file XList.cpp.

References _vector, alize::XLine::getElement(), alize::RefVector< T >::getObject(), and alize::RefVector< T >::size().

String XList::toString (  ) const [virtual]

This method is frequently overridden in the derived classes. If it is not, it returns the name of the class of the object and the address of the object

Returns:
a description of the object

Reimplemented from alize::Object.

Definition at line 231 of file XList.cpp.

References _vector, alize::XLine::getElement(), alize::XLine::getElementCount(), alize::RefVector< T >::getObject(), and alize::RefVector< T >::size().


Friends And Related Function Documentation

friend class TestXList [friend]

Definition at line 87 of file XList.h.

friend class TestXListFileReader [friend]

Definition at line 88 of file XList.h.


Member Data Documentation

unsigned long alize::XList::_current [mutable, private]

Definition at line 190 of file XList.h.

Referenced by addLine(), findLine(), getLine(), operator=(), reset(), and rewind().

XLine alize::XList::_line [mutable, private]

Definition at line 191 of file XList.h.

Referenced by getAllElements().


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