4#include <Foundation/Containers/SmallArray.h>
5#include <Foundation/Reflection/Reflection.h>
6#include <Foundation/Types/TagRegistry.h>
9using plTagSetBlockStorage = plUInt64;
21template <
typename BlockStorageAllocator = plDefaultAllocatorWrapper>
73 PL_ALWAYS_INLINE
bool IsValid()
const {
return m_uiIndex != 0xFFFFFFFF; }
75 PL_ALWAYS_INLINE
bool operator!=(
const Iterator& rhs)
const {
return m_pTagSet != rhs.m_pTagSet || m_uiIndex != rhs.m_uiIndex; }
81 bool IsBitSet()
const;
84 plUInt32 m_uiIndex = 0;
97 friend class Iterator;
99 bool IsTagInAllocatedRange(
const plTag& Tag)
const;
101 void Reallocate(plUInt32 uiNewTagBlockStart, plUInt32 uiNewMaxBlockIndex);
107 plUInt16 m_uiTagBlockStart;
108 plUInt16 m_uiTagCount;
111 plUInt16 GetTagBlockStart()
const;
112 plUInt16 GetTagBlockEnd()
const;
113 void SetTagBlockStart(plUInt16 uiTagBlockStart);
115 plUInt16 GetTagCount()
const;
116 void SetTagCount(plUInt16 uiTagCount);
117 void IncreaseTagCount();
118 void DecreaseTagCount();
124PL_DECLARE_REFLECTABLE_TYPE(PL_FOUNDATION_DLL,
plTagSet);
126template <
typename BlockStorageAllocator>
132template <
typename BlockStorageAllocator>
138template <
typename BlockStorageAllocator>
144template <
typename BlockStorageAllocator>
150#include <Foundation/Types/Implementation/TagSet_inl.h>
Definition SmallArray.h:219
Interface for binary in (read) streams.
Definition Stream.h:22
Interface for binary out (write) streams.
Definition Stream.h:107
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
The tag class stores the necessary lookup information for a single tag which can be used in conjuncti...
Definition Tag.h:16
The tag registry for tags in tag sets.
Definition TagRegistry.h:22
Allows to iterate over all tags in this set.
Definition TagSet.h:62
const plTag & operator*() const
Returns a reference to the current tag.
Definition TagSet_inl.h:204
PL_ALWAYS_INLINE bool IsValid() const
Returns whether the iterator is still pointing to a valid item.
Definition TagSet.h:73
void operator++()
Advances the iterator to the next item.
Definition TagSet_inl.h:190
const plTag * operator->() const
Returns a pointer to the current tag.
Definition TagSet_inl.h:210
A dynamic collection of tags featuring fast lookups.
Definition TagSet.h:23
void RemoveByName(plStringView sTag)
Removes the given tag. If it doesn't exist, nothing happens.
Definition TagSet_inl.h:356
bool IsSet(const plTag &tag) const
Returns true, if the given tag is in the set.
Definition TagSet_inl.h:286
void Remove(const plTag &tag)
Removes the given tag.
Definition TagSet_inl.h:265
bool IsEmpty() const
True if the tag set never contained any tag or was cleared.
Definition TagSet_inl.h:335
void Save(plStreamWriter &inout_stream) const
Writes the tag set state to a stream. Tags itself are serialized as strings.
Definition TagSet_inl.h:456
bool IsSetByName(plStringView sTag) const
Checks whether the named tag is part of this set. Returns false if the tag does not exist.
Definition TagSet_inl.h:365
void Load(plStreamReader &inout_stream, plTagRegistry &inout_registry)
Reads the tag set state from a stream and registers the tags with the given registry.
Definition TagSet_inl.h:472
bool IsAnySet(const plTagSetTemplate &otherSet) const
Returns true if this tag set contains any tag set in the given other tag set.
Definition TagSet_inl.h:301
Iterator GetIterator() const
Returns an iterator to list all tags in this set.
Definition TagSet.h:88
void Set(const plTag &tag)
Adds the given tag to the set.
Definition TagSet_inl.h:235
plUInt32 GetNumTagsSet() const
Returns how many tags are in this set.
Definition TagSet_inl.h:329
void SetByName(plStringView sTag)
Adds the tag with the given name. If the tag does not exist, it will be registered.
Definition TagSet_inl.h:349
void Clear()
Removes all tags from the set.
Definition TagSet_inl.h:341