184 ref = container.get<
StrRef>();
199 else if (str.
empty())
300 str.append(1, container.get<
Char>());
319 return charToDigit(
value, container.get<
Char>());
324 return charToDigit(
value, container.get<
Char>());
329 return charToDigit(
value, container.get<
Char>());
334 return charToDigit(
value, container.get<
Char>());
339 return charToDigit(
value, container.get<
Char>());
344 return charToDigit(
value, container.get<
Char>());
349 return charToDigit(
value, container.get<
Char>());
354 return charToDigit(
value, container.get<
Char>());
361 if (charToDigit(mantissa, container.get<
Char>()))
384 template <
class Integer>
385 static bool charToDigit(Integer& converted,
Char original)
387 if (
'0' <= original &&
'9' >= original)
389 converted =
static_cast<Integer
>(original -
'0');
402template <
class Integer,
class Descendant>
405 template <
class Integral,
bool IsSigned>
408 bool operator()(Integral
value)
const
414 template <
class Integral>
415 struct FitsToChar<Integral, false>
417 bool operator()(Integral
value)
const
423 typedef FitsToChar<Integer, !(static_cast<Integer>(-1) >
static_cast<Integer
>(0))> CanFitToChar;
433 const Integer actual = container.get<Integer>();
435 if (CanFitToChar()(actual))
447 value =
static_cast<Int8>(container.get<Integer>());
454 value =
static_cast<UInt8>(container.get<Integer>());
461 value =
static_cast<Int16>(container.get<Integer>());
468 value =
static_cast<UInt16>(container.get<Integer>());
475 value =
static_cast<Int32>(container.get<Integer>());
482 value =
static_cast<UInt32>(container.get<Integer>());
489 value =
static_cast<Int64
>(container.get<Integer>());
496 value =
static_cast<UInt64>(container.get<Integer>());
804 return "MaturityMonthYear";
888 issue +=
"Cannot transform ";
890 issue += typeName ? typeName :
"Unknown type";
892 issue +=
" value to the value of the requested "
893 "type because either conversion between "
894 "types does not exist or the value cannot "
895 "be fit to the value of the target type. ";
897 throw std::domain_error(issue);
915template <
class Value>
918 typedef char Ordinary[1];
920 typedef char Enumeration[2];
922 typedef char Bits[3];
924 template <
class Other>
925 static Bits& kind(
typename Other::Bits*);
927 template <
class Other>
928 static Enumeration& kind(
typename Other::Enum*);
930 template <
class Other>
931 static Ordinary& kind(...);
946template <
class Value,
int>
960 if (!converter.
convert(result, container))
974 return converter.
convert(result, container);
982template <
class Enumeration>
986 typedef typename Enumeration::Enum
Result;
994 typename Enumeration::Base result;
996 if (!converter.
convert(result, container))
1001 return static_cast<Result>(result);
1010 typename Enumeration::Base base;
1012 if (converter.
convert(base, container))
1014 result =
static_cast<Result>(base);
1027template <
class BitSet>
1039 typename BitSet::Bits bits;
1041 if (!converter.
convert(bits, container))
1046 return BitSet(bits);
1055 typename BitSet::Bits bits;
1057 if (converter.
convert(bits, container))
1059 result = BitSet(bits);
1070template <
class Value>
#define ONIXS_CMEMDHFIX_NAMESPACE_BEGIN
#define ONIXS_CMEMDHFIX_NAMESPACE_END
#define ONIXS_CMEMDH_NULLPTR
#define ONIXS_CMEMDH_EXPORTED
#define ONIXS_CMEMDH_OVERRIDE
A real number with floating exponent.
DecimalMantissa Mantissa
Aliases mantissa component type.
Implements the value conversion abstraction for the integer fields.
bool convert(Int64 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(UInt8 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
void toStr(std::string &str, const ValueContainer &container) const override
Outputs the text presentation of the FIX value stored in the given container into the given string.
bool convert(Int16 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(UInt32 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Decimal &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into a decimal.
bool convert(UInt64 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Int8 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Timestamp &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a timestamp.
bool convert(StrRef &, const ValueContainer &) const override
Tries to convert the value stored in the given container into the string reference.
bool convert(MaturityMonthYear &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a month-year.
bool convert(Int32 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(UInt16 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Char &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into a character.
Container for a value of any supported kinds.
Traits class used identify a field value kind.
@ Kind
The kind of the given field value by its type.
Provides efficient way of accessing text-based values without copying content of the text being refer...
const Char * items() const
Read-only content.
size_t size() const
Number of chars.
bool empty() const
Indicates whether the referenced text is empty.
Represents time point without time-zone information.
Ticks sinceEpoch() const
Number of nanoseconds since the Epoch (01-01-1970).
void throwBadConversion(const Char *typeName)
bool value(Number &number, const MultiContainer &container, Tag tag)
Finds a tag-value entry in the given collection by the given tag and returns its value component tran...
bool fromStr(Decimal &, const Char *, size_t)
Deserializes a decimal number from the given text presentation.
char Char
Character type alias.
void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.
Implements the value conversion abstraction for fields whose values represent a single character.
bool convert(Int64 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(UInt8 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
void toStr(std::string &str, const ValueContainer &container) const override
Outputs the text presentation of the FIX value stored in the given container into the given string.
bool convert(Int16 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(UInt32 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Decimal &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into a decimal.
bool convert(UInt64 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Int8 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Timestamp &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a timestamp.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
bool convert(MaturityMonthYear &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a month-year.
bool convert(Int32 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(UInt16 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(StrRef &ref, const ValueContainer &container) const override
Tries to convert the value stored in the given container into the string reference.
bool convert(Char &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into a character.
static const ValueConverter & self()
Implements the value conversion abstraction for the decimal fields.
bool convert(UInt32 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
void toStr(std::string &str, const ValueContainer &container) const override
Outputs the text presentation of the FIX value stored in the given container into the given string.
bool convert(UInt8 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Int8 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Decimal &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into a decimal.
bool convert(Int64 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Timestamp &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a timestamp.
bool convert(Int16 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
bool convert(StrRef &, const ValueContainer &) const override
Tries to convert the value stored in the given container into the string reference.
bool convert(UInt64 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(MaturityMonthYear &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a month-year.
bool convert(Int32 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Char &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a character.
bool convert(UInt16 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
static const ValueConverter & self()
Implements the value conversion abstraction for the integer fields.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
static const ValueConverter & self()
Implements the value conversion abstraction for the integer fields.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
static const ValueConverter & self()
Implements the value conversion abstraction for the integer fields.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
static const ValueConverter & self()
Implements the value conversion abstraction for the integer fields.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
static const ValueConverter & self()
Implements the value conversion abstraction for the month-year fields.
bool convert(UInt32 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
void toStr(std::string &str, const ValueContainer &container) const override
Outputs the text presentation of the FIX value stored in the given container into the given string.
bool convert(UInt8 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Int8 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Int64 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Decimal &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a decimal.
bool convert(MaturityMonthYear &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into a month-year.
bool convert(Timestamp &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a timestamp.
bool convert(Int16 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
bool convert(StrRef &, const ValueContainer &) const override
Tries to convert the value stored in the given container into the string reference.
bool convert(UInt64 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Int32 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Char &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a character.
bool convert(UInt16 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
static const ValueConverter & self()
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
static const ValueConverter & self()
Implements the value conversion abstraction for the text fields.
bool convert(Int64 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(UInt8 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
void toStr(std::string &str, const ValueContainer &container) const override
Outputs the text presentation of the FIX value stored in the given container into the given string.
bool convert(Int16 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Timestamp &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into a timestamp.
bool convert(UInt32 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Decimal &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into a decimal.
bool convert(UInt64 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Int8 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
bool convert(MaturityMonthYear &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a month-year.
bool convert(Int32 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(UInt16 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(StrRef &ref, const ValueContainer &container) const override
Tries to convert the value stored in the given container into the string reference.
bool convert(Char &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into a character.
static const ValueConverter & self()
Implements the value conversion abstraction for the timestamp fields.
bool convert(Int64 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(UInt32 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
void toStr(std::string &str, const ValueContainer &container) const override
Outputs the text presentation of the FIX value stored in the given container into the given string.
bool convert(UInt8 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Timestamp &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into a timestamp.
bool convert(Int8 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(UInt64 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Decimal &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a decimal.
bool convert(Int16 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
bool convert(StrRef &, const ValueContainer &) const override
Tries to convert the value stored in the given container into the string reference.
bool convert(MaturityMonthYear &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a month-year.
bool convert(Int32 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Char &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a character.
bool convert(UInt16 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
static const ValueConverter & self()
Implements the value conversion abstraction for the integer fields.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
static const ValueConverter & self()
Implements the value conversion abstraction for the integer fields.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
static const ValueConverter & self()
Implements the value conversion abstraction for the integer fields.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
static const ValueConverter & self()
Implements the value conversion abstraction for the integer fields.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
static const ValueConverter & self()
static BitSet convert(const ValueConverter &converter, const ValueContainer &container)
Converters the given value by using the specified value converter and returns the result of conversio...
static bool convert(BitSet &result, const ValueConverter &converter, const ValueContainer &container)
Tries to convert the given value using the given value converter and puts the result of the conversio...
BitSet Result
Type of the conversion output.
Enumeration::Enum Result
Type of the conversion output.
static Result convert(const ValueConverter &converter, const ValueContainer &container)
Converters the given value by using the specified value converter and returns the result of conversio...
static bool convert(Result &result, const ValueConverter &converter, const ValueContainer &container)
Tries to convert the given value using the given value converter and puts the result of the conversio...
The field value traits used in conversion related operations.
static Result convert(const ValueConverter &converter, const ValueContainer &container)
Converters the given value by using the specified value converter and returns the result of conversio...
Value Result
Type of the conversion output.
static bool convert(Result &result, const ValueConverter &converter, const ValueContainer &container)
Tries to convert the given value using the given value converter and puts the result of the conversio...
Implements value conversion operations through value conversion traits.
bool operator()(typename Traits::Result &result, const ValueConverter &converter, const ValueContainer &container) const
Converts the given value into a value of target type.
Traits::Result Result
Conversion output type.
ValueConversionTraits< Value, ValueKind< Value >::Kind > Traits
Conversion traits.
Traits::Result operator()(const ValueConverter &converter, const ValueContainer &container) const
Converts the given value into a value of target type.
Abstraction gathering operations over a value of a particular type stored as a field in a message.
virtual bool convert(StrRef &, const ValueContainer &) const
Tries to convert the value stored in the given container into the string reference.
virtual void toStr(std::string &, const ValueContainer &) const
Outputs the text presentation of the FIX value stored in the given container into the given string.
virtual bool convert(MaturityMonthYear &, const ValueContainer &) const
Tries to convert the value stored in the given container into a month-year.
virtual bool convert(UInt64 &, const ValueContainer &) const
Tries to convert the value stored in the given container into an integer.
virtual bool convert(Timestamp &, const ValueContainer &) const
Tries to convert the value stored in the given container into a timestamp.
virtual bool convert(UInt16 &, const ValueContainer &) const
Tries to convert the value stored in the given container into an integer.
virtual bool convert(UInt32 &, const ValueContainer &) const
Tries to convert the value stored in the given container into an integer.
virtual bool convert(UInt8 &, const ValueContainer &) const
Tries to convert the value stored in the given container into an integer.
virtual bool convert(Int16 &, const ValueContainer &) const
Tries to convert the value stored in the given container into an integer.
virtual bool convert(Int32 &, const ValueContainer &) const
Tries to convert the value stored in the given container into an integer.
virtual const Char * typeName() const =0
The name of the type whose values are manipulated through the given converter.
virtual bool convert(Decimal &, const ValueContainer &) const
Tries to convert the value stored in the given container into a decimal.
virtual bool convert(Char &, const ValueContainer &) const
Tries to convert the value stored in the given container into a character.
virtual bool convert(Int8 &, const ValueContainer &) const
Tries to convert the value stored in the given container into an integer.
virtual bool convert(Int64 &, const ValueContainer &) const
Tries to convert the value stored in the given container into an integer.
Identifies kinds of FIX field values.
Enum
Identifies kinds of FIX field values.