27#include <OnixS/CME/MDH/Utils.h>
65 void
endChange() noexcept override ONIXS_CMEMDH_EMPTY_BODY()
89 : controller_(controller)
91 controller_.beginChange(group,
details);
97 controller_.endChange();
135 template <
class Assignee,
class Value>
149 template <
class Changeable>
153 (changeable.*change)();
166 template <
class Change,
class Changeable,
class Arg>
170 (changeable.*change)(arg);
185 template <
class Change,
class Changeable,
class Arg1,
class Arg2>
189 (changeable.*change)(arg1, arg2);
213 return (&left == &right);
222 return (&left != &right);
233template <
class Type,
class Container = std::vector<Type> >
244 using Size =
typename Items::size_type;
264 , items_(other.items_)
274 template <
class InputIterator>
277 , items_(first, last)
296 return items_.empty();
304 return items_.size();
312 return items_.begin();
330 return items_[index];
342 template <
class Initializer>
345 group_.controlChange(
"Initialize List", &ListSetting::initNoControl<Initializer>, *
this, initializer);
355 group_.controlChange(
356 "Append an Item",
static_cast<void (
Items::*)(
const Item&)
>(&Items::push_back), items_, item
368 group_.controlChange(
"Clear the List", &Items::clear, items_);
394 template <
class InputIterator>
397 group_.controlChange(
"Assign List", &ListSetting::assignRangeNoControl<InputIterator>, *
this, first, last);
410 items_ = other.items_;
420 template <
class Initializer>
421 void initNoControl(Initializer initializer)
428 template <
class InputIterator>
429 void assignRangeNoControl(InputIterator first, InputIterator last)
431 items_.assign(first, last);
443template <
class Type,
class Container>
446 const auto endOfList = list.
end();
448 auto item = list.
begin();
450 while (item != endOfList)
456 if (item != endOfList)
468template <
class Type,
class Container>
473 toStr(str, list, delimiter);
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
#define ONIXS_CMEMDH_LTWT
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
#define ONIXS_CMEMDH_LTWT_EXPORTED
#define ONIXS_CMEMDH_NAMESPACE_END
#define ONIXS_CMEMDH_NODISCARD
Stores a controller-aware list of setting values.
Iterator begin() const
Obtains an iterator to the first item.
ListSetting & assign(InputIterator first, InputIterator last)
Replaces the items with a guarded copy of an iterator range.
const Item & operator[](Size index) const
Accesses an item without bounds checking.
ListSetting & operator=(const ListSetting &other)
Replaces the items with a guarded copy of another list.
void initialize(Initializer initializer)
Replaces the list contents through a guarded initializer callback.
ListSetting & assignNoControl(const ListSetting &other)
Replaces the items without consulting the change controller.
Iterator end() const
Obtains an iterator past the final item.
bool empty() const
Checks whether the list contains no items.
typename Items::size_type Size
ListSetting(InputIterator first, InputIterator last)
Creates an unmanaged list from an iterator range.
std::vector< std::string > Items
ListSetting(const ListSetting &other)
Copies another list's items into an unmanaged list.
void push_back(const Item &item)
Appends a copy of an item through the associated change controller.
void clear()
Removes all items through the associated change controller.
Size size() const
Obtains the number of items in the list.
typename Items::const_iterator Iterator
ListSetting(const SettingGroup *group=nullptr)
Creates an empty list associated with a setting group.
Pairs a successful beginChange() call with endChange().
~SettingChangeGuard()
Completes the guarded setting change.
SettingChangeGuard(SettingChangeController &controller, const SettingGroup &group, const Messaging::Char *details)
Starts a guarded setting change.
Associates setting mutations with a change controller.
SettingGroup(SettingChangeController *controller=nullptr)
Creates a setting group that uses the specified controller.
void controlChange(const Messaging::Char *description, Change change, Changeable &changeable, const Arg1 &arg1, const Arg2 &arg2) const
Invokes a two-argument member function as a guarded change.
~SettingGroup()=default
Destroys the group without destroying its controller.
void controlChange(const Messaging::Char *description, void(Changeable::*change)(), Changeable &changeable) const
Invokes a zero-argument member function as a guarded change.
void controlAssignment(const Messaging::Char *description, Assignee &assignee, Value value) const
Assigns a value while coordinating the change with the controller.
static const SettingGroup & null() noexcept
Obtains the shared group that accepts every change.
void controlChange(const Messaging::Char *description, Change change, Changeable &changeable, const Arg &arg) const
Invokes a one-argument member function as a guarded change.
char Char
Character type alias.
void toStr(std::string &, Int8)
Serializes given integer into a string.
void toStr(std::string &str, BookState::Enum bookState)
Appends a string representation of a book state.
bool operator!=(const MemoryPoolAllocator< Object > &left, const MemoryPoolAllocator< OtherObject > &right) noexcept
Tests whether two allocators use different pools.
Coordinates changes to settings that belong to a setting group.
virtual void endChange()=0
Completes the current guarded setting change.
virtual void beginChange(const SettingGroup &group, const Messaging::Char *details)=0
Starts a guarded setting change.
Controller implementation that accepts every setting change.
static SettingChangeController & self() noexcept
Obtains the shared controller that accepts every change.
void endChange() noexcept override
Completes the current guarded setting change.
void beginChange(const SettingGroup &group, const Messaging::Char *details) noexcept override
Starts a guarded setting change.