Synesis Software STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ...

integer Class Reference
[Inserters]

#include <pantheios/inserters/integer.hpp>

Inheritance diagram for integer:

xi

List of all members.


Detailed Description

Class for inserting integral types into Pantheios diagnostic logging statements.

This class converts an integer into a string, thereby enabling it to be inserted into a logging statement. Consider the following statement

  int         i   = 123;
  char        s[] = "abc";
  std::string str("def");

  pantheios::log(pantheios::notice, "s=", s, ", i=", pantheios::integer(i), ", str=", str);

This will produce the output:

    s=abc, i=123, str=def

The constructor takes a second, defaulted (to 0), parameter, which allows a width (up to a maximum of 255) and a format to be specified. The low 8 bits of this parameter are interpreted as an unsigned integer specifying the width. The remaining bits are treated as bit flags that control the

Note:
Currently, Pantheios does not support the insertion of integral types in diagnostic logging statements, due to the various ambiguities inherent in the C++ language. (See chapters 14, 15, 19, 24 of Imperfect C++ for discussions of these issues.) It is possible that a future version of the library will be able to incorporate them directly, so long as that does not sacrifice Pantheios's central claim of not paying for what you don't use.
Examples:

cpp/format/example.cpp.format.highres/example.cpp.format.highres.cpp, cpp/format/example.cpp.format.lowres/example.cpp.format.lowres.cpp, cpp/inserters/example.cpp.inserter.i/example.cpp.inserter.i.cpp, cpp/inserters/example.cpp.inserter.integer/example.cpp.inserter.integer.cpp, cpp/misc/example.cpp.misc.101/example.cpp.misc.101.cpp, and cpp/misc/example.cpp.misc.custom_type_1/example.cpp.misc.custom_type_1.cpp.


Public Types

Member Types
typedef integer class_type

Public Member Functions

Construction
 integer (::stlsoft::sint8_t i, int widthAndFormat)
 [DEPRECATED] Construct from an 8-bit signed integer
 integer (::stlsoft::uint8_t i, int widthAndFormat)
 [DEPRECATED] Construct from an 8-bit unsigned integer
 integer (::stlsoft::sint16_t i, int widthAndFormat)
 [DEPRECATED] Construct from a 16-bit signed integer
 integer (::stlsoft::uint16_t i, int widthAndFormat)
 [DEPRECATED] Construct from a 16-bit unsigned integer
 integer (::stlsoft::sint32_t i, int widthAndFormat)
 [DEPRECATED] Construct from a 32-bit signed integer
 integer (::stlsoft::uint32_t i, int widthAndFormat)
 [DEPRECATED] Construct from a 32-bit unsigned integer
 integer (::stlsoft::sint8_t i)
 Construct from an 8-bit signed integer.
 integer (::stlsoft::uint8_t i)
 Construct from an 8-bit unsigned integer.
 integer (::stlsoft::sint16_t i)
 Construct from a 16-bit signed integer.
 integer (::stlsoft::uint16_t i)
 Construct from a 16-bit unsigned integer.
 integer (::stlsoft::sint32_t i)
 Construct from a 32-bit signed integer.
 integer (::stlsoft::uint32_t i)
 Construct from a 32-bit unsigned integer.
 integer (::stlsoft::sint8_t i, int minWidth, int format)
 Construct from an 8-bit signed integer.
 integer (::stlsoft::uint8_t i, int minWidth, int format)
 Construct from an 8-bit unsigned integer.
 integer (::stlsoft::sint16_t i, int minWidth, int format)
 Construct from a 16-bit signed integer.
 integer (::stlsoft::uint16_t i, int minWidth, int format)
 Construct from a 16-bit unsigned integer.
 integer (::stlsoft::sint32_t i, int minWidth, int format)
 Construct from a 32-bit signed integer.
 integer (::stlsoft::uint32_t i, int minWidth, int format)
 Construct from a 32-bit unsigned integer.
Accessors
pan_char_t const * data () const
 A possibly non-nul-terminated non-null pointer to the c-style string representation of the integer.
pan_char_t const * c_str () const
 A nul-terminated non-null pointer to the c-style string representation of the integer.
size_t length () const
 The length of the c-style string representation of the integer.

Classes

union  u

Constructor & Destructor Documentation

