Public Types | Public Member Functions | Private Types | Static Private Member Functions | Private Attributes | Friends | Related Functions
utilmm::basic_symbol< CharT, Traits, Alloc > Class Template Reference

Generic string using unique instance memory. More...

#include <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_symbolappend (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_symboloperator+= (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_symboloperator= (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

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:
CharTThe char type for the string
TraitsThe character traits for CharT
Allocallocator for the string
Author:
Frédéric Py <fpy@laas.fr>

Definition at line 26 of file basic_symbol.hh.


Member Typedef Documentation

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

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

Definition at line 29 of file basic_symbol.hh.


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:
strname of the symbol

Create a new symbol instance with name str

Definition at line 41 of file basic_symbol.hh.

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

Constructor.

Parameters:
strname of the symbol

Create a new symbol instance with name str

Definition at line 49 of file basic_symbol.hh.

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.

Definition at line 52 of file basic_symbol.hh.

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

Destructor.

Definition at line 56 of file basic_symbol.hh.


Member Function Documentation

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:
otherA 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>
static ref_type utilmm::basic_symbol< CharT, Traits, Alloc >::create ( str_type const &  str) [static, private]
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:
trueif symbol is empty
falseelse

Definition at line 71 of file basic_symbol.hh.

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

Definition at line 78 of file basic_symbol.hh.

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:
othera symbol
Returns:
!operator==(other)

Definition at line 101 of file basic_symbol.hh.

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

Definition at line 147 of file basic_symbol.hh.

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.

Definition at line 112 of file basic_symbol.hh.

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.

Definition at line 59 of file basic_symbol.hh.

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:
othera symbol
Return values:
trueif current symbol has the same name as other
falseelse
Note:
as 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.

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.

Definition at line 108 of file basic_symbol.hh.

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.

Definition at line 116 of file basic_symbol.hh.

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:
suba symbol
Return values:
trueif the name of current insatnce starts with the name of sub
falseelse
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_accessThe name of the symbol is empty

Definition at line 168 of file basic_symbol.hh.


Friends And Related Function Documentation

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

Definition at line 178 of file basic_symbol.hh.

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

printing function

Parameters:
outAn output stream
sA symbol

This operator writes the names of s in out


Member Data Documentation

template<class CharT, class Traits, class Alloc>
ref_type utilmm::basic_symbol< CharT, Traits, Alloc >::name [private]

Definition at line 173 of file basic_symbol.hh.


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


utilmm
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Mon Oct 6 2014 03:17:01