OpenLexocad  27.0
DocumentObserver.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Core/Variant.h>
5 
6 #include <memory>
7 #include <vector>
8 
9 namespace OpenLxApp
10 {
11 class Document;
12 class DocObject;
13 
15 {
16 public:
17  enum
18  {
21  MESSAGE_BY_ID
22  } Why;
23 
24  std::string MsgName;
25  int MsgId;
27  std::vector<std::shared_ptr<OpenLxApp::DocObject>> NewObjects;
28  std::vector<std::shared_ptr<OpenLxApp::DocObject>> ModifiedObjects;
29  std::vector<std::shared_ptr<OpenLxApp::DocObject>> DeletedObjects;
30  std::map<std::shared_ptr<OpenLxApp::DocObject>, std::vector<std::string>>
31  ErroneousObjects; // Objects that caused an error in recompute with its error messages
32 };
33 
42 #ifndef SWIG
43  : public std::enable_shared_from_this<DocumentObserver>
44 #endif
45 
46 {
47 public:
48  friend class Document;
49  friend class DocumentObserverImpl;
50 
52  virtual ~DocumentObserver();
53  virtual void onChange(std::shared_ptr<OpenLxApp::Document> aCaller, std::shared_ptr<OpenLxApp::DocumentChanges> aSubject) = 0;
54 
55 private:
56  DocumentObserverImpl* _pimpl = nullptr;
57 };
58 } // namespace OpenLxApp
Core::Variant Value
Definition: DocumentObserver.h:26
Definition: DocumentObserver.h:14
std::vector< std::shared_ptr< OpenLxApp::DocObject > > DeletedObjects
Definition: DocumentObserver.h:29
std::vector< std::shared_ptr< OpenLxApp::DocObject > > NewObjects
Definition: DocumentObserver.h:27
Definition: Variant.h:90
Document holding all persistent DocObjects.
Definition: Document.h:62
#define OPENLXAPP_EXPORT
Definition: OpenLxApp_defines.h:12
Definition: ActiveScript.h:9
Definition: DocumentObserver.h:19
std::map< std::shared_ptr< OpenLxApp::DocObject >, std::vector< std::string > > ErroneousObjects
Definition: DocumentObserver.h:31
int MsgId
Definition: DocumentObserver.h:25
Definition: DocumentObserver.h:20
std::string MsgName
Definition: DocumentObserver.h:24
Definition: DocumentObserverImpl.h:15
std::vector< std::shared_ptr< OpenLxApp::DocObject > > ModifiedObjects
Definition: DocumentObserver.h:28
DocumentObserver observes the Document. This class has to be overridden to get messages from the obse...
Definition: DocumentObserver.h:41