estring Class Reference

An extended string class. More...

#include <estring.h>

Collaboration diagram for estring:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::string value_type
 The type from which estring inherits, std::string.
typedef value_type::size_type size_type
 The size type.
enum  alignment { left, right, center }
 Alignment values for formatted strings. More...
enum  set_from_type {
  type_string, type_unsigned_int, type_int, type_unsigned_short,
  type_short, type_unsigned_long, type_long, type_unsigned_long_long,
  type_long_long, type_float, type_double, type_char_ptr,
  type_void_ptr, type_unknown
}
 The type last assigned. More...

Public Member Functions

void init (void)
 Initialize the estring object.
void clear (void)
 Erase the string value.
void reset (void)
 Erase and reinitialize.
 estring ()
 Default constructor.
size_type width (const size_type a_l)
 Set the width of a formatted string.
size_type width (void) const
 Retrieve the set width for formatted strings.
alignment align (const alignment a_alignment)
 Set the alignment used for formatted strings.
alignment align (void) const
 Retrieve the set alignment for formatted strings.
char left_fillchar (const char a_char)
 Set the fill character used to padd the left side of a formatted string.
char left_fillchar (void) const
 Retrieve the fill character used to padd the left side of a formatted string.
char right_fillchar (const char a_char)
 Set the fill character used to padd the right side of a formatted string.
char right_fillchar (void) const
 Retrieve the fill character used to padd the right side of a formatted string.
void fillchar (const char a_char)
 Set the fill character used for padding both the left and right side of a formatted string.
value_type fmt_str (void)
 Generate a formatted string.
value_type fmt_str (const size_type a_width, const alignment a_alignment, const char a_left_fill, const char a_right_fill)
 Set all the formatting options.
size_type precision (size_type a_p)
 Set the precision used in converting to/from fractional types.
size_type precision (void) const
 Retrieve the set precision used in fractional conversions.
const unsigned int base (const unsigned int a_base)
 Set the base used in numeric conversions.
const unsigned int base (void) const
 Retrieve the base used in numeric conversions.
const set_from_typeget_from_type (void) const
 Retrieve the type of value being held by this estring.
const estring_valueget_from_value (void) const
 Retrieve the typeless_value being held by this estring.
 estring (const estring &a_estr)
 Copy constructor for estring objects.
estringassign (const estring &a_estr)
 Assignment for estring objects.
estringoperator= (const estring &a_estr)
 Assignment operator for estring objects.
estringlower (void)
 Convert all characters to lowercase.
estringupper (void)
 Convert all characters to uppercase.
 estring (const char a_char)
 Copy constructor for chars.
estringassign (const char a_char)
 Assignment for chars.
estringoperator= (const char a_char)
 Assignment operator for chars.
 estring (const value_type &a_string)
 Copy constructor for std::string objects.
estringassign (const value_type &a_string)
 Assignment for std::string objects.
estringoperator= (const value_type &a_string)
 Assignment operator for std::string objects.
 estring (const unsigned int a_int)
 Copy constructor for unsigned ints.
estringassign (const unsigned int a_int)
 Assignment for unsigned ints.
estringoperator= (const unsigned int a_int)
 Assignment operator for unsigned ints.
 operator unsigned int () const
 Implicit conversion operator to an unsigned int.
 estring (const int a_int)
estringassign (const int a_int)
estringoperator= (const int a_int)
 operator int () const
 estring (const unsigned short a_short)
estringassign (const unsigned short a_short)
estringoperator= (const unsigned short a_short)
 operator unsigned short () const
 estring (const short a_short)
estringassign (const short a_short)
estringoperator= (const short a_short)
 operator short () const
 estring (const unsigned long a_long)
estringassign (const unsigned long a_long)
estringoperator= (const unsigned long a_long)
 operator unsigned long () const
 estring (const long a_long)
estringassign (const long a_long)
estringoperator= (const long a_long)
 operator long () const
 estring (const unsigned long long a_long)
estringassign (const unsigned long long a_long)
estringoperator= (const unsigned long long a_long)
 operator unsigned long long () const
 estring (const long long a_long)
estringassign (const long long a_long)
estringoperator= (const long long a_long)
 operator long long () const
 estring (char *const a_ptr)
estringassign (char *const a_ptr)
estringoperator= (char *const a_ptr)
 operator char * () const
 estring (void *const a_ptr)
