Public Member Functions | Private Attributes | List of all members
ecl::Converter< char *, double > Class Reference

Fast conversion to text format with character strings. More...

#include <char_strings.hpp>

Inheritance diagram for ecl::Converter< char *, double >:
Inheritance graph
[legend]

Public Member Functions

 Converter (char *begin, char *end)
 Initialises with an external buffer. More...
 
 Converter (int buffer_size=250)
 Initialises with an internal buffer. More...
 
char * operator() (const double &input, const int &precision=-1)
 Convert the specified double to int. More...
 
virtual ~Converter ()
 

Private Attributes

char format_specifier [6]
 

Detailed Description

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.

See also
Converter

Definition at line 733 of file char_strings.hpp.

Constructor & Destructor Documentation

◆ Converter() [1/2]

ecl::Converter< char *, double >::Converter ( char *  begin,
char *  end 
)
inline

Initialises with an external buffer.

Parameters
begin: character pointer that points to the start of the external buffer.
end: character pointer that points to the end of the external buffer.

Definition at line 745 of file char_strings.hpp.

◆ Converter() [2/2]

ecl::Converter< char *, double >::Converter ( int  buffer_size = 250)
inline

Initialises with an internal buffer.

Parameters
buffer_size: size of the buffer to create - if not supplied it initialises a buffer of size 250.
Exceptions
StandardException: throws if it failed to allocate memory for the internal buffer [debug mode only].

Definition at line 758 of file char_strings.hpp.

◆ ~Converter()

virtual ecl::Converter< char *, double >::~Converter ( )
inlinevirtual

Reimplemented in ecl::Converter< char *, void >.

Definition at line 767 of file char_strings.hpp.

Member Function Documentation

◆ operator()()

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.

Parameters
input: input value to be converted.
precision: number of decimal places to show (-1 to automagically allocate).
Returns
char* : output text string.

Definition at line 783 of file char_strings.hpp.

Member Data Documentation

◆ format_specifier

char ecl::Converter< char *, double >::format_specifier[6]
private

Definition at line 808 of file char_strings.hpp.


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


ecl_converters
Author(s): Daniel Stonier
autogenerated on Sun Aug 2 2020 03:12:09