86 value_.
reset(data, size);
134 return (tagValue.
tag() == tag_);
157 : container_(&container)
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));
257 SelectionIterator
all(Key tag)
const 259 return SelectionIterator(tagValues_, tag);
268 deserialize(tagValues_, fixStr, fixSize);
282 if (result != container.
end())
284 return result->value();
296 template <
class Number>
311 template <
class Number>
316 if (strValue.
empty())
318 number = defaultValue;
337 toStr(str, container);
TagValueSelectionIterator(const TagValues &container, Tag selection)
Initializes the instance to iterate tag-values with the given tag value for the given collection...
TagValueSelector(Tag tag)
Initializes functor with the given tag.
void value(const Char *data, size_t size)
Updates value component.
TagValues::const_iterator Iterator
Iterator over container items.
bool empty() const
Indicates whether the referenced text is empty.
#define ONIXS_CMEMDH_NULLPTR
#define ONIXS_CMEMDHFIX_NAMESPACE_BEGIN
~MultiContainer()
Finalizes the instance.
StrRef Value
Alias for the value type.
#define ONIXS_CMEMDH_LTWT
Iterator end() const
Returns iterator pointing to the item beyond the last one.
void deserialize(const Char *fixStr, size_t fixSize)
Full-fill collection from the FIX (tag=value) string presentation.
bool operator()(const TagValue &tagValue) const
Checks whether tag component of the given tag-value matches value stored by the functor.
Iterator over tag-value pairs having the same tag value.
Tag tag() const
Tag component of the pair.
SelectionIterator all(Key tag) const
Allows to iterate all items in the container having the given tag value.
char Char
Character type alias.
Functor to be used in algorithms to find tag-value pair in collections by tag component.
Represents a pair of a tag and a value.
TagValueSelectionIterator()
Initializes the iterator pointing to nothing.
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...
#define ONIXS_CMEMDHFIX_NAMESPACE_END
bool valueOrDefault(Number &number, const MultiContainer &container, Tag tag, Number defaultValue=Number())
Finds a tag-value entry in the given collection by the given tag and returns its value component tran...
void tag(Tag tag)
Updates tag component.
TagValue(Tag tag, const Value &value)
Initializes instance according to the given attributes.
const Char * items() const
Read-only content.
std::vector< TagValue > TagValues
Sequence of tag-value pairs.
Provides efficient way of accessing text-based values without copying content of the text being refer...
Iterator first(Key tag) const
Returns iterator pointing to the first (of possibly multiple) item having the given key (tag) value...
TagValue::Value Value
Alias for value type.
TagValueSelectionIterator & operator++()
Advances the given instance to the next tag-value instance in the selection or invalidates the instan...
bool fromStr(Decimal &, const Char *, size_t)
Deserializes a decimal number from the given text presentation.
MultiContainer()
Initializes an empty instance.
#define ONIXS_CMEMDH_EXPORTED
const Value & value() const
Value component of the pair.
UInt32 Tag
The type whose values are used to locate fields in the FIX-like messages.
Iterator begin() const
Returns iterator pointing to the first item of the container.
#define ONIXS_CMEMDH_LTWT_EXPORTED
const TagValue & operator*() const
Returns instance of the tag-value pair referenced by the given instance.
TagValueSelectionIterator SelectionIterator
Iterator over items having the same tag value.
std::string toStr(const MultiContainer &container)
Serializes the given tag-value pair.
Sequence of tag-value pairs preserving order of pairs and allowing presence of multiple tag-value pai...
TagValue()
Initialies instance with zero tag and empty value.
TagValues::const_iterator TagValueConstIterator
Constant iterator over the tag-value sequence.
Tag Key
Alias for tag component which serves like an entry key.
TagValues::iterator TagValueIterator
Iterator over the tag-value sequence.
size_t size() const
Number of chars.
void reset()
Resets the reference to nothing.
void value(const Value &value)
Updates value component.