estringassign (void *const a_ptr)
estringoperator= (void *const a_ptr)
 operator void * () const
 estring (const float a_float)
estringassign (const float a_float)
estringoperator= (const float a_float)
 estring (const float a_float, unsigned a_precision, unsigned int a_base=10)
estringassign (const float a_float, unsigned a_precision, unsigned int a_base=10)
 operator float () const
 estring (const double a_double)
estringassign (const double a_double)
estringoperator= (const double a_double)
 estring (const double a_double, unsigned a_precision, unsigned int a_base=10)
estringassign (const double a_double, unsigned a_precision, unsigned int a_base=10)
 operator double () const

Private Member Functions

template<class T>
void T_fraction_to_strings (const T &a_t, value_type &a_ws, value_type &a_fs)
 Helper member template function to convert a fractional type to an estring.
template<class T>
void T_integral_to_string (const T &a_t, value_type &a_str)
 Helper member template function to convert an integral type to an estring.
template<class T>
void T_string_to_integral (const value_type &a_str, T &a_t) const
 Helper member template function to convert a string to an integral type.
template<class T>
void T_string_to_signed_integral (const value_type &a_str, T &a_t) const
 Helper member template function to convert a string to a signed integral.
template<class T>
void T_string_to_fractional (const value_type &a_str, T &a_t) const
 Helper member template function to convert a string to a fractional.

Private Attributes

size_type m_precision
 The current fractional number precision.
unsigned int m_base
 The current numerical base.
size_type m_width
 The current formatting width.
alignment m_alignment
 The current formatting alignment.
char m_left_fillchar
 The current left-hand fill character.
char m_right_fillchar
 The current right-hand fill character.
set_from_type m_type
 The current value type.
estring_value m_value
 The current value.

Static Private Attributes

static const char * m_alphabet = "0123456789abcdefghijklmnopqrstuvwxyz"
 The alphabet used for any base from 2 to 36.
static const size_t m_alphabet_len = 36
 The length of the alphabet.

Detailed Description

An extended string class.

Estring is a derivative of std::string with extra functionality added in order to fascilitate (a) the conversion to strings from other types, (b) special formatting of those converted strings, and (c) the conversion back from a string to some other type.

Definition at line 52 of file estring.h.


Member Typedef Documentation

typedef value_type::size_type estring::size_type
 

The size type.

Definition at line 59 of file estring.h.

typedef std::string estring::value_type
 

The type from which estring inherits, std::string.

Definition at line 56 of file estring.h.


Member Enumeration Documentation

enum estring::alignment
 

Alignment values for formatted strings.

Enumeration values:
left  Left-justified.
right  Right-justified.
center  Centered.

Definition at line 62 of file estring.h.

enum estring::set_from_type
 

The type last assigned.

Enumeration values:
type_string  std::string
type_unsigned_int  unsigned int
type_int  int
type_unsigned_short  unsigned short
type_short  short
type_unsigned_long  unsigned long
type_long  long
type_unsigned_long_long  unsigned long long
type_long_long  long long
type_float  float
type_double  double
type_char_ptr  char*
type_void_ptr  void*
type_unknown  unknown

Definition at line 72 of file estring.h.


Constructor & Destructor Documentation

estring::estring  ) 
 

Default constructor.

Definition at line 417 of file estring.cc.

References init().

Here is the call graph for this function:

estring::estring const estring a_estr  ) 
 

Copy constructor for estring objects.

Variables:

  • a_estr - the estring object to copy.

Exceptions:

Definition at line 820 of file estring.cc.

References assign(), and init().

Here is the call graph for this function:

estring::estring const char  a_char  ) 
 

Copy constructor for chars.

Exceptions:

  • Anything thrown by estring::assign(const char& a_char).

Definition at line 912 of file estring.cc.

References assign(), and init().

Here is the call graph for this function:

estring::estring const value_type a_string  ) 
 

Copy constructor for std::string objects.

Variables:

  • a_string - the std::string object to copy.

Exceptions:

Definition at line 968 of file estring.cc.

References assign(), and init().

Here is the call graph for this function:

estring::estring const unsigned int  a_int  ) 
 

Copy constructor for unsigned ints.

Variables:

  • a_int - unsigned int to copy.

Exceptions:

  • Anything thrown by estring::assign(const unsigned int& a_int).

Definition at line 1021 of file estring.cc.

