Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

SLFileList Class Reference
[segusoland C++ Library]

Holds a list of SLFile instances. More...

#include <SLFileList.hpp>

Collaboration diagram for SLFileList:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SLFileList (unsigned int initial_capacity)
const SLFileoperator[] (unsigned int index) const
void push_back (const SLFile &file)
unsigned int size () const
void sort ()

Protected Attributes

boost::shared_ptr< Data > _shared_ptr
bool _isSorted

Detailed Description

Holds a list of SLFile instances.

Author:
Alexandre Sauve
See also:
SLFile
SLString uses shared_ptr, see the Library section for details.

This class is optimized for fast copy by value.

Example of code :

#include "SLFileList.hpp" SLFileList list(100); // builds an empty list with initial capacity of 100 list.push_back(SLFile("/home/user/myfile")); SLFile dev = list[0]; // access 1st element of the list list[0] = SLFile("/home/user2/anotherfile"); // no pointer at all // no need to call delete anywhere


Constructor & Destructor Documentation

SLFileList::SLFileList unsigned int  initial_capacity  ) 
 

Build the list with an initial capacity. The initial_capacity allow to avoid frequent reallocations.


Member Function Documentation

const SLFile& SLFileList::operator[] unsigned int  index  )  const
 

The [] operator allow to read the list as it was an array.

Returns:
a SLFile that is leak-proof.

void SLFileList::push_back const SLFile file  ) 
 

This function works like std::vector. There is no memory allocation while the size of the list remains bellow the initial capacity.

unsigned int SLFileList::size  )  const
 

Gets the size of the list.

Returns:
the current number of inserted items.

void SLFileList::sort  ) 
 

The list is unsorted by default. So this function does this work.

Note: If called more than once, the sort done only one time.


Member Data Documentation

bool SLFileList::_isSorted [protected]
 

This variables is true after the 1st call to sort()

boost::shared_ptr<Data> SLFileList::_shared_ptr [protected]
 

This variable hold the various data used by the string in an efficient and memory leaks proof way.


The documentation for this class was generated from the following file:
Generated on Mon Apr 19 01:03:36 2004 for segusoLand by doxygen 1.3.6-20040222