Generic string using unique instance memory. More...
#include <basic_symbol.hh>
Public Types | |
typedef std::basic_string < CharT, Traits, Alloc > | str_type |
equivalent string type | |
Public Member Functions | |
basic_symbol & | append (basic_symbol const &other) |
Append function. | |
basic_symbol (str_type const &str=str_type()) | |
Constructor. | |
basic_symbol (CharT const *str) | |
Constructor. | |
basic_symbol (basic_symbol const &other) | |
Copy constructor. | |
bool | empty () const |
Check if empty. | |
size_t | length () const |
length of symbol | |
bool | operator!= (basic_symbol const &other) const |
Difference test. | |
basic_symbol | operator+ (basic_symbol const &other) const |
Append operation. | |
basic_symbol & | operator+= (basic_symbol const &other) |
Append operator. | |
bool | operator< (basic_symbol const &other) const |
Ordering operator. | |
bool | operator<= (basic_symbol const &other) const |
Ordering operator. | |
basic_symbol & | operator= (basic_symbol const &other) |
Assignment operator. | |
bool | operator== (basic_symbol const &other) const |
Equality test. | |
bool | operator> (basic_symbol const &other) const |
Ordering operator. | |
bool | operator>= (basic_symbol const &other) const |
Ordering operator. | |
bool | starts_with (basic_symbol const &sub) const |
Check for beginning. | |
str_type const & | str () const |
Name of the symbol. | |
~basic_symbol () | |
Destructor. | |
Private Types | |
typedef smart::uniq_pointer < str_type >::type | ref_type |
Static Private Member Functions | |
static ref_type | create (str_type const &str) |
Private Attributes | |
ref_type | name |
Friends | |
struct | hash |
Related Functions | |
(Note that these are not member functions.) | |
template<class CharT , class Traits , class Alloc > | |
std::ostream & | operator<< (std::ostream &out, basic_symbol< CharT, Traits, Alloc > const &s) |
printing function |
Generic string using unique instance memory.
This class implements constant string named symbols based on utilmm::smart::uniq_pointer
CharT | The char type for the string |
Traits | The character traits for CharT |
Alloc | allocator for the string |
Definition at line 26 of file basic_symbol.hh.
typedef smart::uniq_pointer<str_type>::type utilmm::basic_symbol< CharT, Traits, Alloc >::ref_type [private] |
Definition at line 32 of file basic_symbol.hh.
typedef std::basic_string<CharT, Traits, Alloc> utilmm::basic_symbol< CharT, Traits, Alloc >::str_type |
equivalent string type
Definition at line 29 of file basic_symbol.hh.
utilmm::basic_symbol< CharT, Traits, Alloc >::basic_symbol | ( | str_type const & | str = str_type() | ) | [inline] |
Constructor.
str | name of the symbol |
Create a new symbol instance with name str
Definition at line 41 of file basic_symbol.hh.
utilmm::basic_symbol< CharT, Traits, Alloc >::basic_symbol | ( | CharT const * | str | ) | [inline] |
Constructor.
str | name of the symbol |
Create a new symbol instance with name str
Definition at line 49 of file basic_symbol.hh.
utilmm::basic_symbol< CharT, Traits, Alloc >::basic_symbol | ( | basic_symbol< CharT, Traits, Alloc > const & | other | ) | [inline] |
Copy constructor.
Definition at line 52 of file basic_symbol.hh.
utilmm::basic_symbol< CharT, Traits, Alloc >::~basic_symbol | ( | ) | [inline] |
Destructor.
Definition at line 56 of file basic_symbol.hh.
basic_symbol& utilmm::basic_symbol< CharT, Traits, Alloc >::append | ( | basic_symbol< CharT, Traits, Alloc > const & | other | ) |
Append function.
other | A symbol |
Thsi function appends to the end of current symbol name the name of other
static ref_type utilmm::basic_symbol< CharT, Traits, Alloc >::create | ( | str_type const & | str | ) | [static, private] |
bool utilmm::basic_symbol< CharT, Traits, Alloc >::empty | ( | ) | const [inline] |
Check if empty.
This function test if this symbol is an empty one (ie it has no name)
true | if symbol is empty |
false | else |
Definition at line 71 of file basic_symbol.hh.
size_t utilmm::basic_symbol< CharT, Traits, Alloc >::length | ( | ) | const [inline] |
bool utilmm::basic_symbol< CharT, Traits, Alloc >::operator!= | ( | basic_symbol< CharT, Traits, Alloc > const & | other | ) | const [inline] |
Difference test.
other | a symbol |
!operator==
(other) Definition at line 101 of file basic_symbol.hh.
basic_symbol utilmm::basic_symbol< CharT, Traits, Alloc >::operator+ | ( | basic_symbol< CharT, Traits, Alloc > const & | other | ) | const |
Append operation.
other | a symbol |
Thsi function creat a new symbol with a name that is the concatenation of the name of current insdtance and the name of other
basic_symbol& utilmm::basic_symbol< CharT, Traits, Alloc >::operator+= | ( | basic_symbol< CharT, Traits, Alloc > const & | other | ) | [inline] |
bool utilmm::basic_symbol< CharT, Traits, Alloc >::operator< | ( | basic_symbol< CharT, Traits, Alloc > const & | other | ) | const |
Ordering operator.
bool utilmm::basic_symbol< CharT, Traits, Alloc >::operator<= | ( | basic_symbol< CharT, Traits, Alloc > const & | other | ) | const [inline] |
Ordering operator.
Definition at line 112 of file basic_symbol.hh.
basic_symbol& utilmm::basic_symbol< CharT, Traits, Alloc >::operator= | ( | basic_symbol< CharT, Traits, Alloc > const & | other | ) | [inline] |
Assignment operator.
Definition at line 59 of file basic_symbol.hh.
bool utilmm::basic_symbol< CharT, Traits, Alloc >::operator== | ( | basic_symbol< CharT, Traits, Alloc > const & | other | ) | const [inline] |
Equality test.
other | a symbol |
true | if current symbol has the same name as other |
false | else |
basic_symbol
is based on utilmm::smart::uniq_pointer this test is made in constant time Definition at line 92 of file basic_symbol.hh.
bool utilmm::basic_symbol< CharT, Traits, Alloc >::operator> | ( | basic_symbol< CharT, Traits, Alloc > const & | other | ) | const [inline] |
Ordering operator.
Definition at line 108 of file basic_symbol.hh.
bool utilmm::basic_symbol< CharT, Traits, Alloc >::operator>= | ( | basic_symbol< CharT, Traits, Alloc > const & | other | ) | const [inline] |
Ordering operator.
Definition at line 116 of file basic_symbol.hh.
bool utilmm::basic_symbol< CharT, Traits, Alloc >::starts_with | ( | basic_symbol< CharT, Traits, Alloc > const & | sub | ) | const |
Check for beginning.
sub | a symbol |
true | if the name of current insatnce starts with the name of sub |
false | else |
str_type const& utilmm::basic_symbol< CharT, Traits, Alloc >::str | ( | ) | const [inline] |
Name of the symbol.
utilmm::smart::null_access | The name of the symbol is empty |
Definition at line 168 of file basic_symbol.hh.
friend struct hash [friend] |
Definition at line 178 of file basic_symbol.hh.
std::ostream & operator<< | ( | std::ostream & | out, |
basic_symbol< CharT, Traits, Alloc > const & | s | ||
) | [related] |
printing function
out | An output stream |
s | A symbol |
This operator writes the names of s in out
ref_type utilmm::basic_symbol< CharT, Traits, Alloc >::name [private] |
Definition at line 173 of file basic_symbol.hh.