References assign(), and init().

Here is the call graph for this function:

estring::estring const int  a_int  ) 
 

Definition at line 1077 of file estring.cc.

References assign(), and init().

Here is the call graph for this function:

estring::estring const unsigned short  a_short  ) 
 

Definition at line 1120 of file estring.cc.

References assign(), and init().

Here is the call graph for this function:

estring::estring const short  a_short  ) 
 

Definition at line 1159 of file estring.cc.

References assign(), and init().

Here is the call graph for this function:

estring::estring const unsigned long  a_long  ) 
 

Definition at line 1202 of file estring.cc.

References assign(), and init().

Here is the call graph for this function:

estring::estring const long  a_long  ) 
 

Definition at line 1241 of file estring.cc.

References assign(), and init().

Here is the call graph for this function:

estring::estring const unsigned long long  a_long  ) 
 

Definition at line 1284 of file estring.cc.

References assign(), and init().

Here is the call graph for this function:

estring::estring const long long  a_long  ) 
 

Definition at line 1323 of file estring.cc.

References assign(), and init().

Here is the call graph for this function:

estring::estring char *const   a_ptr  ) 
 

Definition at line 1366 of file estring.cc.

References assign(), and init().

Here is the call graph for this function:

estring::estring void *const   a_ptr  ) 
 

Definition at line 1407 of file estring.cc.

References assign(), and init().

Here is the call graph for this function:

estring::estring const float  a_float  ) 
 

Definition at line 1449 of file estring.cc.

References assign(), and init().

Here is the call graph for this function:

estring::estring const float  a_float,
unsigned  a_precision,
unsigned int  a_base = 10
 

Definition at line 1483 of file estring.cc.

References assign(), and init().

Here is the call graph for this function:

estring::estring const double  a_double  ) 
 

Definition at line 1516 of file estring.cc.

References assign(), and init().

Here is the call graph for this function:

estring::estring const double  a_double,
unsigned  a_precision,
unsigned int  a_base = 10
 

Definition at line 1550 of file estring.cc.

References assign(), and init().

Here is the call graph for this function:


Member Function Documentation

estring::alignment estring::align void   )  const
 

Retrieve the set alignment for formatted strings.

Returns:

  • enum alignment - the current alignment.

Definition at line 472 of file estring.cc.

References m_alignment.

Referenced by fmt_str().

estring::alignment estring::align const alignment  a_alignment  ) 
 

Set the alignment used for formatted strings.

Vaiables:

  • a_alignment - the type of alignment to use for formatting strings.

Definition at line 457 of file estring.cc.

References m_alignment.

Referenced by report_manager::format_synopsis(), jobs_report::format_synopsis(), vault_report::format_synopsis(), timestamp::make_str_(), num_to_string(), percent_string(), test1(), test4(), jobs_report::write_report(), and vault_report::write_report().

estring & estring::assign const double  a_double,
unsigned  a_precision,
unsigned int  a_base = 10
 

Definition at line 1557 of file estring.cc.

References assign(), and precision().

Here is the call graph for this function:

estring & estring::assign const double  a_double  ) 
 

Definition at line 1522 of file estring.cc.

References estring_value::clear(), m_type, m_value, T_fraction_to_strings(), TRY, TRY_nomem, type_double, and estring_value::value.

Here is the call graph for this function:

estring & estring::assign const float  a_float,
unsigned  a_precision,
unsigned int  a_base = 10
 

Definition at line 1490 of file estring.cc.

References assign(), base(), and precision().

Here is the call graph for this function:

estring & estring::assign const float  a_float  ) 
 

Definition at line 1455 of file estring.cc.

References estring_value::clear(), m_type, m_value, T_fraction_to_strings(), TRY, TRY_nomem, type_float, and estring_value::value.

Here is the call graph for this function:

estring & estring::assign void *const   a_ptr  ) 
 

Definition at line 1413 of file estring.cc.

References estring_value::clear(), m_type, m_value, TRY_nomem, type_void_ptr, and estring_value::value.

Here is the call graph for this function:

estring & estring::assign char *const   a_ptr  ) 
 

Definition at line 1372 of file estring.cc.

References assign(), estring_value::clear(), m_type, m_value, TRY_nomem, type_char_ptr, and estring_value::value.

Here is the call graph for this function:

estring & estring::assign const long long  a_long  ) 
 

