UCommon
Public Member Functions
ucommon::keystring< S > Class Template Reference

A template to create a string array that automatically erases. More...

#include <secure.h>

Public Member Functions

void clear (void)
 Clear current key memory.
 
 keystring ()
 Create a new character buffer with an empty string.
 
 keystring (const char *text)
 Create a character buffer with assigned text. More...
 
size_t len (void) const
 Get current length of string. More...
 
 operator bool () const
 Test if data is contained in the object. More...
 
 operator char * ()
 Get text by casting reference. More...
 
bool operator! () const
 Test if the object is empty. More...
 
char * operator() (size_t offset)
 Get a pointer to an offset in the object by expression operator. More...
 
char * operator* ()
 Get text by object pointer reference. More...
 
void operator+= (const char *text)
 Concatenate text into the object. More...
 
void operator= (const char *text)
 Assign null terminated text to the object. More...
 
char & operator[] (size_t offset) const
 Array operator to get a character from the object. More...
 
size_t size (void) const
 Get allocated size of the object. More...
 
 ~keystring ()
 Clear memory when destroyed.
 

Detailed Description

template<size_t S>
class ucommon::keystring< S >

A template to create a string array that automatically erases.

This is a mini string/stringbuf class that supports a subset of functionality but does not require a complex supporting object. Like stringbuf, this can be used to create local string variables. When the object falls out of scope it's memory is reset.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition at line 786 of file secure.h.

Constructor & Destructor Documentation

template<size_t S>
ucommon::keystring< S >::keystring ( const char *  text)
inline

Create a character buffer with assigned text.

If the text is larger than the size of the object, it is truncated.

Parameters
textto assign.

Definition at line 808 of file secure.h.

Here is the call graph for this function:

Member Function Documentation

template<size_t S>
size_t ucommon::keystring< S >::len ( void  ) const
inline

Get current length of string.

Returns
length of string.

Definition at line 893 of file secure.h.

template<size_t S>
ucommon::keystring< S >::operator bool ( ) const
inline

Test if data is contained in the object.

Returns
true if there is text.

Definition at line 842 of file secure.h.

template<size_t S>
ucommon::keystring< S >::operator char * ( )
inline

Get text by casting reference.

Returns
pointer to text in object.

Definition at line 856 of file secure.h.

template<size_t S>
bool ucommon::keystring< S >::operator! ( ) const
inline

Test if the object is empty.

Returns
true if the object is empty.

Definition at line 849 of file secure.h.

template<size_t S>
char* ucommon::keystring< S >::operator() ( size_t  offset)
inline

Get a pointer to an offset in the object by expression operator.

Parameters
offsetof character in string buffer.
Returns
pointer to offset in object.

Definition at line 879 of file secure.h.

template<size_t S>
char* ucommon::keystring< S >::operator* ( )
inline

Get text by object pointer reference.

Returns
pointer to text in object.

Definition at line 863 of file secure.h.

template<size_t S>
void ucommon::keystring< S >::operator+= ( const char *  text)
inline

Concatenate text into the object.

If the text is larger than the size of the object, then it is truncated.

Parameters
textto append.

Definition at line 835 of file secure.h.

Here is the call graph for this function:

template<size_t S>
void ucommon::keystring< S >::operator= ( const char *  text)
inline

Assign null terminated text to the object.

Parameters
textto assign.

Definition at line 827 of file secure.h.

Here is the call graph for this function:

template<size_t S>
char& ucommon::keystring< S >::operator[] ( size_t  offset) const
inline

Array operator to get a character from the object.

Parameters
offsetof character in string buffer.
Returns
character at offset.

Definition at line 871 of file secure.h.

template<size_t S>
size_t ucommon::keystring< S >::size ( void  ) const
inline

Get allocated size of the object.

Returns
allocated size.

Definition at line 886 of file secure.h.


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