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
| ) |  |

inline static

Definition at line 591 of file FieldConvertors.h.

{
char ch = value[i];
if( !IS_DIGIT(ch)) throw FieldConvertError(value);
fraction = (fraction * 10) + ch - '0';
}
return UtcTimeOnly (hour, min, sec, fraction, len - 8 - 1);
}
};
struct UtcDateConvertor
{
static std::string convert( const UtcDate& value )
throw( FieldConvertError )
{
int year, month, day;
value.getYMD( year, month, day );
char result[ 8 ];
integer_to_string_padded( result, 4, year );
integer_to_string_padded( result + 4, 2, month );
integer_to_string_padded( result + 6, 2, day );

## convert() [2/2]

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

inline static

Definition at line 565 of file FieldConvertors.h.

: 8);
}
static UtcTimeOnly convert( const std::string& value)
throw( FieldConvertError )
{
size_t len = value.size();
if (len < 8 || len > 18) throw FieldConvertError(value);
size_t i = 0;
int c = 0;
for( c = 0; c < 2; ++c )
if( !IS_DIGIT(value[i++]) ) throw FieldConvertError(value);
if( value[i++] != ':' ) throw FieldConvertError(value);
for( c = 0; c < 2; ++c )
if( !IS_DIGIT(value[i++]) ) throw FieldConvertError(value);
if( value[i++] != ':' ) throw FieldConvertError(value);
for( c = 0; c < 2; ++c )
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:

- FieldConvertors.h

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