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 151 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 200 of file FieldConvertors.h.

202 {
203 signed_int result = 0;
204 if( !convert( value.begin(), value.end(), result ) )
205 throw FieldConvertError(value);
206 else
207 return result;
208 }
int signed_int
static std::string convert(signed_int value)

References convert().

◆ convert() [2/4]

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

Definition at line 195 of file FieldConvertors.h.

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

References 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 163 of file FieldConvertors.h.

167 {
168 bool isNegative = false;
169 signed_int x = 0;
170
171 if( str == end )
172 return false;
173
174 if( *str == '-' )
175 {
176 isNegative = true;
177 if( ++str == end )
178 return false;
179 }
180
181 do
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 }
unsigned int unsigned_int

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

Generated on Sat Feb 3 2024 04:23:15 for QuickFIX by doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2001