Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

Bounded::BoundedString< N, T > Class Template Reference

#include <boundedstring.h>

Collaboration diagram for Bounded::BoundedString< N, T >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<size_t N, class T = char>
class Bounded::BoundedString< N, T >

Simple wrapper for a C array of characters that acts like a regular string, but has a fixed maximum size (silently cropping) and a c_str() pointer that can be passed around safely.

Automatic conversion operator to a string is supported, which allows an object of this class to be passed directly into most functions expecting a string. However, some overload ambiguities may remain. If so, explicit conversion to string can be used where needed, either at the usage point or by implementing the appropriate function here using such a conversion.

Definition at line 30 of file boundedstring.h.

Public Methods

 BoundedString (const basic_string< T > &o)
void operator= (const basic_string< T > &o)
 Assignment copies all characters up to the bound, then adds terminator.

bool operator== (const char *o) const
 operator basic_string () const
 Automatic conversion to type string.

const T * c_str () const
 Returns a pointer to a C array of characters.


Member Function Documentation

template<size_t N, class T = char>
const T* Bounded::BoundedString< N, T >::c_str   const [inline]
 

Returns a pointer to a C array of characters.

Unlike regular string, this pointer will remain valid for the entire lifetime of this object.

Definition at line 49 of file boundedstring.h.


The documentation for this class was generated from the following file:
Generated on Mon Jan 20 02:37:34 2003 for RF-LISSOM by doxygen1.3-rc2