DigitalSpaces::DIStringPairListImpl Class Reference
[Lists]

#include <ContainerImplementations.h>

Inherits DigitalSpaces::DIStringPairList.


Detailed Description

Implements DIStringPairList, a list of string pairs.

We cant use DIList1 here because its not a list of interfaces.


Public Member Functions

 DIStringPairListImpl ()
 Default constructor.
 DIStringPairListImpl (const std::list< std::pair< std::string, std::string > > &)
 Construct the object, copying the items from the provided STL list.
 DIStringPairListImpl (const DIStringPairListImpl &)
 Copy constructor.
virtual ~DIStringPairListImpl ()
 Generic Destructor.
std::list< std::pair
< std::string, std::string > > & 
GetList ()
 Returns a direct reference to the implementations collection.
Class preparation functions.
These are used to append objects to the implementations list.

void AddItem (const char *left, const char *right)
 Add specified strings to the end of the contained list.
void AddItem (const std::string &left, const std::string &right)
 Add specified strings to the end of the contained list.
Interface Functions
These functions are those required by DIStringPairList

void Restart ()
 Resets "current" to the first item.
const char * GetCurrentLeft ()
 Gets the left half of the "current" entry.
const char * GetCurrentRight ()
 Gets the right half of the "current" entry.
bool Advance ()
 Advances "current".
bool AtEnd ()
 Check if "current" is past the end of the list.
unsigned int Size ()
 Returns the length of the list.
bool Empty ()
 Check if the list is empty.
void PushBack (const char *left, const char *right)
 Appends a pair of strings to the list.
void Clear ()
 Removes all items from the list.

Static Public Member Functions

static std::list< std::pair
< std::string, std::string > > 
Convert (DIStringPairList *)
 Helpful conversion function for DIStringPairList to std::list<std::pair<std::string,std::string> >.

Protected Attributes

std::list< std::pair
< std::string, std::string >
>::iterator 
m_iterator
 Storage for "current".
std::list< std::pair
< std::string, std::string > > 
m_list
 The collection this implementation is wrapping.

Constructor & Destructor Documentation

DigitalSpaces::DIStringPairListImpl::DIStringPairListImpl (  ) 

Default constructor.

Initializes and empty list.

DigitalSpaces::DIStringPairListImpl::DIStringPairListImpl ( const std::list< std::pair< std::string, std::string > > &   ) 

Construct the object, copying the items from the provided STL list.

"Current" will be set to the start of the new list.

DigitalSpaces::DIStringPairListImpl::DIStringPairListImpl ( const DIStringPairListImpl  ) 

Copy constructor.

Copys the list contents, however it puts "Current" at the beginning of the copied list.

virtual DigitalSpaces::DIStringPairListImpl::~DIStringPairListImpl (  )  [virtual]

Generic Destructor.


Member Function Documentation

void DigitalSpaces::DIStringPairListImpl::AddItem ( const char *  left,
const char *  right 
)

Add specified strings to the end of the contained list.

void DigitalSpaces::DIStringPairListImpl::AddItem ( const std::string &  left,
const std::string &  right 
)

Add specified strings to the end of the contained list.

void DigitalSpaces::DIStringPairListImpl::Restart (  ) 

Resets "current" to the first item.

Reimplemented from DigitalSpaces::DIStringPairList.

const char* DigitalSpaces::DIStringPairListImpl::GetCurrentLeft (  ) 

Gets the left half of the "current" entry.

Reimplemented from DigitalSpaces::DIStringPairList.

const char* DigitalSpaces::DIStringPairListImpl::GetCurrentRight (  ) 

Gets the right half of the "current" entry.

Reimplemented from DigitalSpaces::DIStringPairList.

bool DigitalSpaces::DIStringPairListImpl::Advance (  ) 

Advances "current".

Returns:
False if at the end of the list. In this case, the result from GetCurrent is undefined.

Reimplemented from DigitalSpaces::DIStringPairList.

bool DigitalSpaces::DIStringPairListImpl::AtEnd (  ) 

Check if "current" is past the end of the list.

This will be the same as checking if Advance has returned false. If true, GetCurrent returns undefined answers.

Returns:
True if at the end of the list, false if not.

Reimplemented from DigitalSpaces::DIStringPairList.

unsigned int DigitalSpaces::DIStringPairListImpl::Size (  ) 

Returns the length of the list.

Reimplemented from DigitalSpaces::DIStringPairList.

bool DigitalSpaces::DIStringPairListImpl::Empty (  ) 

Check if the list is empty.

Depending on the implementation, this may be faster then calling Size and comparing to zero, particularly in cases where the list is not empty.

Reimplemented from DigitalSpaces::DIStringPairList.

void DigitalSpaces::DIStringPairListImpl::PushBack ( const char *  left,
const char *  right 
)

Appends a pair of strings to the list.

Reimplemented from DigitalSpaces::DIStringPairList.

void DigitalSpaces::DIStringPairListImpl::Clear (  ) 

Removes all items from the list.

Reimplemented from DigitalSpaces::DIStringPairList.

std::list<std::pair<std::string,std::string> >& DigitalSpaces::DIStringPairListImpl::GetList (  )  [inline]

Returns a direct reference to the implementations collection.

This allows you to use STL functions to work with the list, rather then the more unwieldy interface functions.

Note:
Because this a reference, modifying this list (adding, removing, changing the contained value) will alter the list contained by this object.

static std::list<std::pair<std::string,std::string> > DigitalSpaces::DIStringPairListImpl::Convert ( DIStringPairList  )  [static]

Helpful conversion function for DIStringPairList to std::list<std::pair<std::string,std::string> >.

See DIStringPairListImpl( const std::list<std::pair<std::string,std::string> >& ) for conversion in other direction


Field Documentation

std::list<std::pair<std::string,std::string> >::iterator DigitalSpaces::DIStringPairListImpl::m_iterator [protected]

Storage for "current".

std::list<std::pair<std::string,std::string> > DigitalSpaces::DIStringPairListImpl::m_list [protected]

The collection this implementation is wrapping.

Referenced by GetList().


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

Generated on Sun Aug 31 17:46:32 2008 for Digital Spaces by  doxygen 1.5.6