Files | |
file | segusoland.hpp |
Classes | |
class | SLConfig |
This class holds the configuration variables and their values. More... | |
class | SLConfig::NotFoundException |
Thrown when an element is not found in the container. More... | |
class | SLDevice |
This class holds a device name and its kind. More... | |
class | SLDeviceList |
Holds a list of SLDevice instances. More... | |
class | SLDirectory |
this class holds a directory (without the leading /) More... | |
class | SLDirectoryList |
Holds a list of SLDirectory instances. More... | |
class | SLException |
The exceptions top level class. More... | |
class | SLFile |
This class is used as a container for file names. More... | |
class | SLFile::Timestamp |
class | SLFileExt |
This class hold a file extention. More... | |
class | SLFileList |
Holds a list of SLFile instances. More... | |
class | SLIOException |
This class is the parent of all IO Exceptions. More... | |
class | SLMime |
This class describe the mime type of a SLFile object. More... | |
class | SLNotFoundException |
this class is the parent for all failures of finding elements. More... | |
class | SLString |
This class output localized UTF8 strings from any char* encoding. More... |
The classes provided make use of boost/shared_ptr. The template shared_ptr fix the main issues about memory leaks with C++ objects that contains pointer in a very clean fashion.
For example , with shared_ptr, there is no need to add "copy constructors" neither "affectation operators" because class instances are freed only when their last parent aggregate is destroyed.
More details here :
http://www.boost.org/libs/smart_ptr/shared_ptr.htm
Examples of code :
SLString s("This is a string"); // obviously s contains a pointer somewhere SLString s2("Another string"); // idem s = s2; // this is safe s = SLString("Another one string"); // safe too // The code above is safe because shared_ptr fix the issue of references // by keeping up to date a reference counter.
In general, the objects in this library makes deep copy of non-instance data in their constructor (char* strings for example) and makes fast copy with the class instances of objects from this library.
Example :
SLString s1("hello there"); // deep copy of "hello there" SLString s2(s1); // fast copy, the string "hello there" is accessible from // s1 and s2 but is present only once in memory. // When s1 and s2 will be destroyed, the string // "hello there" will be freed only once. magic! ;)
Many examples of code using library objects can be found in the library test file here : CVSROOT/segusoland/src/lib/test_lib.cpp