Static Public Member Functions
FIX::UtcDateConvertor Struct Reference

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

#include <FieldConvertors.h>

List of all members.

Static Public Member Functions

static std::string convert (const UtcDate &value) throw ( FieldConvertError )
static UtcDate convert (const std::string &value) throw ( FieldConvertError )

Detailed Description

Converts a UtcDate to/from a string.

Definition at line 780 of file FieldConvertors.h.


Member Function Documentation

static std::string FIX::UtcDateConvertor::convert ( const UtcDate value) throw ( FieldConvertError ) [inline, static]

Definition at line 782 of file FieldConvertors.h.

References FIX::integer_to_string_padded().

Referenced by FIX::DataDictionary::checkValidFormat(), FIX::UtcDateField::getValue(), and FIX::UtcDateField::setValue().

  {
    char result[ 9 ];
    int year, month, day;

    value.getYMD( year, month, day );

    integer_to_string_padded( result, 5, year, 4 );
    integer_to_string_padded( result + 4, 3, month, 2 );
    integer_to_string_padded( result + 6, 3, day, 2 );
    return result;
  }
static UtcDate FIX::UtcDateConvertor::convert ( const std::string &  value) throw ( FieldConvertError ) [inline, static]

Definition at line 796 of file FieldConvertors.h.

References IS_DIGIT.

  {
    if( value.size() != 8 ) throw FieldConvertError(value);

    int i = 0;
    for( int c=0; c<8; ++c )
      if( !IS_DIGIT(value[i++]) ) throw FieldConvertError(value);

    int year, mon, mday;

    i = 0;

    year = value[i++] - '0';
    year = 10 * year + value[i++] - '0';
    year = 10 * year + value[i++] - '0';
    year = 10 * year + value[i++] - '0';

    mon = value[i++] - '0';
    mon = 10 * mon + value[i++] - '0';
    if( mon < 1 || 12 < mon )
      throw FieldConvertError(value);

    mday = value[i++] - '0';
    mday = 10 * mday + value[i++] - '0';
    if( mday < 1 || 31 < mday )
      throw FieldConvertError(value);

    return UtcDateOnly( mday, mon, year );
  }

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

Generated on Mon Jun 23 2014 23:49:39 for QuickFIX by doxygen 1.7.6.1 written by Dimitri van Heesch, © 1997-2001