Definition at line 1329 of file estring.cc.

References assign(), estring_value::clear(), m_type, m_value, TRY, TRY_nomem, type_long_long, and estring_value::value.

Here is the call graph for this function:

estring & estring::assign const unsigned long long  a_long  ) 
 

Definition at line 1290 of file estring.cc.

References estring_value::clear(), m_type, m_value, T_integral_to_string(), TRY, TRY_nomem, type_unsigned_long_long, and estring_value::value.

Here is the call graph for this function:

estring & estring::assign const long  a_long  ) 
 

Definition at line 1247 of file estring.cc.

References assign(), estring_value::clear(), m_type, m_value, TRY, TRY_nomem, type_long, and estring_value::value.

Here is the call graph for this function:

estring & estring::assign const unsigned long  a_long  ) 
 

Definition at line 1208 of file estring.cc.

References estring_value::clear(), m_type, m_value, T_integral_to_string(), TRY, TRY_nomem, type_unsigned_long, and estring_value::value.

Here is the call graph for this function:

estring & estring::assign const short  a_short  ) 
 

Definition at line 1165 of file estring.cc.

References assign(), estring_value::clear(), m_type, m_value, TRY, TRY_nomem, type_short, and estring_value::value.

Here is the call graph for this function:

estring & estring::assign const unsigned short  a_short  ) 
 

Definition at line 1126 of file estring.cc.

References estring_value::clear(), m_type, m_value, T_integral_to_string(), TRY, TRY_nomem, type_unsigned_short, and estring_value::value.

Here is the call graph for this function:

estring & estring::assign const int  a_int  ) 
 

Definition at line 1083 of file estring.cc.

References assign(), estring_value::clear(), m_type, m_value, TRY, TRY_nomem, type_int, and estring_value::value.

Here is the call graph for this function:

estring & estring::assign const unsigned int  a_int  ) 
 

Assignment for unsigned ints.

Variables:

  • a_int - unsigned int to assign.

Returns:

  • estring& - a reference to self.

Exceptions:

Definition at line 1040 of file estring.cc.

References estring_value::clear(), m_type, m_value, T_integral_to_string(), TRY, TRY_nomem, type_unsigned_int, and estring_value::value.

Here is the call graph for this function:

estring & estring::assign const value_type a_string  ) 
 

Assignment for std::string objects.

Variables:

  • a_string - the std::string object to assign.

Returns:

  • estring& - a reference to self.

Exceptions:

  • An err_nomem is thrown if memory allocation fails.

Definition at line 985 of file estring.cc.

References m_type, TRY_nomem, and type_string.

estring & estring::assign const char  a_char  ) 
 

Assignment for chars.

Variables:

  • a_char - the character to assign.

Returns:

  • estring& - a reference to self.

Exceptions:

  • An err_nomem is thrown if memory allocation fails.

Definition at line 929 of file estring.cc.

References m_type, TRY_nomem, and type_string.

estring & estring::assign const estring a_estr  ) 
 

Assignment for estring objects.

Variables:

  • a_estr - the estring object to copy.

Returns:

  • estring& - a reference to self.

Exceptions:

  • An err_nomem is thrown if memory allocation fails.
  • It is possible that an "Invalid base" or "Base too large" may be thrown if the estring object is corrupted, but this should never happen.

Definition at line 839 of file estring.cc.

References m_alignment, m_left_fillchar, m_precision, m_right_fillchar, m_type, m_value, m_width, and TRY_nomem.

Referenced by assign(), base(), estring(), operator=(), precision(), and test2().

const unsigned int estring::base void   )  const
 

Retrieve the base used in numeric conversions.

Returns:

  • const unsigned int - the current numeric base.

Definition at line 575 of file estring.cc.

References m_base.

Referenced by assign().

const unsigned int estring::base const unsigned int  a_base  ) 
 

Set the base used in numeric conversions.

Variables:

  • a_base - The base to use in converting numbers to/from strings.

Return:

  • const unsigned int - the last base.

Exceptions:

  • An err_nomem is thrown for memory allocation failure.
  • An invalid base is thrown if the base is smaller than 2 (binary).
  • A base too large is thrown if the base is larger than the alphabet of usable symbols.

Definition at line 526 of file estring.cc.

