Fast conversion to text format with character strings. More...
#include <char_strings.hpp>
Public Member Functions | |
Converter (char *begin, char *end) | |
Initialises with an external buffer. | |
Converter (int buffer_size=250) ecl_debug_throw_decl(StandardException) | |
Initialises with an internal buffer. | |
char * | operator() (const double &input, const int &precision=-1) |
Convert the specified double to int. | |
virtual | ~Converter () |
Private Attributes | |
char | format_specifier [6] |
Fast conversion to text format with character strings.
This class uses a character buffer for the character strings that it generates. If your buffer is not long enough, this will just truncate the output to fit the buffer.
Definition at line 727 of file char_strings.hpp.
ecl::Converter< char *, double >::Converter | ( | char * | begin, |
char * | end | ||
) | [inline] |
Initialises with an external buffer.
begin | : character pointer that points to the start of the external buffer. |
end | : character pointer that points to the end of the external buffer. |
Reimplemented in ecl::Converter< char *, void >.
Definition at line 737 of file char_strings.hpp.
ecl::Converter< char *, double >::Converter | ( | int | buffer_size = 250 | ) | [inline] |
Initialises with an internal buffer.
buffer_size | : size of the buffer to create - if not supplied it initialises a buffer of size 250. |
StandardException | : throws if it failed to allocate memory for the internal buffer [debug mode only]. |
Reimplemented in ecl::Converter< char *, void >.
Definition at line 750 of file char_strings.hpp.
virtual ecl::Converter< char *, double >::~Converter | ( | ) | [inline, virtual] |
Reimplemented in ecl::Converter< char *, void >.
Definition at line 759 of file char_strings.hpp.
char* ecl::Converter< char *, double >::operator() | ( | const double & | input, |
const int & | precision = -1 |
||
) | [inline] |
Convert the specified double to int.
Converts an double to a char string held in the converter's buffer. I'd like to one day have my own (perhaps faster?) or refined implementation of snprintf but it will do for now.
input | : input value to be converted. |
precision | : number of decimal places to show (-1 to automagically allocate). |
Definition at line 775 of file char_strings.hpp.
char ecl::Converter< char *, double >::format_specifier[6] [private] |
Definition at line 800 of file char_strings.hpp.