HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_Command.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS:
7  */
8 
9 #ifndef __PDG_COMMAND_H__
10 #define __PDG_COMMAND_H__
11 
12 #include "PDG_API.h"
13 
14 #include <UT/UT_NonCopyable.h>
15 #include <UT/UT_StringHolder.h>
16 #include <UT/UT_WorkBuffer.h>
17 
18 #include <time.h>
19 
20 class PDG_GraphContext;
21 
23 {
27 };
28 
30 {
31 public:
32  PDG_Command();
33  virtual ~PDG_Command();
35 
36  bool hasDoneIt() const;
37  bool hasFailed() const;
38  bool result() const { return !hasFailed(); }
39 
40  bool doIt(PDG_GraphContext* context);
41  bool undoIt(PDG_GraphContext* context);
42  virtual bool doIt(PDG_GraphContext* context, UT_WorkBuffer& errors);
43  virtual bool undoIt(PDG_GraphContext* context, UT_WorkBuffer& errors);
44  virtual bool canDoIt();
45  virtual bool canUndoIt();
46  virtual PDG_CommandType commandType() = 0;
47  virtual PDG_CommandType baseCommandType();
48  virtual void description(UT_WorkBuffer& buffer, int depth=0);
49  virtual void fullDescription(UT_WorkBuffer& buffer);
50 
51  UT_StringHolder timeAsString() const;
52  time_t creationTime() const { return myTime; }
53 
54 protected:
55  virtual bool doCommand(PDG_GraphContext*, UT_WorkBuffer&) = 0;
56  virtual bool undoCommand(PDG_GraphContext*, UT_WorkBuffer&) = 0;
57 
58 private:
59  bool myHasDoneIt;
60  bool myHasFailed;
61  time_t myTime;
62 };
63 
64 #endif /* __PDG_COMMAND_H__ */
PDG_CommandType
Definition: PDG_Command.h:22
#define PDG_API
Definition: PDG_API.h:23
bool result() const
Definition: PDG_Command.h:38
time_t creationTime() const
Definition: PDG_Command.h:52
Definition: core.h:760
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
GLint GLint GLsizei GLsizei GLsizei depth
Definition: glcorearb.h:476