nw::ModifierRegistry

struct ModifierRegistry

Public Types

using Storage = FixedVector<Modifier>
using iterator = Storage::iterator
using const_iterator = Storage::const_iterator

Public Functions

ModifierRegistry(MemoryResource *allocator = kernel::global_allocator())
ModifierRegistry(const ModifierRegistry&) = delete
ModifierRegistry &operator=(const ModifierRegistry&) = delete
void add(Modifier mod)

Adds a modifier to the system.

iterator begin()
const_iterator begin() const
const_iterator cbegin() const
void clear()

Clears all modifiers.

iterator end()
const_iterator end() const
const_iterator cend() const
int remove(StringView tag)

Removes modifiers by tag.

Parameters:

tag – if string_view ends with ‘*’ then matches any tag that starts with tag

Returns:

int number of modifiers affected

int replace(StringView tag, ModifierVariant value)

Replace modifier value.

Parameters:
  • tag – if string_view ends with ‘*’ then matches any tag that starts with tag

  • value – new value

Returns:

int number of modifiers affected

int replace(StringView tag, const Requirement &req)

Replace modifier requirement.

Parameters:
  • tag – if string_view ends with ‘*’ then matches any tag that starts with tag

  • req – new requirement

Returns:

int number of modifiers affected

size_t size() const

Gets the number of modifiers.