|
| Tags (const Feature &feature) |
|
| Tags (FeatureStore *store, FeaturePtr ptr) |
|
| Tags (FeatureStore *store, TagTablePtr ptr) |
|
| Tags (const Tags &other)=default |
|
Iterator | begin () const |
|
size_t | size () const noexcept |
| Returns the number of tags.
|
|
TagValue | operator[] (std::string_view key) const noexcept |
| Looks up the tag value for the given key.
|
|
bool | hasTag (std::string_view k) const noexcept |
| Checks if this set of tags contains a tag with the given key.
|
|
bool | hasTag (std::string_view k, std::string_view v) const noexcept |
| Checks if this set of tags contains a tag with the given key and value.
|
|
bool | operator== (const Tags &other) const |
| Checks if both Tags objects contain the same tags.
|
|
bool | operator!= (const Tags &other) const |
|
An object describing the key/value attributes of a Feature.
Tags are obtained via Feature::tags() and can be iterated or implicitly converted to a std::vector
, std::map
or std::unordered_map
.
Tags tags = hotel.tags();
{
std::cout << tag.key() << " = " << tag.value() << std::endl;
}
A key/value pair that describes an attribute of a Feature.
Definition Tag.h:26
Note: By default, tags are returned in storage order of their keys, which is consistent across all tag sets stored in the same GOL, but which generally is not alphabetical order. If you want tags sorted alphabetically by key, assign the Tags object to a std::map
, or to a std::vector
which you can then explicitly std::sort()
.
Warning: A Tags object is a lightweight wrapper around a pointer to a Feature's tag data, contained in a FeatureStore. It becomes invalid once that FeatureStore is closed. To use a Feature's keys and values beyond the lifetime of the FeatureStore, assign the Tags object to a std::vector
or std::unordered_map
whose types are std::string
, which allocate copies of the key/value data.
- See also
- Tag, TagValue