ACF $AcfVersion:0$
CChangeGroup.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// ACF includes
6#include <istd/IChangeable.h>
7
8
9namespace istd
10{
11
12
22{
23public:
30 explicit CChangeGroup(IChangeable* changeablePtr, const IChangeable::ChangeSet* changeSetPtr = &IChangeable::GetNoChanges());
32
37 bool IsValid() const;
38
42 void Reset();
43
44private:
45 // blocked copy constructor
46 CChangeGroup(const CChangeGroup& group);
47
48 IChangeable* m_changeablePtr = nullptr;
49
50 const IChangeable::ChangeSet m_changeSet;
51};
52
53
54inline CChangeGroup::CChangeGroup(IChangeable* changeablePtr, const IChangeable::ChangeSet* changeSetPtr)
55: m_changeablePtr(changeablePtr),
56 m_changeSet(*changeSetPtr)
57{
58 Q_ASSERT(changeSetPtr != NULL);
59
60 if (m_changeablePtr != NULL){
61 m_changeablePtr->BeginChangeGroup(m_changeSet);
62 }
63}
64
65
67{
68 if (m_changeablePtr != NULL){
69 m_changeablePtr->EndChangeGroup(m_changeSet);
70 }
71}
72
73
74} // namespace istd
75
76
77
78
Help class which provides the group of changes for update mechanism of the model.
bool IsValid() const
Check if this pointer is valid.
void Reset()
Call update on attached object and detach it.
CChangeGroup(IChangeable *changeablePtr, const IChangeable::ChangeSet *changeSetPtr=&IChangeable::GetNoChanges())
Constructs the group.
Set of change flags (its IDs).
Definition IChangeable.h:36
Common interface for data model objects, which can be changed.
Definition IChangeable.h:28
static const ChangeSet & GetNoChanges()
Get empty set of changes.
virtual void EndChangeGroup(const ChangeSet &changeSet)
Ends group of changes.
virtual void BeginChangeGroup(const ChangeSet &changeSet)
Starts group of changes.
#define NULL
Definition istd.h:74
Standard library.
Definition IComponent.h:17