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

© 2007-2017 Witold Gantzke and Kirill Lepskiy