Public Types | Public Member Functions

FixedBuffer< Sizer, Validator > Class Template Reference
[Utility Library]

Template that supports strings of a fixed buffer size. More...

#include <fixed-buffer.h>

List of all members.

Public Types

typedef FixedBuffer< Sizer,
Validator > 
buff_type_t

Public Member Functions

 FixedBuffer (void) throw ()
 FixedBuffer (IN const buff_type_t &inbuf) throw ()
 FixedBuffer (IN const char *input)
void clear (void) throw ()
bool isEmpty (void) const throw ()
bool operator! () const throw ()
 operator const char * () const throw ()
 operator bool () const throw ()
void set (IN const char *val)
 set() will take an arbitrary string, and assign it to the fixed buffer.

Detailed Description

template<class Sizer, class Validator>
class FixedBuffer< Sizer, Validator >

Template that supports strings of a fixed buffer size.

This class is most useful when you want to add a string to a struct or class with a set size, and don't want to deal with memory allocations using std::string.

You have to provide two classes to use a FixedBuffer template:

Some example Sizers and Validators are included in this file.

Definition at line 62 of file fixed-buffer.h.


Member Typedef Documentation

template<class Sizer , class Validator >
typedef FixedBuffer<Sizer, Validator> FixedBuffer< Sizer, Validator >::buff_type_t

Definition at line 65 of file fixed-buffer.h.


Constructor & Destructor Documentation

template<class Sizer , class Validator >
FixedBuffer< Sizer, Validator >::FixedBuffer ( void   )  throw () [inline]

Definition at line 68 of file fixed-buffer.h.

template<class Sizer , class Validator >
FixedBuffer< Sizer, Validator >::FixedBuffer ( IN const buff_type_t inbuf  )  throw () [inline]

Definition at line 69 of file fixed-buffer.h.

template<class Sizer , class Validator >
FixedBuffer< Sizer, Validator >::FixedBuffer ( IN const char *  input  )  [inline]

Definition at line 70 of file fixed-buffer.h.


Member Function Documentation

template<class Sizer , class Validator >
void FixedBuffer< Sizer, Validator >::clear ( void   )  throw () [inline]

Definition at line 76 of file fixed-buffer.h.

template<class Sizer , class Validator >
bool FixedBuffer< Sizer, Validator >::isEmpty ( void   )  const throw () [inline]

Definition at line 81 of file fixed-buffer.h.

template<class Sizer , class Validator >
bool FixedBuffer< Sizer, Validator >::operator! ( void   )  const throw () [inline]

Definition at line 82 of file fixed-buffer.h.

template<class Sizer , class Validator >
FixedBuffer< Sizer, Validator >::operator const char * (  )  const throw () [inline]

Definition at line 83 of file fixed-buffer.h.

template<class Sizer , class Validator >
FixedBuffer< Sizer, Validator >::operator bool ( void   )  const throw () [inline]

Definition at line 84 of file fixed-buffer.h.

template<class Sizer , class Validator >
void FixedBuffer< Sizer, Validator >::set ( IN const char *  val  )  [inline]

set() will take an arbitrary string, and assign it to the fixed buffer.

There are two passes over the input string: once to validate, and once to copy. This is slightly inefficient, but guarantees that the fixed buffer string is never corrupted by bad input. An input string is considered invalid if it is longer than the fixed buffer can hold, or if it contains invalid characters. If the input is invalid, this routine will throw an exception.

Definition at line 94 of file fixed-buffer.h.


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