FieldConvertors.h
Go to the documentation of this file.
1 /* -*- C++ -*- */
2 
3 /****************************************************************************
4 ** Copyright (c) 2001-2014
5 **
6 ** This file is part of the QuickFIX FIX Engine
7 **
8 ** This file may be distributed under the terms of the quickfixengine.org
9 ** license as defined by quickfixengine.org and appearing in the file
10 ** LICENSE included in the packaging of this file.
11 **
12 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 **
15 ** See http://www.quickfixengine.org/LICENSE for licensing information.
16 **
17 ** Contact ask@quickfixengine.org if any conditions of this licensing are
18 ** not clear to you.
19 **
20 ****************************************************************************/
21 
22 #ifndef FIX_FIELDCONVERTORS_H
23 #define FIX_FIELDCONVERTORS_H
24 
25 #include "FieldTypes.h"
26 #include "Exceptions.h"
27 #include "Utility.h"
28 #include <string>
29 #include <sstream>
30 #include <iomanip>
31 #include <cstdio>
32 #include <limits>
33 
34 namespace FIX
35 {
36 
37 typedef int signed_int;
38 typedef unsigned int unsigned_int;
39 
40 #define UNSIGNED_VALUE_OF( x ) unsigned_int( x < 0 ? -x : x )
41 
42 #define IS_SPACE( x ) ( x == ' ' )
43 #define IS_DIGIT( x ) ( unsigned_int( x - '0' ) < 10 )
44 
45 inline int number_of_symbols_in( const signed_int value )
46 {
47  unsigned_int number = UNSIGNED_VALUE_OF( value );
48 
49  int symbols = 0;
50 
51  while( number > 9999 )
52  {
53  symbols += 4;
54  number /= 10000;
55  }
56 
57  // small tweak to make comparison times consistent
58  // always 2 comparisons instead of [1 - 4]
59  if( number > 99 )
60  {
61  if( number > 999 )
62  symbols += 4;
63  else
64  symbols += 3;
65  }
66  else
67  {
68  if( number > 9 )
69  symbols += 2;
70  else
71  symbols += 1;
72  }
73 
74  if( value < 0 )
75  symbols += 1;
76 
77  return symbols;
78 }
79 
80 static const char digit_pairs[201] = {
81  "00010203040506070809"
82  "10111213141516171819"
83  "20212223242526272829"
84  "30313233343536373839"
85  "40414243444546474849"
86  "50515253545556575859"
87  "60616263646566676869"
88  "70717273747576777879"
89  "80818283848586878889"
90  "90919293949596979899"
91 };
92 
93 inline char* integer_to_string( char* buf, const size_t len, signed_int t )
94 {
95  const bool isNegative = t < 0;
96  char* p = buf + len;
97 
98  *--p = '\0';
99 
100  unsigned_int number = UNSIGNED_VALUE_OF( t );
101 
102  while( number > 99 )
103  {
104  unsigned_int pos = number % 100;
105  number /= 100;
106  p -= 2;
107  *(short*)(p) = *(short*)(digit_pairs + 2 * pos);
108  }
109 
110  if( number > 9 )
111  {
112  p -= 2;
113  *(short*)(p) = *(short*)(digit_pairs + 2 * number);
114  }
115  else
116  {
117  *--p = '0' + char(number);
118  }
119 
120  if( isNegative )
121  *--p = '-';
122 
123  return p;
124 }
125 
126 inline char* integer_to_string_padded
127 ( char* buf, const size_t len, signed_int t,
128  const size_t width = 0,
129  const char paddingChar = '0')
130 {
131  char* p = integer_to_string( buf, len, t );
132  if( !width )
133  return p;
134 
135  const char* stop_p = buf + len - width - 1;
136  if( stop_p < buf ) stop_p = buf;
137  while( p > stop_p )
138  *--p = paddingChar;
139  return p;
140 }
141 
144 {
145  static const std::string& convert( const std::string& value )
146  { return value; }
147 };
148 
150 
153 {
154  static std::string convert( signed_int value )
155  {
156  // buffer is big enough for significant digits and extra digit,
157  // minus and null
158  char buffer[std::numeric_limits<signed_int>::digits10 + 3];
159  const char* const start
160  = integer_to_string( buffer, sizeof (buffer), value );
161  return std::string( start, buffer + sizeof (buffer) - start - 1 );
162  }
163 
164  static bool convert(
165  std::string::const_iterator str,
166  std::string::const_iterator end,
167  signed_int& result )
168  {
169  bool isNegative = false;
170  signed_int x = 0;
171 
172  if( str == end )
173  return false;
174 
175  if( *str == '-' )
176  {
177  isNegative = true;
178  if( ++str == end )
179  return false;
180  }
181 
182  do
183  {
184  const unsigned_int c = *str - '0';
185  if( c > 9 ) return false;
186  x = 10 * x + c;
187  } while ( ++str != end );
188 
189  if( isNegative )
190  x = -x;
191 
192  result = x;
193  return true;
194  }
195 
196  static bool convert( const std::string& value, signed_int& result )
197  {
198  return convert( value.begin(), value.end(), result );
199  }
200 
201  static signed_int convert( const std::string& value )
202  throw( FieldConvertError )
203  {
204  signed_int result = 0;
205  if( !convert( value.begin(), value.end(), result ) )
206  throw FieldConvertError(value);
207  else
208  return result;
209  }
210 
214  static bool convertPositive(
215  std::string::const_iterator str,
216  std::string::const_iterator end,
217  signed_int& result )
218  {
219  const int MAX_VALUE = 2147483647; // max value for 32-bit signed integer
220  const int HIGH_MARK = MAX_VALUE / 10;
221  const unsigned_int STOP_SYMBOL = MAX_VALUE % 10;
222  const std::size_t MAX_DIGITS = 10; // integer can hold up to 10 digits
223 
224  const std::size_t length = std::distance( str, end );
225  if( length < 1 || length > MAX_DIGITS)
226  return false;
227 
228  if( length == MAX_DIGITS )
229  {
230  end = str;
231  std::advance( end, length - 1 );
232  }
233 
234  const unsigned_int ch = *str - '1';
235  if( ch > 8 )
236  return false;
237 
238  unsigned_int x = 0;
239 
240  do
241  {
242  const unsigned_int c = *str - '0';
243  if( c > 9 ) return false;
244  x = 10 * x + c;
245  } while( ++str < end );
246 
247  // complete overflow condition check and value calculation
248  // this saves about 25% of speed when executed out of the main loop
249  if( length == MAX_DIGITS )
250  {
251  if( x > (unsigned int)HIGH_MARK )
252  return false;
253 
254  const unsigned_int c = *str - '0';
255  if( x == (unsigned int)HIGH_MARK && c > STOP_SYMBOL )
256  return false;
257 
258  x = 10 * x + c;
259  }
260 
261  result = x;
262  return true;
263  }
264 
265  static signed_int convertPositive( const std::string& value )
266  throw( FieldConvertError )
267  {
268  signed_int result = 0;
269  if( !convertPositive( value.begin(), value.end(), result ) )
270  throw FieldConvertError(value);
271  else
272  return result;
273  }
274 };
275 
278 {
279  static std::string convert( int value )
280  throw( FieldConvertError )
281  {
282  if ( value > 255 || value < 0 ) throw FieldConvertError();
283  char result[4];
284  if( integer_to_string_padded(result, sizeof(result), value, 3) != result )
285  {
286  throw FieldConvertError();
287  }
288  return std::string( result, 3 );
289  }
290 
291  static bool convert( const std::string& value, int& result )
292  {
293  return IntConvertor::convert( value, result );
294  }
295 
296  static int convert( const std::string& value )
297  throw( FieldConvertError )
298  {
299  return IntConvertor::convert( value );
300  }
301 };
302 
305 {
306 
307 private:
308 
309  /*Simple and fast atof (ascii to float) function.
310  Executes about 5x faster than standard MSCRT library atof().
311  An attractive alternative if the number of calls is in the millions.
312  Assumes input is a proper integer, fraction, or scientific format.
313  Matches library atof() to 15 digits (except at extreme exponents).
314  Follows atof() precedent of essentially no error checking.
315  09-May-2009 Tom Van Baak (tvb) www.LeapSecond.com */
316  static double fast_atof (const char *p)
317  {
318  bool frac(false);
319  double sign(1.), value(0.), scale(1.);
320 
321  while (IS_SPACE(*p))
322  ++p;
323 
324  // Get sign, if any.
325  if (*p == '-')
326  {
327  sign = -1.;
328  ++p;
329  }
330  else if (*p == '+')
331  ++p;
332 
333  // Get digits before decimal point or exponent, if any.
334  while (IS_DIGIT(*p))
335  {
336  value = value * 10. + (*p - '0');
337  ++p;
338  }
339 
340  // Get digits after decimal point, if any.
341  if (*p == '.')
342  {
343  ++p;
344  double pow10(10.);
345  while (IS_DIGIT(*p))
346  {
347  value += (*p - '0') / pow10;
348  pow10 *= 10.;
349  ++p;
350  }
351  }
352 
353  // Handle exponent, if any.
354  if (toupper(*p) == 'E')
355  {
356  unsigned int expon(0);
357  ++p;
358 
359  // Get sign of exponent, if any.
360  if (*p == '-')
361  {
362  frac = true;
363  ++p;
364  }
365  else if (*p == '+')
366  ++p;
367 
368  // Get digits of exponent, if any.
369  while (IS_DIGIT(*p))
370  {
371  expon = expon * 10 + (*p - '0');
372  ++p;
373  }
374  if (expon > 308)
375  expon = 308;
376 
377  // Calculate scaling factor.
378  while (expon >= 50)
379  {
380  scale *= 1E50;
381  expon -= 50;
382  }
383  while (expon >= 8)
384  {
385  scale *= 1E8;
386  expon -= 8;
387  }
388  while (expon > 0)
389  {
390  scale *= 10.0;
391  expon -= 1;
392  }
393  }
394 
395  // Return signed and scaled floating point result.
396  return sign * (frac ? (value / scale) : (value * scale));
397  }
398 
399 public:
400 
401  static std::string convert( double value, int padding = 0 )
402  {
403  char result[32];
404  char *end = 0;
405 
406  int size;
407  if( value == 0 || value > 0.0001 || value <= -0.0001 )
408  {
409  size = STRING_SPRINTF( result, "%.15g", value );
410 
411  if( padding > 0 )
412  {
413  char* point = result;
414  end = result + size - 1;
415  while( *point != '.' && *point != 0 )
416  point++;
417 
418  if( *point == 0 )
419  {
420  end = point;
421  *point = '.';
422  size++;
423  }
424  int needed = padding - (int)(end - point);
425 
426  while( needed-- > 0 )
427  {
428  *(++end) = '0';
429  size++;
430  }
431  *(end+1) = 0;
432  }
433  }
434  else
435  {
436  size = STRING_SPRINTF( result, "%.15f", value );
437  // strip trailing 0's
438  end = result + size - 1;
439 
440  if( padding > 0 )
441  {
442  int discard = 15 - padding;
443 
444  while( (*end == '0') && (discard-- > 0) )
445  {
446  *(end--) = 0;
447  size--;
448  }
449  }
450  else
451  {
452  while( *end == '0' )
453  {
454  *(end--) = 0;
455  size--;
456  }
457  }
458  }
459 
460  return std::string( result, size );
461 }
462 
463 static bool convert( const std::string& value, double& result )
464 {
465  const char * i = value.c_str();
466 
467  // Catch null strings
468  if( !*i ) return false;
469  // Eat leading '-' and recheck for null string
470  if( *i == '-' && !*++i ) return false;
471 
472  bool haveDigit = false;
473 
474  if( IS_DIGIT(*i) )
475  {
476  haveDigit = true;
477  while( IS_DIGIT (*++i) );
478  }
479 
480  if( *i == '.' && IS_DIGIT(*++i) )
481  {
482  haveDigit = true;
483  while( IS_DIGIT (*++i) );
484  }
485 
486  if( *i || !haveDigit ) return false;
487 
488  result = fast_atof( value.c_str() );
489  return true;
490  }
491 
492  static double convert( const std::string& value )
493  throw( FieldConvertError )
494  {
495  double result = 0.0;
496  if( !convert( value, result ) )
497  throw FieldConvertError(value);
498  else
499  return result;
500  }
501 };
502 
505 {
506  static std::string convert( char value )
507  {
508  if( value == '\0' ) return "";
509  return std::string( 1, value );
510  }
511 
512  static bool convert( const std::string& value, char& result )
513  {
514  if( value.size() != 1 ) return false;
515  result = value[0];
516  return true;
517  }
518 
519  static char convert( const std::string& value )
520  throw( FieldConvertError )
521  {
522  char result = '\0';
523  if( !convert( value, result ) )
524  throw FieldConvertError(value);
525  else
526  return result;
527  }
528 };
529 
532 {
533  static std::string convert( bool value )
534  {
535  const char ch = value ? 'Y' : 'N';
536  return std::string( 1, ch );
537  }
538 
539  static bool convert( const std::string& value, bool& result )
540  {
541  if( value.size() != 1 ) return false;
542  switch( value[0] )
543  {
544  case 'Y': result = true; break;
545  case 'N': result = false; break;
546  default: return false;
547  }
548 
549  return true;
550  }
551 
552  static bool convert( const std::string& value )
553  throw( FieldConvertError )
554  {
555  bool result = false;
556  if( !convert( value, result ) )
557  throw FieldConvertError(value);
558  else
559  return result;
560  }
561 };
562 
565 {
566  static std::string convert( const UtcTimeStamp& value,
567  bool showMilliseconds = false )
568  throw( FieldConvertError )
569  {
570  char result[ 18+4 ];
571  int year, month, day, hour, minute, second, millis;
572 
573  value.getYMD( year, month, day );
574  value.getHMS( hour, minute, second, millis );
575 
576  integer_to_string_padded( result, 5, year, 4 );
577  integer_to_string_padded( result + 4, 3, month, 2 );
578  integer_to_string_padded( result + 6, 3, day, 2 );
579  result[8] = '-';
580  integer_to_string_padded( result + 9, 3, hour, 2 );
581  result[11] = ':';
582  integer_to_string_padded( result + 12, 3, minute, 2 );
583  result[14] = ':';
584  integer_to_string_padded( result + 15, 3, second, 2 );
585 
586  if( showMilliseconds )
587  {
588  result[17] = '.';
589  if( integer_to_string_padded ( result + 18, 4, millis, 3 )
590  != result + 18 )
591  {
592  throw FieldConvertError();
593  }
594  }
595 
596  return result;
597  }
598 
599  static UtcTimeStamp convert( const std::string& value,
600  bool calculateDays = false )
601  throw( FieldConvertError )
602  {
603  bool haveMilliseconds = false;
604 
605  switch( value.size() )
606  {
607  case 21: haveMilliseconds = true;
608  case 17: break;
609  default: throw FieldConvertError(value);
610  }
611 
612  int i = 0;
613  int c = 0;
614  for( c = 0; c < 8; ++c )
615  if( !IS_DIGIT(value[i++]) ) throw FieldConvertError(value);
616  if (value[i++] != '-') throw FieldConvertError(value);
617  for( c = 0; c < 2; ++c )
618  if( !IS_DIGIT(value[i++]) ) throw FieldConvertError(value);
619  if( value[i++] != ':' ) throw FieldConvertError(value);
620  for( c = 0; c < 2; ++c )
621  if( !IS_DIGIT(value[i++]) ) throw FieldConvertError(value);
622  if( value[i++] != ':' ) throw FieldConvertError(value);
623  for( c = 0; c < 2; ++c )
624  if( !IS_DIGIT(value[i++]) ) throw FieldConvertError(value);
625 
626  if( haveMilliseconds )
627  {
628  if( value[i++] != '.' ) throw FieldConvertError(value);
629  for( c = 0; c < 3; ++c )
630  if( !IS_DIGIT(value[i++]) ) throw FieldConvertError(value);
631  }
632 
633  int year, mon, mday, hour, min, sec, millis;
634 
635  i = 0;
636 
637  year = value[i++] - '0';
638  year = 10 * year + value[i++] - '0';
639  year = 10 * year + value[i++] - '0';
640  year = 10 * year + value[i++] - '0';
641 
642  mon = value[i++] - '0';
643  mon = 10 * mon + value[i++] - '0';
644  if( mon < 1 || 12 < mon ) throw FieldConvertError(value);
645 
646  mday = value[i++] - '0';
647  mday = 10 * mday + value[i++] - '0';
648  if( mday < 1 || 31 < mday ) throw FieldConvertError(value);
649 
650  ++i; // skip '-'
651 
652  hour = value[i++] - '0';
653  hour = 10 * hour + value[i++] - '0';
654  // No check for >= 0 as no '-' are converted here
655  if( 23 < hour ) throw FieldConvertError(value);
656 
657  ++i; // skip ':'
658 
659  min = value[i++] - '0';
660  min = 10 * min + value[i++] - '0';
661  // No check for >= 0 as no '-' are converted here
662  if( 59 < min ) throw FieldConvertError(value);
663 
664  ++i; // skip ':'
665 
666  sec = value[i++] - '0';
667  sec = 10 * sec + value[i++] - '0';
668 
669  // No check for >= 0 as no '-' are converted here
670  if( 60 < sec ) throw FieldConvertError(value);
671 
672  if( haveMilliseconds )
673  {
674  millis = (100 * (value[i+1] - '0')
675  + 10 * (value[i+2] - '0')
676  + (value[i+3] - '0'));
677  }
678  else
679  millis = 0;
680 
681  return UtcTimeStamp (hour, min, sec, millis,
682  mday, mon, year);
683  }
684 };
685 
688 {
689  static std::string convert( const UtcTimeOnly& value,
690  bool showMilliseconds = false)
691  throw( FieldConvertError )
692  {
693  char result[ 9+4 ];
694  int hour, minute, second, millis;
695 
696  value.getHMS( hour, minute, second, millis );
697 
698  integer_to_string_padded ( result, 3, hour, 2 );
699  result[2] = ':';
700  integer_to_string_padded ( result + 3, 3, minute, 2 );
701  result[5] = ':';
702  integer_to_string_padded ( result + 6, 3, second, 2 );
703 
704  if( showMilliseconds )
705  {
706  result[8] = '.';
707  if( integer_to_string_padded ( result + 9, 4, millis, 3 )
708  != result + 9 )
709  throw FieldConvertError();
710  }
711 
712  return result;
713  }
714 
715  static UtcTimeOnly convert( const std::string& value )
716  throw( FieldConvertError )
717  {
718  bool haveMilliseconds = false;
719 
720  switch( value.size() )
721  {
722  case 12: haveMilliseconds = true;
723  case 8: break;
724  default: throw FieldConvertError(value);
725  }
726 
727  int i = 0;
728  int c = 0;
729  for( c = 0; c < 2; ++c )
730  if( !IS_DIGIT(value[i++]) ) throw FieldConvertError(value);
731  if( value[i++] != ':' ) throw FieldConvertError(value);
732  for( c = 0; c < 2; ++c )
733  if( !IS_DIGIT(value[i++]) ) throw FieldConvertError(value);
734  if( value[i++] != ':' ) throw FieldConvertError(value);
735  for( c = 0; c < 2; ++c )
736  if( !IS_DIGIT(value[i++]) ) throw FieldConvertError(value);
737 
738  if( haveMilliseconds )
739  {
740  // ++i instead of i++ skips the '.' separator
741  for( c = 0; c < 3; ++c )
742  if( !IS_DIGIT(value[++i]) ) throw FieldConvertError(value);
743  }
744 
745  int hour, min, sec, millis;
746 
747  i = 0;
748 
749  hour = value[i++] - '0';
750  hour = 10 * hour + value[i++] - '0';
751  // No check for >= 0 as no '-' are converted here
752  if( 23 < hour ) throw FieldConvertError(value);
753  ++i; // skip ':'
754 
755  min = value[i++] - '0';
756  min = 10 * min + value[i++] - '0';
757  // No check for >= 0 as no '-' are converted here
758  if( 59 < min ) throw FieldConvertError(value);
759  ++i; // skip ':'
760 
761  sec = value[i++] - '0';
762  sec = 10 * sec + value[i++] - '0';
763  // No check for >= 0 as no '-' are converted here
764  if( 60 < sec ) throw FieldConvertError(value);
765 
766  if( haveMilliseconds )
767  {
768  millis = (100 * (value[i+1] - '0')
769  + 10 * (value[i+2] - '0')
770  + (value[i+3] - '0'));
771  }
772  else
773  millis = 0;
774 
775  return UtcTimeOnly( hour, min, sec, millis );
776  }
777 };
778 
781 {
782  static std::string convert( const UtcDate& value )
783  throw( FieldConvertError )
784  {
785  char result[ 9 ];
786  int year, month, day;
787 
788  value.getYMD( year, month, day );
789 
790  integer_to_string_padded( result, 5, year, 4 );
791  integer_to_string_padded( result + 4, 3, month, 2 );
792  integer_to_string_padded( result + 6, 3, day, 2 );
793  return result;
794  }
795 
796  static UtcDate convert( const std::string& value )
797  throw( FieldConvertError )
798  {
799  if( value.size() != 8 ) throw FieldConvertError(value);
800 
801  int i = 0;
802  for( int c=0; c<8; ++c )
803  if( !IS_DIGIT(value[i++]) ) throw FieldConvertError(value);
804 
805  int year, mon, mday;
806 
807  i = 0;
808 
809  year = value[i++] - '0';
810  year = 10 * year + value[i++] - '0';
811  year = 10 * year + value[i++] - '0';
812  year = 10 * year + value[i++] - '0';
813 
814  mon = value[i++] - '0';
815  mon = 10 * mon + value[i++] - '0';
816  if( mon < 1 || 12 < mon )
817  throw FieldConvertError(value);
818 
819  mday = value[i++] - '0';
820  mday = 10 * mday + value[i++] - '0';
821  if( mday < 1 || 31 < mday )
822  throw FieldConvertError(value);
823 
824  return UtcDateOnly( mday, mon, year );
825  }
826 };
827 
829 
830 typedef StringConvertor STRING_CONVERTOR;
836 typedef StringConvertor CURRENCY_CONVERTOR;
837 typedef StringConvertor MULTIPLEVALUESTRING_CONVERTOR;
838 typedef StringConvertor MULTIPLESTRINGVALUE_CONVERTOR;
839 typedef StringConvertor MULTIPLECHARVALUE_CONVERTOR;
840 typedef StringConvertor EXCHANGE_CONVERTOR;
843 typedef StringConvertor LOCALMKTDATE_CONVERTOR;
844 typedef StringConvertor DATA_CONVERTOR;
847 typedef StringConvertor MONTHYEAR_CONVERTOR;
848 typedef StringConvertor DAYOFMONTH_CONVERTOR;
855 typedef StringConvertor COUNTRY_CONVERTOR;
856 typedef StringConvertor TZTIMEONLY_CONVERTOR;
857 typedef StringConvertor TZTIMESTAMP_CONVERTOR;
858 typedef StringConvertor XMLDATA_CONVERTOR;
859 typedef StringConvertor LANGUAGE_CONVERTOR;
861 }
862 
863 #endif //FIX_FIELDCONVERTORS_H
DoubleConvertor AMT_CONVERTOR
Unable to convert field into its native format.
Definition: Exceptions.h:66
static std::string convert(const UtcTimeOnly &value, bool showMilliseconds=false)
IntConvertor SEQNUM_CONVERTOR
#define UNSIGNED_VALUE_OF(x)
static std::string convert(char value)
StringConvertor DAYOFMONTH_CONVERTOR
static UtcDate convert(const std::string &value)
static std::string convert(const UtcTimeStamp &value, bool showMilliseconds=false)
Time only represented in UTC.
Definition: FieldTypes.h:469
StringConvertor COUNTRY_CONVERTOR
CheckSumConvertor CHECKSUM_CONVERTOR
Converts a UtcTimeStamp to/from a string.
int number_of_symbols_in(const signed_int value)
static double convert(const std::string &value)
BoolConvertor BOOLEAN_CONVERTOR
DoubleConvertor PRICEOFFSET_CONVERTOR
static bool convert(const std::string &value, char &result)
StringConvertor LOCALMKTDATE_CONVERTOR
char * integer_to_string(char *buf, const size_t len, signed_int t)
IntConvertor LENGTH_CONVERTOR
static char convert(const std::string &value)
static UtcTimeOnly convert(const std::string &value)
static const char digit_pairs[201]
Converts checksum to/from a string.
UtcTimeOnlyConvertor UTCTIMEONLY_CONVERTOR
Converts a UtcTimeOnly to/from a string.
StringConvertor MULTIPLECHARVALUE_CONVERTOR
DoubleConvertor PRICE_CONVERTOR
void getHMS(int &hour, int &minute, int &second, int &millis) const
Load the referenced values with the hour, minute, second and millisecond portions of the time in a si...
Definition: FieldTypes.h:152
static std::string convert(signed_int value)
StringConvertor XMLDATA_CONVERTOR
static bool convert(std::string::const_iterator str, std::string::const_iterator end, signed_int &result)
Definition: Acceptor.cpp:34
void getYMD(int &year, int &month, int &day) const
Load the referenced values with the year, month and day portions of the date in a single operation...
Definition: FieldTypes.h:145
Date only represented in UTC.
Definition: FieldTypes.h:551
UtcDate UtcDateOnly
Definition: FieldTypes.h:624
static bool convertPositive(std::string::const_iterator str, std::string::const_iterator end, signed_int &result)
Converts only positive number e.g.
StringConvertor EXCHANGE_CONVERTOR
static std::string convert(double value, int padding=0)
static bool convert(const std::string &value, signed_int &result)
StringConvertor MULTIPLESTRINGVALUE_CONVERTOR
StringConvertor TZTIMESTAMP_CONVERTOR
static UtcTimeStamp convert(const std::string &value, bool calculateDays=false)
UtcDateConvertor UTCDATE_CONVERTOR
StringConvertor LANGUAGE_CONVERTOR
static int convert(const std::string &value)
StringConvertor STRING_CONVERTOR
static signed_int convert(const std::string &value)
static bool convert(const std::string &value)
static std::string convert(int value)
UtcDateConvertor UtcDateOnlyConvertor
StringConvertor MULTIPLEVALUESTRING_CONVERTOR
#define IS_DIGIT(x)
Converts character to/from a string.
static std::string convert(const UtcDate &value)
static std::string convert(bool value)
DoubleConvertor PERCENTAGE_CONVERTOR
Converts boolean to/from a string.
static signed_int convertPositive(const std::string &value)
unsigned int unsigned_int
Date and Time represented in UTC.
Definition: FieldTypes.h:399
Converts integer to/from a string.
StringConvertor CURRENCY_CONVERTOR
#define STRING_SPRINTF
Definition: Utility.h:196
StringConvertor TZTIMEONLY_CONVERTOR
CharConvertor CHAR_CONVERTOR
StringConvertor MONTHYEAR_CONVERTOR
static bool convert(const std::string &value, int &result)
StringConvertor DATA_CONVERTOR
static const std::string & convert(const std::string &value)
Converts a UtcDate to/from a string.
IntConvertor NUMINGROUP_CONVERTOR
#define IS_SPACE(x)
DoubleConvertor FLOAT_CONVERTOR
IntConvertor INT_CONVERTOR
Empty converter is a no-op.
static bool convert(const std::string &value, bool &result)
DoubleConvertor QTY_CONVERTOR
char * integer_to_string_padded(char *buf, const size_t len, signed_int t, const size_t width=0, const char paddingChar='0')
UtcTimeStampConvertor UTCTIMESTAMP_CONVERTOR
int signed_int
static bool convert(const std::string &value, double &result)
static double fast_atof(const char *p)
Converts double to/from a string.
EmptyConvertor StringConvertor

Generated on Thu Sep 5 2019 11:07:58 for QuickFIX by doxygen 1.8.13 written by Dimitri van Heesch, © 1997-2001