Webdar 1.0.0
Web user interface to libdar
Public Member Functions | List of all members
chemin Class Reference

class chemin definition More...

#include <chemin.hpp>

Public Member Functions

 chemin ()
 constucts an empty path
 
 chemin (const std::string &path)
 
 chemin (const chemin &ref)=default
 
 chemin (chemin &&ref) noexcept=default
 
cheminoperator= (const chemin &ref)=default
 
cheminoperator= (chemin &&ref) noexcept=default
 
void clear ()
 default copy constructor is OK More...
 
bool operator== (const chemin &ref) const
 compaires two path
 
bool operator!= (const chemin &ref) const
 
bool is_the_beginning_of (const chemin &ref) const
 return true if 'this' is the beginning of ref
 
void operator+= (const chemin &ref)
 concatenate a path to this object
 
chemin operator+ (const chemin &ref) const
 concatenate a path with us another
 
void push_back (const std::string &x)
 add a member at the end of the path
 
std::string front () const
 get the first member of the path More...
 
std::string back () const
 get the last member of the path More...
 
void pop_front ()
 
void pop_back ()
 removes the last member of the path from this object
 
unsigned int size () const
 returns the size of the path in number of members
 
bool empty () const
 return true if the path is an empty path (having no members)
 
unsigned int get_index () const
 
void increase_index () const
 set the index to the next member. If the member is the last of the path this call does nothing
 
void decrease_index () const
 set the index to the previous member. If the member is the first of the path, this call does nothing
 
void set_index (unsigned int val) const
 set the index to an arbitrary value. An exception is thrown if the given value is greater or equal the path size
 
std::string display (bool relative=false) const
 return a string corresponding to the expected value of an absolute path
 
std::string namify () const
 
const std::string & operator[] (unsigned int x) const
 

Detailed Description

class chemin definition

Note
"chemin" means path in French, this class implements path objects. There is no relative/absolute caracteristics in these objects, Only at display() time one can decide to given a string representing the path as either absolute or relative.
Examples
/home/denis/Webdar/webdar/src/html_form_input_file.hpp.

Member Function Documentation

◆ back()

std::string chemin::back ( ) const
inline

get the last member of the path

Note
if the path is empty() an exception_range is thrown

◆ clear()

void chemin::clear ( )
inline

default copy constructor is OK

default assignement operator is OK too default destructor is also fine here set the path as an empty path

◆ front()

std::string chemin::front ( ) const
inline

get the first member of the path

Note
if the path is empty() an exception_range is thrown

◆ get_index()

unsigned int chemin::get_index ( ) const
inline

return the index of the path

Note
the index is a pointer to a member of the path. Zero is the first member the index can be modified at will even on const objects, but always points to a valid member of the path. If the path is empty, playing with index raises an exception

◆ namify()

string chemin::namify ( ) const

return a compact string to be used as identifier.

Note
Two different path give two different strings, two equal path give the same identifier

◆ operator[]()

const string & chemin::operator[] ( unsigned int  x) const

access to a given member of the path

Parameters
[in]xindex of the path to retrieve. This argument value must range from zero to size-1
Returns
the requested member of the path
Note
if called on an empty path, an exception is thrown.

◆ pop_front()

void chemin::pop_front ( )

removes the first member of the path from this object (root side)

Note
throws an exception if the path is empty

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