utilmm::basic_symbol< CharT, Traits, Alloc > Class Template Reference

Generic string using unique instance memory. More...

#include <utilmm/types/bits/basic_symbol.hh>

List of all members.

Public Types

typedef
std::basic_string
< CharT, Traits,
Alloc > 
str_type
 equivalent string type

Public Member Functions

 basic_symbol (str_type const &str=str_type())
 Constructor.
 basic_symbol (CharT const *str)
 Constructor.
 basic_symbol (basic_symbol const &other)
 Copy constructor.
 ~basic_symbol ()
 Destructor.
basic_symboloperator= (basic_symbol const &other)
 Assignment operator.
bool empty () const
 Check if empty.
size_t length () const
 length of symbol
bool operator== (basic_symbol const &other) const
 Equality test.
bool operator!= (basic_symbol const &other) const
 Difference test.
bool operator< (basic_symbol const &other) const
 Ordering operator.
bool operator> (basic_symbol const &other) const
 Ordering operator.
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.
basic_symbolappend (basic_symbol const &other)
 Append function.
basic_symboloperator+= (basic_symbol const &other)
 Append operator.
basic_symbol operator+ (basic_symbol const &other) const
 Append operation.
str_type const & str () const
 Name of the symbol.

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


Detailed Description

template<class CharT, class Traits, class Alloc>
class utilmm::basic_symbol< CharT, Traits, Alloc >

Generic string using unique instance memory.

This class implements constant string named symbols based on utilmm::smart::uniq_pointer

Parameters:
CharT The char type for the string
Traits The character traits for CharT
Alloc allocator for the string
Author:
Frédéric Py <fpy@laas.fr>

Member Typedef Documentation

template<class CharT, class Traits, class Alloc>
typedef std::basic_string<CharT, Traits, Alloc> utilmm::basic_symbol< CharT, Traits, Alloc >::str_type

equivalent string type


Constructor & Destructor Documentation

template<class CharT, class Traits, class Alloc>
utilmm::basic_symbol< CharT, Traits, Alloc >::basic_symbol ( str_type const &  str = str_type()  )  [inline]

Constructor.

Parameters:
str name of the symbol
Create a new symbol instance with name str

template<class CharT, class Traits, class Alloc>
utilmm::basic_symbol< CharT, Traits, Alloc >::basic_symbol ( CharT const *  str  )  [inline]

Constructor.

Parameters:
str name of the symbol
Create a new symbol instance with name str

template<class CharT, class Traits, class Alloc>
utilmm::basic_symbol< CharT, Traits, Alloc >::basic_symbol ( basic_symbol< CharT, Traits, Alloc > const &  other  )  [inline]

Copy constructor.

template<class CharT, class Traits, class Alloc>
utilmm::basic_symbol< CharT, Traits, Alloc >::~basic_symbol (  )  [inline]

Destructor.


Member Function Documentation

template<class CharT, class Traits, class Alloc>
basic_symbol& utilmm::basic_symbol< CharT, Traits, Alloc >::operator= ( basic_symbol< CharT, Traits, Alloc > const &  other  )  [inline]

Assignment operator.

template<class CharT, class Traits, class Alloc>
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)

Return values:
true if symbol is empty
false else

template<class CharT, class Traits, class Alloc>
size_t utilmm::basic_symbol< CharT, Traits, Alloc >::length (  )  const [inline]

length of symbol

Returns:
length of symbol name

template<class CharT, class Traits, class Alloc>
bool utilmm::basic_symbol< CharT, Traits, Alloc >::operator== ( basic_symbol< CharT, Traits, Alloc > const &  other  )  const [inline]

Equality test.

Parameters:
other a symbol
Return values:
true if current symbol has the same name as other
false else
Note:
as basic_symbol is based on utilmm::smart::uniq_pointer this test is made in constant time

template<class CharT, class Traits, class Alloc>
bool utilmm::basic_symbol< CharT, Traits, Alloc >::operator!= ( basic_symbol< CharT, Traits, Alloc > const &  other  )  const [inline]

Difference test.

Parameters:
other a symbol
Returns:
!operator==(other)

template<class CharT, class Traits, class Alloc>
bool utilmm::basic_symbol< CharT, Traits, Alloc >::operator< ( basic_symbol< CharT, Traits, Alloc > const &  other  )  const

Ordering operator.

template<class CharT, class Traits, class Alloc>
bool utilmm::basic_symbol< CharT, Traits, Alloc >::operator> ( basic_symbol< CharT, Traits, Alloc > const &  other  )  const [inline]

Ordering operator.

template<class CharT, class Traits, class Alloc>
bool utilmm::basic_symbol< CharT, Traits, Alloc >::operator<= ( basic_symbol< CharT, Traits, Alloc > const &  other  )  const [inline]

Ordering operator.

template<class CharT, class Traits, class Alloc>
bool utilmm::basic_symbol< CharT, Traits, Alloc >::operator>= ( basic_symbol< CharT, Traits, Alloc > const &  other  )  const [inline]

Ordering operator.

template<class CharT, class Traits, class Alloc>
bool utilmm::basic_symbol< CharT, Traits, Alloc >::starts_with ( basic_symbol< CharT, Traits, Alloc > const &  sub  )  const

Check for beginning.

Parameters:
sub a symbol
Return values:
true if the name of current insatnce starts with the name of sub
false else

template<class CharT, class Traits, class Alloc>
basic_symbol& utilmm::basic_symbol< CharT, Traits, Alloc >::append ( basic_symbol< CharT, Traits, Alloc > const &  other  ) 

Append function.

Parameters:
other A symbol
Thsi function appends to the end of current symbol name the name of other

Returns:
current instance after operation
See also:
operator+=(basic_symbol const&)

operator+(basic_symbol const&)

template<class CharT, class Traits, class Alloc>
basic_symbol& utilmm::basic_symbol< CharT, Traits, Alloc >::operator+= ( basic_symbol< CharT, Traits, Alloc > const &  other  )  [inline]

Append operator.

This is an alias for append

template<class CharT, class Traits, class Alloc>
basic_symbol utilmm::basic_symbol< CharT, Traits, Alloc >::operator+ ( basic_symbol< CharT, Traits, Alloc > const &  other  )  const

Append operation.

Parameters:
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

template<class CharT, class Traits, class Alloc>
str_type const& utilmm::basic_symbol< CharT, Traits, Alloc >::str (  )  const [inline]

Name of the symbol.

Returns:
The name of the symbol
Exceptions:
utilmm::smart::null_access The name of the symbol is empty


Friends And Related Function Documentation

template<class CharT, class Traits, class Alloc>
friend struct hash [friend]

template<class CharT, class Traits, class Alloc>
std::ostream & operator<< ( std::ostream &  out,
basic_symbol< CharT, Traits, Alloc > const &  s 
) [related]

printing function

Parameters:
out An output stream
s A symbol
This operator writes the names of s in out


The documentation for this class was generated from the following files:
Generated on Tue Feb 19 10:51:01 2008 for Util-- by doxygen 1.5.3
SourceForge.net Project Page