FIX::IntConvertor Struct Reference

Converts integer to/from a string. More...

`#include <FieldConvertors.h>`

## Static Public Member Functions

static std::string | convert (signed_int value)
static bool | convert (std::string::const_iterator str, std::string::const_iterator end, signed_int &result)
static bool | convert (const std::string &value, signed_int &result)
static signed_int | convert (const std::string &value) throw ( FieldConvertError )

## Detailed Description

Converts integer to/from a string.

Definition at line 151 of file FieldConvertors.h.

## Member Function Documentation

## convert() [1/4]

static signed_int FIX::IntConvertor::convert | ( | const std::string & | value | ) |
throw | ( | FieldConvertError
| ) |  |

inline static

Definition at line 200 of file FieldConvertors.h.

{
signed_int result = 0;
if( !convert( value.begin(), value.end(), result ) )
throw FieldConvertError(value);
else
return result;
}
FIX::signed_int
int signed_int
Definition FieldConvertors.h:43
FIX::IntConvertor::convert
static std::string convert(signed_int value)
Definition FieldConvertors.h:153

References convert().

## convert() [2/4]

static bool FIX::IntConvertor::convert | ( | const std::string & | value,
|  | signed_int & | result
| ) |  |

inline static

Definition at line 195 of file FieldConvertors.h.

{
return convert( value.begin(), value.end(), result );
}

References convert().

## convert() [3/4]

static std::string FIX::IntConvertor::convert | ( | signed_int | value | ) |

inline static

Definition at line 153 of file FieldConvertors.h.

{
// buffer is big enough for significant digits and extra digit,
// minus and null
char buffer[std::numeric_limits<signed_int>::digits10 + 2];
const char* const start
= integer_to_string( buffer, sizeof (buffer), value );
return std::string( start, buffer + sizeof (buffer) - start );
}
FIX::integer_to_string
char * integer_to_string(char *buf, const size_t len, signed_int t)
Definition FieldConvertors.h:99

References FIX::integer_to_string().

Referenced by FIX::DataDictionary::checkGroupCount(), FIX::DataDictionary::checkValidFormat(), convert(), FIX::CheckSumConvertor::convert(), FIX::CheckSumConvertor::convert(), convert(), FIX::SocketInitiator::doConnect(), FIX::ThreadedSocketInitiator::doConnect(), FIX::Session::doTargetTooHigh(), FIX::Message::extractField(), FIX::Parser::extractLength(), FIX::Session::generateBusinessReject(), FIX::Session::generateReject(), FIX::Session::generateResendRequest(), FIX::Session::generateSequenceReset(), FIX::Dictionary::getInt(), FIX::IntField::getValue(), FIX::Session::nextQueued(), FIX::Session::nextResendRequest(), FIX::Session::nextSequenceReset(), FIX::HttpServer::onInitialize(), FIX::SocketAcceptor::onInitialize(), FIX::ThreadedSocketAcceptor::onInitialize(), FIX::HttpConnection::processSession(), FIX::Dictionary::setInt(), FIX::IntField::setValue(), and FIX::Session::verify().

## convert() [4/4]

static bool FIX::IntConvertor::convert | ( | std::string::const_iterator | str,
|  | std::string::const_iterator | end,
|  | signed_int & | result
| ) |  |

inline static

Definition at line 163 of file FieldConvertors.h.

{
bool isNegative = false;
signed_int x = 0;
if( str == end )
return false;
if( *str == '-' )
{
isNegative = true;
if( ++str == end )
return false;
}
do
{
const unsigned_int c = *str - '0';
if( c > 9 ) return false;
x = 10 * x + c;
} while ( ++str != end );
if( isNegative )
x = -unsigned_int(x);
result = x;
return true;
}
FIX::unsigned_int
unsigned int unsigned_int
Definition FieldConvertors.h:44

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

- FieldConvertors.h