References assign(), ERROR, m_alphabet_len, m_base, m_type, m_value, TRY_nomem, type_double, type_float, type_int, type_long, type_long_long, type_short, type_unsigned_int, type_unsigned_long, type_unsigned_long_long, type_unsigned_short, and estring_value::value.

Referenced by test3(), and test4().

Here is the call graph for this function:

void estring::clear void   ) 
 

Erase the string value.

Definition at line 400 of file estring.cc.

Referenced by archive_manager::archive(), and reset().

void estring::fillchar const char  a_char  ) 
 

Set the fill character used for padding both the left and right side of a formatted string.

Variables:

  • a_char - the character to use as the fill character.

Definition at line 648 of file estring.cc.

References left_fillchar(), and right_fillchar().

Referenced by report_manager::mf_write_header(), percent_string(), jobs_report::write_report(), and vault_report::write_report().

Here is the call graph for this function:

estring::value_type estring::fmt_str const size_type  a_width,
const alignment  a_alignment,
const char  a_left_fill,
const char  a_right_fill
 

Set all the formatting options.

Variables:

  • a_width - the width of the formatted string.
  • a_alignment - the alignment used to format the string.
  • a_left_fill - the character used for left-hand padding.
  • a_right_fill - the character used for right-hand padding.

Returns:

  • value_type - a formatted rendition of the current string.

Definition at line 770 of file estring.cc.

References align(), fmt_str(), left_fillchar(), right_fillchar(), and width().

Here is the call graph for this function:

estring::value_type estring::fmt_str void   ) 
 

Generate a formatted string.

Returns:

  • value_type - a formatted rendition of the current string.

If the string being printed is wider than the assigned width then as many as three periods are used ("...") to denote that the contents of the string have been truncated. For strings that use left alignment these three periods are printed on the right-hand side of the string, while showing as many characters on the left as possible beginning with the left-most character. For strings that use right alignment these three periods are printed on the left-hand side of the string, while showing as many characters on the right as possible includingn the right-most character. For strings that are center-aligned as many characters on both the left and the right are printed, including the left-most and the right-most characters, while characters in the center of the string are replaced with the three periods.

Definition at line 674 of file estring.cc.

References left, m_alignment, m_left_fillchar, m_right_fillchar, m_width, right, and TRY_nomem.

Referenced by fmt_str(), timestamp::make_str_(), num_to_string(), percent_string(), test1(), test2(), table::write(), table_cell_table::write(), and table_cell_estring::write().

const estring::set_from_type & estring::get_from_type void   )  const
 

Retrieve the type of value being held by this estring.

Returns:

  • set_from_type& - the enumeration of the type of value currently assigned.

Definition at line 796 of file estring.cc.

References m_type.

Referenced by test4().

const estring_value & estring::get_from_value void   )  const
 

Retrieve the typeless_value being held by this estring.

Returns:

  • typeless_value& - the union that holds the current value.

Definition at line 807 of file estring.cc.

References m_value.

Referenced by test4().

void estring::init void   ) 
 

Initialize the estring object.

Defaults:

  • A precision of one digit to the right of the decimal.
  • A base of 10.
  • A width of 5 characters for formatted printing.
  • A space as the fill character for padding the left of a string.
  • A space as the fill character for padding the right of a string.
  • Initialize the conversion type to type_unknown.

Definition at line 387 of file estring.cc.

References left, m_alignment, m_base, m_left_fillchar, m_precision, m_right_fillchar, m_type, m_width, and type_unknown.

Referenced by estring(), and reset().

char estring::left_fillchar void   )  const
 

Retrieve the fill character used to padd the left side of a formatted string.

Returns:

  • char - the current fill character.

Definition at line 606 of file estring.cc.

References m_left_fillchar.

Referenced by fillchar(), and fmt_str().

char estring::left_fillchar const char  a_char  ) 
 

Set the fill character used to padd the left side of a formatted string.

Variables:

  • a_char - the character to use as the fill character.

Returns:

  • char - the last fill character.

Definition at line 589 of file estring.cc.

References m_left_fillchar.

Referenced by timestamp::make_str_(), and test1().

estring & estring::lower void   ) 
 

Convert all characters to lowercase.

Returns:

  • estring& - a reference to self.

Definition at line 877 of file estring.cc.

Referenced by test5().

estring::operator char *  )  const
 

Definition at line 1392 of file estring.cc.

References ERROR, m_type, m_value, type_char_ptr, type_void_ptr, and estring_value::value.

