ICF 3.1.1.10
Technical documentation of ICF Libraries
CChangeGroup.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#pragma once
7
8
9// ICF includes
10#include <istd/IChangeable.h>
11
12
13namespace istd
14{
15
16
24class [[maybe_unused]] CChangeGroup
25{
26public:
33 explicit CChangeGroup(IChangeable* changeablePtr, const IChangeable::ChangeSet* changeSetPtr = &IChangeable::GetNoChanges());
35
40 bool IsValid() const;
41
45 void Reset();
46
47private:
48 // blocked copy constructor
49 CChangeGroup(const CChangeGroup& group);
50
51 IChangeable* m_changeablePtr;
52 const IChangeable::ChangeSet& m_changeSet;
53};
54
55
56inline CChangeGroup::CChangeGroup(IChangeable* changeablePtr, const IChangeable::ChangeSet* changeSetPtr)
57: m_changeablePtr(changeablePtr),
58 m_changeSet(*changeSetPtr)
59{
60 Q_ASSERT(changeSetPtr != nullptr);
61
62 if (m_changeablePtr != nullptr){
63 m_changeablePtr->BeginChangeGroup(m_changeSet);
64 }
65}
66
67
69{
70 if (m_changeablePtr != nullptr){
71 m_changeablePtr->EndChangeGroup(m_changeSet);
72 }
73}
74
75
76} // namespace istd
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:38
Common interface for data model objects, which can be changed.
Definition IChangeable.h:32
virtual void EndChangeGroup(const ChangeSet &changeSet)
Ends group of changes.
virtual void BeginChangeGroup(const ChangeSet &changeSet)
Starts group of changes.
Standard library.
Definition IComponent.h:17

© Witold Gantzke and Kirill Lepskiy