Static Public Member Functions | List of all members
FIX::UtcTimeOnlyConvertor Struct Reference

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

#include <FieldConvertors.h>

Static Public Member Functions

static std::string convert (const UtcTimeOnly &value, int precision=0) throw ( FieldConvertError )
 
static UtcTimeOnly convert (const std::string &value) throw ( FieldConvertError )
 

Detailed Description

Converts a UtcTimeOnly to/from a string.

Definition at line 563 of file FieldConvertors.h.

Member Function Documentation

◆ convert() [1/2]

static UtcTimeOnly FIX::UtcTimeOnlyConvertor::convert ( const std::string &  value)
throw (FieldConvertError
)
inlinestatic

Definition at line 591 of file FieldConvertors.h.

622  {
623  char ch = value[i];
624  if( !IS_DIGIT(ch)) throw FieldConvertError(value);
625  fraction = (fraction * 10) + ch - '0';
626  }
627 
628  return UtcTimeOnly (hour, min, sec, fraction, len - 8 - 1);
629  }
630 };
631 
633 struct UtcDateConvertor
634 {
635  static std::string convert( const UtcDate& value )
636  throw( FieldConvertError )
637  {
638  int year, month, day;
639  value.getYMD( year, month, day );
640 
641  char result[ 8 ];
642 
643  integer_to_string_padded( result, 4, year );
644  integer_to_string_padded( result + 4, 2, month );
645  integer_to_string_padded( result + 6, 2, day );
646 

◆ convert() [2/2]

static std::string FIX::UtcTimeOnlyConvertor::convert ( const UtcTimeOnly value,
int  precision = 0 
)
throw (FieldConvertError
)
inlinestatic

Definition at line 565 of file FieldConvertors.h.

571  : 8);
572  }
573 
574  static UtcTimeOnly convert( const std::string& value)
575  throw( FieldConvertError )
576  {
577  size_t len = value.size();
578  if (len < 8 || len > 18) throw FieldConvertError(value);
579 
580  size_t i = 0;
581  int c = 0;
582  for( c = 0; c < 2; ++c )
583  if( !IS_DIGIT(value[i++]) ) throw FieldConvertError(value);
584  if( value[i++] != ':' ) throw FieldConvertError(value);
585  for( c = 0; c < 2; ++c )
586  if( !IS_DIGIT(value[i++]) ) throw FieldConvertError(value);
587  if( value[i++] != ':' ) throw FieldConvertError(value);
588  for( c = 0; c < 2; ++c )
589  if( !IS_DIGIT(value[i++]) ) throw FieldConvertError(value);

Referenced by FIX::UtcDateField::getValue(), FIX::UtcDateField::operator!=(), and FIX::UtcDateField::operator<().


The documentation for this struct was generated from the following file:
FIX::TYPE::UtcDate
@ UtcDate
Definition: FieldTypes.h:948
FIX::integer_to_string_padded
char * integer_to_string_padded(char *buf, const size_t len, signed_int t, const char paddingChar='0')
Definition: FieldConvertors.h:149
FIX::TYPE::UtcTimeOnly
@ UtcTimeOnly
Definition: FieldTypes.h:950
IS_DIGIT
#define IS_DIGIT(x)
Definition: FieldConvertors.h:66
FIX::UtcTimeOnlyConvertor::convert
static std::string convert(const UtcTimeOnly &value, int precision=0)
Definition: FieldConvertors.h:565

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