43 virtual const Char* typeName()
const = 0;
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');
402 template <
class Integer,
class Descendant>
405 template <
class Integral,
bool IsSigned>
408 bool operator()(Integral
value)
const 410 return (0 <= value && value < 10);
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>());
503 value =
Decimal(static_cast<Decimal::Mantissa>(container.get<Integer>()), 0);
724 value =
static_cast<Int64
>(container.get<
Timestamp>().sinceEpoch());
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);
915 template <
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(...);
940 : (
sizeof(Enumeration) ==
sizeof(kind<Value>(
ONIXS_CMEMDH_NULLPTR)) ? ValueKinds::Enumeration : ValueKinds::Ordinary))
946 template <
class Value,
int>
960 if (!converter.
convert(result, container))
974 return converter.
convert(result, container);
982 template <
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);
1027 template <
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);
1070 template <
class Value>
1083 return Traits::convert(converter, container);
1091 return Traits::convert(result, converter, container);
virtual bool convert(UInt16 &, const ValueContainer &) const
Tries to convert the value stored in the given container into an integer.
Implements the value conversion abstraction for the timestamp fields.
bool convert(Decimal &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into a decimal.
bool convert(Int16 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
BitSet Result
Type of the conversion output.
bool operator()(typename Traits::Result &result, const ValueConverter &converter, const ValueContainer &container) const
Converts the given value into a value of target type.
virtual bool convert(Timestamp &, const ValueContainer &) const
Tries to convert the value stored in the given container into a timestamp.
bool convert(Timestamp &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a timestamp.
virtual bool convert(Int16 &, const ValueContainer &) const
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(MaturityMonthYear &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a month-year.
DecimalMantissa Mantissa
Aliases mantissa component type.
bool convert(Int16 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
#define ONIXS_CMEMDH_OVERRIDE
bool convert(Int32 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(StrRef &, const ValueContainer &) const override
Tries to convert the value stored in the given container into the string reference.
bool empty() const
Indicates whether the referenced text is empty.
bool convert(UInt16 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(UInt64 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(UInt16 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Int16 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
virtual bool convert(Char &, const ValueContainer &) const
Tries to convert the value stored in the given container into a character.
bool convert(Int8 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
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...
Enum
Identifies kinds of FIX field values.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
bool convert(Int8 &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.
#define ONIXS_CMEMDH_NULLPTR
bool convert(Decimal &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a decimal.
virtual bool convert(MaturityMonthYear &, const ValueContainer &) const
Tries to convert the value stored in the given container into a month-year.
Implements the value conversion abstraction for the integer fields.
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...
#define ONIXS_CMEMDHFIX_NAMESPACE_BEGIN
Represents time point without time-zone information.
bool convert(Char &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a character.
virtual const Char * typeName() const =0
The name of the type whose values are manipulated through the given converter.
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.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
virtual bool convert(UInt8 &, const ValueContainer &) const
Tries to convert the value stored in the given container into an integer.
bool convert(UInt8 &, 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(UInt32 &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.
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...
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...
bool convert(Int16 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Int16 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(UInt16 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(UInt64 &, 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(Decimal &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into a decimal.
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...
virtual bool convert(Decimal &, const ValueContainer &) const
Tries to convert the value stored in the given container into a decimal.
bool convert(Decimal &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into a decimal.
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...
bool convert(Char &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into a character.
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...
Implements the value conversion abstraction for the decimal fields.
bool convert(UInt64 &value, const ValueContainer &container) 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.
Implements value conversion operations through value conversion traits.
bool convert(Int8 &, 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.
char Char
Character type alias.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
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...
Identifies kinds of FIX field values.
bool convert(Decimal &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into a decimal.
virtual bool convert(Int64 &, const ValueContainer &) const
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.
#define ONIXS_CMEMDHFIX_NAMESPACE_END
bool convert(UInt64 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
Traits class used identify a field value kind.
The field value traits used in conversion related operations.
bool convert(MaturityMonthYear &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a month-year.
bool convert(UInt16 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
virtual bool convert(UInt64 &, const ValueContainer &) const
Tries to convert the value stored in the given container into an integer.
bool convert(Int32 &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.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
const Char * items() const
Read-only content.
bool convert(Char &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into a character.
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...
Provides efficient way of accessing text-based values without copying content of the text being refer...
Implements the value conversion abstraction for fields whose values represent a single character...
bool convert(UInt32 &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(StrRef &ref, const ValueContainer &container) const override
Tries to convert the value stored in the given container into the string reference.
A real number with floating exponent.
virtual bool convert(Int32 &, const ValueContainer &) const
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.
Implements the value conversion abstraction for the text fields.
Traits::Result Result
Conversion output type.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
bool fromStr(Decimal &, const Char *, size_t)
Deserializes a decimal number from the given text presentation.
bool convert(Int32 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
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(Int8 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
ValueConversionTraits< Value, ValueKind< Value >::Kind > Traits
Conversion traits.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
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...
bool convert(MaturityMonthYear &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a month-year.
Value Result
Type of the conversion output.
Enumeration::Enum Result
Type of the conversion output.
Implements the value conversion abstraction for the integer fields.
bool convert(Int32 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
#define ONIXS_CMEMDH_EXPORTED
virtual bool convert(UInt32 &, const ValueContainer &) const
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.
bool convert(UInt8 &value, const ValueContainer &container) 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.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
bool convert(UInt64 &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(Char &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a character.
bool convert(UInt8 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Int16 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
Implements the value conversion abstraction for the month-year fields.
Implements the value conversion abstraction for the integer fields.
bool convert(MaturityMonthYear &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a month-year.
bool convert(UInt32 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Int64 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
Traits::Result operator()(const ValueConverter &converter, const ValueContainer &container) const
Converts the given value into a value of target type.
virtual bool convert(StrRef &, const ValueContainer &) const
Tries to convert the value stored in the given container into the string reference.
UInt16 UInt16
uInt16 optional.
bool convert(StrRef &, const ValueContainer &) const override
Tries to convert the value stored in the given container into the string reference.
bool convert(Int64 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
bool convert(StrRef &, const ValueContainer &) const override
Tries to convert the value stored in the given container into the string reference.
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(Int8 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
Implements the value conversion abstraction for the integer fields.
Implements the value conversion abstraction for the integer fields.
bool convert(Char &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a character.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
bool convert(Decimal &, const ValueContainer &) const override
Tries to convert the value stored in the given container into a decimal.
Implements the value conversion abstraction for the integer fields.
bool convert(UInt32 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
void throwBadConversion(const Char *typeName)
bool convert(Int64 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
bool convert(Int64 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
size_t size() const
Number of chars.
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(Int64 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
Implements the value conversion abstraction for the integer fields.
bool convert(UInt16 &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(Timestamp &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into a timestamp.
bool convert(Int8 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
Container for a value of any supported kinds.
bool convert(Int32 &, const ValueContainer &) 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(Int64 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
Implements the value conversion abstraction for the integer fields.
Abstraction gathering operations over a value of a particular type stored as a field in a message...
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
const Char * typeName() const override
The name of the type whose values are manipulated through the given converter.
bool convert(UInt8 &value, const ValueContainer &container) const override
Tries to convert the value stored in the given container into an integer.
virtual bool convert(Int8 &, const ValueContainer &) const
Tries to convert the value stored in the given container into an integer.
bool convert(UInt8 &, const ValueContainer &) const override
Tries to convert the value stored in the given container into an integer.
Implements the value conversion abstraction for the integer fields.
void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.