Static Public Member Functions | List of all members
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 168 of file FieldConvertors.h.

Member Function Documentation

◆ convert() [1/4]

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

Definition at line 217 of file FieldConvertors.h.

220  {
221  throw FieldConvertError();
222  }
223  return std::string( result, sizeof( result ) );
224  }
225 

◆ convert() [2/4]

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

Definition at line 212 of file FieldConvertors.h.

213 {
214  static std::string convert( int value )
215  throw( FieldConvertError )

References FIX::CheckSumConvertor::convert().

◆ convert() [3/4]

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

◆ convert() [4/4]

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

Definition at line 180 of file FieldConvertors.h.

182  {
183  const unsigned_int c = *str - '0';
184  if( c > 9 ) return false;
185  x = 10 * x + c;
186  } while ( ++str != end );
187 
188  if( isNegative )
189  x = -unsigned_int(x);
190 
191  result = x;
192  return true;
193  }
194 
195  static bool convert( const std::string& value, signed_int& result )
196  {
197  return convert( value.begin(), value.end(), result );
198  }
199 
200  static signed_int convert( const std::string& value )
201  throw( FieldConvertError )
202  {
203  signed_int result = 0;
204  if( !convert( value.begin(), value.end(), result ) )
205  throw FieldConvertError(value);
206  else
207  return result;
208  }
209 };
210 

The documentation for this struct was generated from the following file:
FIX::IntConvertor::convert
static std::string convert(signed_int value)
Definition: FieldConvertors.h:170
FIX::unsigned_int
unsigned int unsigned_int
Definition: FieldConvertors.h:61
FIX::signed_int
int signed_int
Definition: FieldConvertors.h:60

Generated on Wed Apr 29 2020 19:41:30 for QuickFIX by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2001