Public Types | List of all members
blaze::InputString Class Reference

Implementation of a string wrapper.The InputString class is a wrapper class for the purpose to read input strings delimited by quotations from streams, like for instance "example input". All characters between the leading and the trailing quotation are extracted unchanged from the input stream, including whitespaces. The input string has to be in one single line. In case of input errors, the std::istream::failbit of the input stream is set. More...

#include <InputString.h>

Public Types

typedef std::string::size_type SizeType
 Size type of the InputString.
 

Public Member Functions

Constructors
 InputString (const char *string="")
 The default constructor for InputString. More...
 
 InputString (const std::string &string)
 Constructor for the direct initialization with a std::string. More...
 
 InputString (const InputString &s)
 The copy constructor for InputString. More...
 
Assignment operators
InputStringoperator= (const char *string)
 Assignment operator for C-style character strings. More...
 
InputStringoperator= (const std::string &string)
 Assignment operator for STL strings. More...
 
Access functions
char & operator[] (SizeType index)
 Direct access to the characters of the string. More...
 
const char & operator[] (SizeType index) const
 Direct access to the characters of the string. More...
 
Utility functions

The utility functions are named in the style of std::string.

const char * c_str () const
 Conversion to a constant character array. More...
 
const std::string & str () const
 Conversion to a std::string. More...
 
SizeType size () const
 Returns the size of the string. More...
 
SizeType capacity () const
 Returns the maximum capacity of the string. More...
 
bool empty () const
 Returns if the string is empty. More...
 
void reserve (SizeType newSize)
 Reserves at least size characters within the string. More...
 

Private Attributes

Member variables
std::string buffer_
 The character buffer.
 

Detailed Description

Implementation of a string wrapper.

The InputString class is a wrapper class for the purpose to read input strings delimited by quotations from streams, like for instance "example input". All characters between the leading and the trailing quotation are extracted unchanged from the input stream, including whitespaces. The input string has to be in one single line. In case of input errors, the std::istream::failbit of the input stream is set.

Constructor & Destructor Documentation

blaze::InputString::InputString ( const char *  string = "")
inlineexplicit

The default constructor for InputString.

Parameters
stringThe initial value for the string.
blaze::InputString::InputString ( const std::string &  string)
inlineexplicit

Constructor for the direct initialization with a std::string.

Parameters
stringThe initial value for the string.
blaze::InputString::InputString ( const InputString s)
inline

The copy constructor for InputString.

Parameters
sThe string object to be copied.

Member Function Documentation

const char * blaze::InputString::c_str ( ) const
inline

Conversion to a constant character array.

Returns
The converted constant character array.
InputString::SizeType blaze::InputString::capacity ( ) const
inline

Returns the maximum capacity of the string.

Returns
The capacity of the string.
bool blaze::InputString::empty ( ) const
inline

Returns if the string is empty.

Returns
true if the string is empty, false if it is not.
InputString & blaze::InputString::operator= ( const char *  string)
inline

Assignment operator for C-style character strings.

Parameters
stringThe C-style string to be copied.
Returns
Reference to the assigned string.
InputString & blaze::InputString::operator= ( const std::string &  string)
inline

Assignment operator for STL strings.

Parameters
stringThe STL string to be copied.
Returns
Reference to the assigned string.
char & blaze::InputString::operator[] ( SizeType  index)
inline

Direct access to the characters of the string.

Parameters
indexAccess index. The index has to be in the range $[0..size-1]$.
Returns
A reference to the indexed character.
const char & blaze::InputString::operator[] ( SizeType  index) const
inline

Direct access to the characters of the string.

Parameters
indexAccess index. The index has to be in the range $[0..size-1]$.
Returns
A reference to the indexed character.
void blaze::InputString::reserve ( SizeType  newSize)
inline

Reserves at least size characters within the string.

Parameters
newSizeThe minimum size of the string.
Returns
void
InputString::SizeType blaze::InputString::size ( ) const
inline

Returns the size of the string.

Returns
The size of the string.
const std::string & blaze::InputString::str ( ) const
inline

Conversion to a std::string.

Returns
The converted std::string.

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