![]() |
![]() |
|
Index
Source Files
Annotated Class List
Alphabetical Class List
Class Hierarchy
Graphical Class Hierarchy
|
||
![]() |
![]() |
#include <FieldConvertors.h>
Static Public Member Functions | |
| std::string | convert (long value) |
| bool | convert (const std::string &value, long &result) |
| long | convert (const std::string &value) throw ( FieldConvertError ) |
Definition at line 124 of file FieldConvertors.h.
|
|
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 }
|
|
||||||||||||
|
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 }
|
|
|
Definition at line 126 of file FieldConvertors.h. References FIX::integer_to_string(). Referenced by convert().
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 }
|
1.3.6-20040222 written by Dimitri van Heesch,
© 1997-2001