integer ( ::stlsoft::sint8_t  i,
int  widthAndFormat 
) [explicit]

[DEPRECATED] Construct from an 8-bit signed integer

Deprecated:
This function is now deprecated. Instead use the 1 or 3 parameter overloads

integer ( ::stlsoft::uint8_t  i,
int  widthAndFormat 
) [explicit]

[DEPRECATED] Construct from an 8-bit unsigned integer

Deprecated:
This function is now deprecated. Instead use the 1 or 3 parameter overloads

integer ( ::stlsoft::sint16_t  i,
int  widthAndFormat 
) [explicit]

[DEPRECATED] Construct from a 16-bit signed integer

Deprecated:
This function is now deprecated. Instead use the 1 or 3 parameter overloads

integer ( ::stlsoft::uint16_t  i,
int  widthAndFormat 
) [explicit]

[DEPRECATED] Construct from a 16-bit unsigned integer

Deprecated:
This function is now deprecated. Instead use the 1 or 3 parameter overloads

integer ( ::stlsoft::sint32_t  i,
int  widthAndFormat 
) [explicit]

[DEPRECATED] Construct from a 32-bit signed integer

Deprecated:
This function is now deprecated. Instead use the 1 or 3 parameter overloads

integer ( ::stlsoft::uint32_t  i,
int  widthAndFormat 
) [explicit]

[DEPRECATED] Construct from a 32-bit unsigned integer

Deprecated:
This function is now deprecated. Instead use the 1 or 3 parameter overloads

integer ( ::stlsoft::sint8_t  i  )  [explicit]

Construct from an 8-bit signed integer.

integer ( ::stlsoft::uint8_t  i  )  [explicit]

Construct from an 8-bit unsigned integer.

integer ( ::stlsoft::sint16_t  i  )  [explicit]

Construct from a 16-bit signed integer.

integer ( ::stlsoft::uint16_t  i  )  [explicit]

Construct from a 16-bit unsigned integer.

integer ( ::stlsoft::sint32_t  i  )  [explicit]

Construct from a 32-bit signed integer.

integer ( ::stlsoft::uint32_t  i  )  [explicit]

Construct from a 32-bit unsigned integer.

integer ( ::stlsoft::sint8_t  i,
int  minWidth,
int  format 
) [explicit]

Construct from an 8-bit signed integer.

Parameters:
i The integer to convert to string form
minWidth The minimum width of the converted form. Must be in the range [-128,127]
format The format used in the conversion

integer ( ::stlsoft::uint8_t  i,
int  minWidth,
int  format 
) [explicit]

Construct from an 8-bit unsigned integer.

Parameters:
i The integer to convert to string form
minWidth The minimum width of the converted form. Must be in the range [-128,127]
format The format used in the conversion

integer ( ::stlsoft::sint16_t  i,
int  minWidth,
int  format 
) [explicit]

Construct from a 16-bit signed integer.

Parameters:
i The integer to convert to string form
minWidth The minimum width of the converted form. Must be in the range [-128,127]
format The format used in the conversion

integer ( ::stlsoft::uint16_t  i,
int  minWidth,
int  format 
) [explicit]

Construct from a 16-bit unsigned integer.

Parameters:
i The integer to convert to string form
minWidth The minimum width of the converted form. Must be in the range [-128,127]
format The format used in the conversion

integer ( ::stlsoft::sint32_t  i,
int  minWidth,
int  format 
) [explicit]

Construct from a 32-bit signed integer.

Parameters:
i The integer to convert to string form
minWidth The minimum width of the converted form. Must be in the range [-128,127]
format The format used in the conversion

integer ( ::stlsoft::uint32_t  i,
int  minWidth,
int  format 
) [explicit]

Construct from a 32-bit unsigned integer.

Parameters:
i The integer to convert to string form
minWidth The minimum width of the converted form. Must be in the range [-128,127]
format The format used in the conversion


Member Function Documentation

pan_char_t const* data (  )  const

A possibly non-nul-terminated non-null pointer to the c-style string representation of the integer.

pan_char_t const* c_str (  )  const

A nul-terminated non-null pointer to the c-style string representation of the integer.

size_t length (  )  const

The length of the c-style string representation of the integer.


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

pantheios Library documentation © Matthew Wilson & Synesis Software, 2006-2011 SourceForge.net Logo