estring::operator double  )  const
 

Definition at line 1571 of file estring.cc.

References T_string_to_fractional(), and TRY.

Here is the call graph for this function:

estring::operator float  )  const
 

Definition at line 1504 of file estring.cc.

References T_string_to_fractional(), and TRY.

Here is the call graph for this function:

estring::operator int  )  const
 

Definition at line 1108 of file estring.cc.

References T_string_to_signed_integral(), and TRY.

Here is the call graph for this function:

estring::operator long  )  const
 

Definition at line 1272 of file estring.cc.

References T_string_to_signed_integral(), and TRY.

Here is the call graph for this function:

estring::operator long long  )  const
 

Definition at line 1354 of file estring.cc.

References T_string_to_signed_integral(), and TRY.

Here is the call graph for this function:

estring::operator short  )  const
 

Definition at line 1190 of file estring.cc.

References T_string_to_signed_integral(), and TRY.

Here is the call graph for this function:

estring::operator unsigned int  )  const
 

Implicit conversion operator to an unsigned int.

Definition at line 1065 of file estring.cc.

References T_string_to_integral(), and TRY.

Here is the call graph for this function:

estring::operator unsigned long  )  const
 

Definition at line 1229 of file estring.cc.

References T_string_to_integral(), and TRY.

Here is the call graph for this function:

estring::operator unsigned long long  )  const
 

Definition at line 1311 of file estring.cc.

References T_string_to_integral(), and TRY.

Here is the call graph for this function:

estring::operator unsigned short  )  const
 

Definition at line 1147 of file estring.cc.

References T_string_to_integral(), and TRY.

Here is the call graph for this function:

estring::operator void *  )  const
 

Definition at line 1434 of file estring.cc.

References ERROR, m_type, m_value, type_char_ptr, type_void_ptr, and estring_value::value.

estring & estring::operator= const double  a_double  ) 
 

Definition at line 1543 of file estring.cc.

References assign().

Here is the call graph for this function:

estring & estring::operator= const float  a_float  ) 
 

Definition at line 1476 of file estring.cc.

References assign().

Here is the call graph for this function:

estring & estring::operator= void *const   a_ptr  ) 
 

Definition at line 1427 of file estring.cc.

References assign().

Here is the call graph for this function:

estring & estring::operator= char *const   a_ptr  ) 
 

Definition at line 1385 of file estring.cc.

References assign().

Here is the call graph for this function:

estring & estring::operator= const long long  a_long  ) 
 

Definition at line 1347 of file estring.cc.

References assign().

Here is the call graph for this function:

estring & estring::operator= const unsigned long long  a_long  ) 
 

Definition at line 1304 of file estring.cc.

References assign().

Here is the call graph for this function:

estring & estring::operator= const long  a_long  ) 
 

Definition at line 1265 of file estring.cc.

References assign().

Here is the call graph for this function:

estring & estring::operator= const unsigned long  a_long  ) 
 

Definition at line 1222 of file estring.cc.

References assign().

Here is the call graph for this function:

estring & estring::operator= const short  a_short  ) 
 

Definition at line 1183 of file estring.cc.

References assign().

Here is the call graph for this function:

estring & estring::operator= const unsigned short  a_short  ) 
 

Definition at line 1140 of file estring.cc.

References assign().

Here is the call graph for this function:

estring & estring::operator= const int  a_int  ) 
 

Definition at line 1101 of file estring.cc.

References assign().

Here is the call graph for this function:

estring & estring::operator= const unsigned int  a_int  ) 
 

Assignment operator for unsigned ints.

Definition at line 1056 of file estring.cc.

References assign().

Here is the call graph for this function:

estring & estring::operator= const value_type a_string  ) 
 

Assignment operator for std::string objects.

Variables:

  • a_string - the std::string object to copy.

Returns:

  • estring& - a reference to self.

Exceptions:

  • An err_nomem is thrown if memory allocation fails.

Definition at line 1004 of file estring.cc.

References assign().

Here is the call graph for this function:

estring & estring::operator= const char  a_char  ) 
 

Assignment operator for chars.

Variables:

  • a_char - the character to assign.

Returns:

  • estring& - a reference to self.

Exceptions:

  • Anything thrown by estring::assign(const char& a_char).

Definition at line 951 of file estring.cc.

References assign().

Here is the call graph for this function:

estring & estring::operator= const estring a_estr  ) 
 

