Util--  1.1
Public Types | Public Member Functions | Friends | Related Functions | List of all members
utilmm::basic_symbol< CharT, Traits, Alloc > Class Template Reference

Generic string using unique instance memory. More...

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

Public Types

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

Public Member Functions

 basic_symbol (str_type const &str=str_type())
 Constructor. More...
 
 basic_symbol (CharT const *str)
 Constructor. More...
 
 basic_symbol (basic_symbol const &other)
 Copy constructor. More...
 
 ~basic_symbol ()
 Destructor. More...
 
basic_symboloperator= (basic_symbol const &other)
 Assignment operator. More...
 
bool empty () const
 Check if empty. More...
 
size_t length () const
 length of symbol More...
 
bool operator== (basic_symbol const &other) const
 Equality test. More...
 
bool operator!= (basic_symbol const &other) const
 Difference test. More...
 
bool operator< (basic_symbol const &other) const
 Ordering operator. More...
 
bool operator> (basic_symbol const &other) const
 Ordering operator. More...
 
bool operator<= (basic_symbol const &other) const
 Ordering operator. More...
 
bool operator>= (basic_symbol const &other) const
 Ordering operator. More...
 
bool starts_with (basic_symbol const &sub) const
 Check for beginning. More...
 
basic_symbolappend (basic_symbol const &other)
 Append function. More...
 
basic_symboloperator+= (basic_symbol const &other)
 Append operator. More...
 
basic_symbol operator+ (basic_symbol const &other) const
 Append operation. More...
 
str_type const & str () const
 Name of the symbol. More...
 

Friends

template<typename Ty >
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 More...
 

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@l.nosp@m.aas..nosp@m.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
strname 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
strname 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 >::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&)

Referenced by utilmm::basic_symbol< CharT, Traits, Alloc >::operator+=(), and utilmm::basic_symbol< CharT, Traits, Alloc >::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
trueif symbol is empty
falseelse

References utilmm::smart::pointer< Manager >::null().

Referenced by utilmm::basic_symbol< CharT, Traits, Alloc >::length().

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

References utilmm::basic_symbol< CharT, Traits, Alloc >::empty().

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)

References utilmm::basic_symbol< CharT, Traits, Alloc >::operator<(), and utilmm::basic_symbol< CharT, Traits, Alloc >::operator==().

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

Referenced by utilmm::basic_symbol< CharT, Traits, Alloc >::operator+=().

template<class CharT, class Traits, class Alloc>
basic_symbol& utilmm::basic_symbol< CharT, Traits, Alloc >::operator+= ( basic_symbol< CharT, Traits, Alloc > const &  other)
inline
template<class CharT, class Traits, class Alloc>
bool utilmm::basic_symbol< CharT, Traits, Alloc >::operator< ( basic_symbol< CharT, Traits, Alloc > const &  other) const
template<class CharT, class Traits, class Alloc>
bool utilmm::basic_symbol< CharT, Traits, Alloc >::operator<= ( basic_symbol< CharT, Traits, Alloc > const &  other) const
inline
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 >::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

Referenced by utilmm::basic_symbol< CharT, Traits, Alloc >::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
template<class CharT, class Traits, class Alloc>
bool utilmm::basic_symbol< CharT, Traits, Alloc >::operator>= ( basic_symbol< CharT, Traits, Alloc > const &  other) const
inline
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

Referenced by utilmm::basic_symbol< CharT, Traits, Alloc >::operator>=().

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

Friends And Related Function Documentation

template<class CharT, class Traits, class Alloc>
template<typename Ty >
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
outAn output stream
sA symbol

This operator writes the names of s in out


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

Generated on Mon Oct 8 2018 08:38:45 for Util-- by doxygen 1.8.11
SourceForge.net Project Page