QuickFIX: FIX::IntConvertor Struct Reference

Index Source Files Annotated Class List Alphabetical Class List Class Hierarchy Graphical Class Hierarchy

# FIX::IntConvertor Struct Reference

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

`#include <FieldConvertors.h>`

List of all members.

## Static Public Member Functions
static std::string | convert (long value)
static bool | convert (const std::string &value, long &result)
static long | convert (const std::string &value) throw ( FieldConvertError )

## Detailed Description

Converts integer to/from a string.

Definition at line 124 of file FieldConvertors.h.

## Member Function Documentation

static long FIX::IntConvertor::convert | ( | const std::string & | value | ) | throw ( FieldConvertError )`[inline, static]`

Definition at line 162 of file FieldConvertors.h.

References convert().

    00164   {
    00165     long result = 0;
    00166     if( !convert( value, result ) )
    00167       throw FieldConvertError();
    00168     else
    00169       return result;
    00170   }

static bool FIX::IntConvertor::convert | ( | const std::string & | value,
|  | long & | result |
| ) |  |  | `[inline, static]`

Definition at line 136 of file FieldConvertors.h.

    00137   {
    00138     const char* str = value.c_str();
    00139     bool isNegative = false;
    00140     long x = 0;
    00141
    00142     if( *str == '-' )
    00143     {
    00144       isNegative = true;
    00145       ++str;
    00146     }
    00147
    00148     do
    00149     {
    00150       const int c = *str - '0';
    00151       if( c < 0 || 9 < c ) return false;
    00152       x = 10 * x + c;
    00153     } while (*++str);
    00154
    00155     if( isNegative )
    00156       x = -x;
    00157
    00158     result = x;
    00159     return true;
    00160   }

static std::string FIX::IntConvertor::convert | ( | long | value | ) | `[inline, static]`

Definition at line 126 of file FieldConvertors.h.

References FIX::integer_to_string().

Referenced by FIX::FieldBase::calculate(), FIX::DataDictionary::checkGroupCount(), FIX::DataDictionary::checkValidFormat(), convert(), FIX::ThreadedSocketInitiator::doConnect(), FIX::SocketInitiator::doConnect(), FIX::Session::doTargetTooHigh(), FIX::Parser::extractLength(), FIX::Session::generateBusinessReject(), FIX::Session::generateReject(), FIX::Session::generateResendRequest(), FIX::Session::generateSequenceReset(), FIX::Dictionary::getLong(), FIX::Session::nextQueued(), FIX::Session::nextResendRequest(), FIX::Session::nextSequenceReset(), FIX::ThreadedSocketAcceptor::onInitialize(), FIX::SocketAcceptor::onInitialize(), FIX::HttpServer::onInitialize(), FIX::HttpConnection::processSession(), FIX::Dictionary::setLong(), and FIX::Session::verify().

    00127   {
    00128     // buffer is big enough for significant digits and extra digit,
    00129     // minus and null
    00130     char buffer[std::numeric_limits<long>::digits10 + 3];
    00131     const char* const start
    00132       = integer_to_string( buffer, sizeof (buffer), value );
    00133     return std::string( start, buffer + sizeof (buffer) - start - 1 );
    00134   }

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

- /home/omiller/Development/autobuild/quickfix/src/C++/FieldConvertors.h