Assignment operator for estring objects.

Variables:

  • a_estr - the estring object to copy.

Returns:

  • estring& - a reference to self.

Exceptions:

Definition at line 864 of file estring.cc.

References assign().

Here is the call graph for this function:

estring::size_type estring::precision void   )  const
 

Retrieve the set precision used in fractional conversions.

Returns:

  • size_type - the current precision.

Definition at line 507 of file estring.cc.

References m_precision.

Referenced by assign().

estring::size_type estring::precision size_type  a_p  ) 
 

Set the precision used in converting to/from fractional types.

Variables:

  • a_p - the number of digits to use to the right of the decimal point when converting fractional types.

Returns:

  • size_type - the last precision.

Definition at line 487 of file estring.cc.

References assign(), m_precision, m_type, m_value, type_double, type_float, and estring_value::value.

Referenced by percent_string(), test2(), and test3().

Here is the call graph for this function:

void estring::reset void   ) 
 

Erase and reinitialize.

Definition at line 407 of file estring.cc.

References clear(), and init().

Referenced by timestamp::make_str_(), and test3().

Here is the call graph for this function:

char estring::right_fillchar void   )  const
 

Retrieve the fill character used to padd the right side of a formatted string.

Returns:

  • char - the current fill character.

Definition at line 637 of file estring.cc.

References m_right_fillchar.

Referenced by fillchar(), and fmt_str().

char estring::right_fillchar const char  a_char  ) 
 

Set the fill character used to padd the right side of a formatted string.

Variables:

  • a_char - the character to use as the fill character.

Returns:

  • char - the last fill character.

Definition at line 620 of file estring.cc.

References m_right_fillchar.

template<class T>
void estring::T_fraction_to_strings const T &  a_t,
value_type a_ws,
value_type a_fs
[private]
 

Helper member template function to convert a fractional type to an estring.

Fractions are converted to string form using a default base of 10 unless specified otherwise through the base() member function. For bases greater than ten the letters of the alphabet are used, starting with 'a' for eleven, 'b' for twelve, etc.

By default a precision of 1 digit to the right of the decimal point is used unless specified otherwise by the precision() member function.

Variables:

  • a_t - the fractional type: float or double.
  • a_ws - the std::string object in which to store the whole part.
  • a_fs - the std::string object in which to store the fractional part.

Exceptions:

  • An err_nomem is thrown for memory allocation failure.

Definition at line 101 of file estring.cc.

References ASSERT, m_alphabet, m_alphabet_len, m_base, m_precision, and TRY_nomem.

Referenced by assign().

template<class T>
void estring::T_integral_to_string const T &  a_t,
value_type a_str
[private]
 

Helper member template function to convert an integral type to an estring.

Integrals are converted to string form using a default base of 10 unless specified otherwise through the base() member function. For bases greater than ten the letters of the alphabet are used, starting with 'a' for eleven, 'b' for twelve, etc.

Variables:

  • a_t - the integral type. Usually uint8, uint16, uint32, or uint64.
  • a_str - the std::string object in which to store the string converstion.

Exceptions:

  • An err_nomem is thrown for memory allocation failure.

Definition at line 59 of file estring.cc.

References ASSERT, m_alphabet, m_alphabet_len, m_base, and TRY_nomem.

Referenced by assign().

template<class T>
void estring::T_string_to_fractional const value_type a_str,
T &  a_t
const [private]
 

Helper member template function to convert a string to a fractional.

Variables:

  • a_str - the std::string to convert from.
  • a_t - a variable of the type to convert to.

Exceptions:

  • An err_nomem is thrown for memory allocation failure.
  • Any exception thrown by the member template function T_string_to_integral().
  • An overflow error is thrown if the wole part of the string is too large for the type a_t.
  • An underflow error is thrown if the fractional part of the string is too large for the type a_t.

Definition at line 299 of file estring.cc.

References ASSERT, ERROR, m_alphabet_len, m_base, T_string_to_integral(), TRY, and TRY_nomem.

Referenced by operator double(), and operator float().

Here is the call graph for this function:

template<class T>
void estring::T_string_to_integral const value_type a_str,
T &  a_t
const [private]
 

Helper member template function to convert a string to an integral type.

Characters in the string are converted using a default base of 10 unless specified otherwise through the base() member function. For bases greater than ten the letters of the alphabet will be assumed, starting with 'a' for eleven, 'b' for twelve, etc.

