86 value_ =
StrRef(data, size);
130 return (tagValue.
tag() == tag_);
143 : container_(nullptr)
151 : container_(&container)
152 , ref_(std::find_if(container.begin(), container.end(),
TagValueSelector(selection)))
158 operator bool()
const
160 return (container_ && ref_ != container_->end());
167 assert(
static_cast<bool>(*
this));
178 assert(
static_cast<bool>(*
this));
180 const Tag selection = ref_->tag();
182 ref_ = std::find_if(++ref_, container_->end(),
TagValueSelector(selection));
229 return tagValues_.begin();
236 return tagValues_.end();
244 return std::find_if(tagValues_.begin(), tagValues_.end(),
TagValueSelector(tag));
260 deserialize(tagValues_, fixStr, fixSize);
274 if (result != container.
end())
276 return result->value();
288template <
class Number>
293 return fromStr(number, strValue.begin(), strValue.size());
303template <
class Number>
308 if (strValue.empty())
310 number = defaultValue;
315 return fromStr(number, strValue.begin(), strValue.size());
327 toStr(str, container);
#define ONIXS_CMEMDH_LTWT
#define ONIXS_CMEMDH_LTWT_EXPORTED
#define ONIXS_CMEMDH_MESSAGING_TAGBASED_NAMESPACE_BEGIN
#define ONIXS_CMEMDH_MESSAGING_TAGBASED_NAMESPACE_END
#define ONIXS_CMEMDH_EXPORTED
MultiContainer()
Initializes an empty instance.
~MultiContainer()
Finalizes the instance.
Iterator first(Key tag) const
SelectionIterator all(Key tag) const
void deserialize(const Char *fixStr, size_t fixSize)
TagValueSelectionIterator SelectionIterator
Iterator over items having the same tag value.
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
TagValueSelectionIterator(const TagValues &container, Tag selection)
TagValueSelectionIterator()
Initializes the iterator pointing to nothing.
TagValueSelectionIterator & operator++()
bool operator()(const TagValue &tagValue) const
TagValueSelector(Tag tag)
Initializes functor with the given tag.
Represents a pair of a tag and a 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)
void tag(Tag tag)
Updates tag component.
const Value & value() const
Value component of the pair.
void toStr(std::string &str, const Message &message)
Serializes into a 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())
bool value(Number &number, const MultiContainer &container, Tag tag)
bool fromStr(Int8 &, const Char *, size_t)
char Char
Character type alias.
std::basic_string_view< Char > StrRef