86 value_.reset(data, size);
134 return (tagValue.
tag() == tag_);
157 : container_(&container)
158 , ref_(std::find_if(container.begin(), container.end(),
TagValueSelector(selection)))
164 operator bool()
const
166 return (container_ && ref_ != container_->end());
173 assert(
static_cast<bool>(*
this));
184 assert(
static_cast<bool>(*
this));
186 const Tag selection = ref_->tag();
188 ref_ = std::find_if(++ref_, container_->end(),
TagValueSelector(selection));
237 return tagValues_.begin();
244 return tagValues_.end();
252 return std::find_if(tagValues_.begin(), tagValues_.end(),
TagValueSelector(tag));
268 deserialize(tagValues_, fixStr, fixSize);
282 if (result != container.
end())
284 return result->value();
296template <
class Number>
311template <
class Number>
316 if (strValue.
empty())
318 number = defaultValue;
337 toStr(str, container);
#define ONIXS_CMEMDHFIX_NAMESPACE_BEGIN
#define ONIXS_CMEMDH_LTWT
#define ONIXS_CMEMDH_LTWT_EXPORTED
#define ONIXS_CMEMDHFIX_NAMESPACE_END
#define ONIXS_CMEMDH_NULLPTR
#define ONIXS_CMEMDH_EXPORTED
Sequence of tag-value pairs preserving order of pairs and allowing presence of multiple tag-value pai...
Iterator begin() const
Returns iterator pointing to the first item of the container.
MultiContainer()
Initializes an empty instance.
~MultiContainer()
Finalizes the instance.
Iterator first(Key tag) const
Returns iterator pointing to the first (of possibly multiple) item having the given key (tag) value.
SelectionIterator all(Key tag) const
Allows to iterate all items in the container having the given tag value.
void deserialize(const Char *fixStr, size_t fixSize)
Full-fill collection from the FIX (tag=value) string presentation.
Iterator end() const
Returns iterator pointing to the item beyond the last one.
TagValueSelectionIterator SelectionIterator
Iterator over items having the same tag value.
Tag Key
Alias for tag component which serves like an entry key.
TagValues::const_iterator Iterator
Iterator over container items.
TagValue::Value Value
Alias for value type.
Iterator over tag-value pairs having the same tag value.
const TagValue & operator*() const
Returns instance of the tag-value pair referenced by the given instance.
TagValueSelectionIterator(const TagValues &container, Tag selection)
Initializes the instance to iterate tag-values with the given tag value for the given collection.
TagValueSelectionIterator()
Initializes the iterator pointing to nothing.
TagValueSelectionIterator & operator++()
Advances the given instance to the next tag-value instance in the selection or invalidates the instan...
Functor to be used in algorithms to find tag-value pair in collections by tag component.
bool operator()(const TagValue &tagValue) const
Checks whether tag component of the given tag-value matches value stored by the functor.
TagValueSelector(Tag tag)
Initializes functor with the given tag.
Represents a pair of a tag and a value.
TagValue()
Initialies instance with zero tag and empty value.
void value(const Char *data, size_t size)
Updates value component.
Tag tag() const
Tag component of the pair.
StrRef Value
Alias for the value type.
void value(const Value &value)
Updates value component.
TagValue(Tag tag, const Value &value)
Initializes instance according to the given attributes.
void tag(Tag tag)
Updates tag component.
const Value & value() const
Value component of the pair.
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.
UInt32 Tag
The type whose values are used to locate fields in the FIX-like messages.
void toStr(std::string &str, const Message &message)
Serializes FIX message into tag=value format.
TagValues::const_iterator TagValueConstIterator
Constant iterator over the tag-value sequence.
std::vector< TagValue > TagValues
Sequence of tag-value pairs.
TagValues::iterator TagValueIterator
Iterator over the tag-value sequence.
MultiContainer::Value valueOrDefault(const MultiContainer &container, Tag tag, const MultiContainer::Value &defaultValue=MultiContainer::Value())
Finds a tag-value entry in the given collection by the given tag and returns its value component.
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.