Variables:

  • a_str - the std::string object from which to convert.
  • a_t - a variable of the integral type to which to convert.

Exceptions:

  • An err_nomem is thrown for memory allocation failure.
  • If a symbol is encountered in the string that is not expected then an invalid character or invalid base error is thrown.
  • If the type to which to convert the string is not large enough to hold the value of the converted string then an overflow error is thrown.

Definition at line 183 of file estring.cc.

References ASSERT, ERROR, m_alphabet, m_alphabet_len, m_base, and TRY_nomem.

Referenced by operator unsigned int(), operator unsigned long(), operator unsigned long long(), operator unsigned short(), T_string_to_fractional(), and T_string_to_signed_integral().

template<class T>
void estring::T_string_to_signed_integral const value_type a_str,
T &  a_t
const [private]
 

Helper member template function to convert a string to a signed integral.

Variables:

  • a_str - the std::string to convert from.
  • a_t - a variable of the type to convert to.

Exceptions:

  • An err_nomem is thrown for memory allocation failure.
  • Any exception thrown from the called member template function T_string_to_integral().

Definition at line 263 of file estring.cc.

References T_string_to_integral(), and TRY_nomem.

Referenced by operator int(), operator long(), operator long long(), and operator short().

Here is the call graph for this function:

estring & estring::upper void   ) 
 

Convert all characters to uppercase.

Returns:

  • estring& - a reference to self.

Definition at line 894 of file estring.cc.

Referenced by test5().

estring::size_type estring::width void   )  const
 

Retrieve the set width for formatted strings.

Returns:

  • size_type - the current width.

Definition at line 447 of file estring.cc.

References m_width.

Referenced by fmt_str().

estring::size_type estring::width const size_type  a_l  ) 
 

Set the width of a formatted string.

Variables:

  • a_l - new width to use for formatting strings.

Returns:

  • size_type - the last width.

Definition at line 432 of file estring.cc.

References m_width.

Referenced by timestamp::make_str_(), num_to_string(), percent_string(), test1(), table::write(), table_cell_table::write(), and table_cell_estring::write().


Member Data Documentation

alignment estring::m_alignment [private]
 

The current formatting alignment.

Definition at line 247 of file estring.h.

Referenced by align(), assign(), fmt_str(), and init().

const char * estring::m_alphabet = "0123456789abcdefghijklmnopqrstuvwxyz" [static, private]
 

The alphabet used for any base from 2 to 36.

Definition at line 38 of file estring.cc.

Referenced by T_fraction_to_strings(), T_integral_to_string(), and T_string_to_integral().

const size_t estring::m_alphabet_len = 36 [static, private]
 

The length of the alphabet.

Definition at line 42 of file estring.cc.

Referenced by base(), T_fraction_to_strings(), T_integral_to_string(), T_string_to_fractional(), and T_string_to_integral().

unsigned int estring::m_base [private]
 

The current numerical base.

Definition at line 239 of file estring.h.

Referenced by base(), init(), T_fraction_to_strings(), T_integral_to_string(), T_string_to_fractional(), and T_string_to_integral().

char estring::m_left_fillchar [private]
 

The current left-hand fill character.

Definition at line 249 of file estring.h.

Referenced by assign(), fmt_str(), init(), and left_fillchar().

size_type estring::m_precision [private]
 

The current fractional number precision.

Definition at line 237 of file estring.h.

Referenced by assign(), init(), precision(), and T_fraction_to_strings().

char estring::m_right_fillchar [private]
 

The current right-hand fill character.

Definition at line 251 of file estring.h.

Referenced by assign(), fmt_str(), init(), and right_fillchar().

set_from_type estring::m_type [private]
 

The current value type.

Definition at line 253 of file estring.h.

Referenced by assign(), base(), get_from_type(), init(), operator char *(), operator void *(), and precision().

estring_value estring::m_value [private]
 

The current value.

Definition at line 255 of file estring.h.

Referenced by assign(), base(), get_from_value(), operator char *(), operator void *(), and precision().

size_type estring::m_width [private]
 

The current formatting width.

Definition at line 245 of file estring.h.

Referenced by assign(), fmt_str(), init(), and width().


The documentation for this class was generated from the following files:
Generated on Fri Jun 23 16:56:05 2006 for rvm by  doxygen 1.4.2