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 "PDG_Types.h"
15 
16 #include <UT/UT_NonCopyable.h>
17 #include <UT/UT_StringHolder.h>
18 #include <UT/UT_WorkBuffer.h>
19 
20 #include <time.h>
21 
22 class PDG_GraphContext;
23 
25 {
26 public:
27  PDG_Command();
28  virtual ~PDG_Command();
30 
31  bool hasDoneIt() const;
32  bool hasFailed() const;
33  bool result() const { return !hasFailed(); }
34 
35  bool doIt(PDG_GraphContext* context);
36  bool undoIt(PDG_GraphContext* context);
37  virtual bool doIt(PDG_GraphContext* context, UT_WorkBuffer& errors);
38  virtual bool undoIt(PDG_GraphContext* context, UT_WorkBuffer& errors);
39  virtual bool canDoIt();
40  virtual bool canUndoIt();
41  virtual PDG_CommandType commandType() = 0;
42  virtual PDG_CommandType baseCommandType();
43  virtual void description(UT_WorkBuffer& buffer, int depth=0);
44  virtual void fullDescription(UT_WorkBuffer& buffer);
45 
46  UT_StringHolder timeAsString() const;
47  time_t creationTime() const { return myTime; }
48 
49 protected:
50  virtual bool doCommand(PDG_GraphContext*, UT_WorkBuffer&) = 0;
51  virtual bool undoCommand(PDG_GraphContext*, UT_WorkBuffer&) = 0;
52 
53 private:
54  bool myHasDoneIt;
55  bool myHasFailed;
56  time_t myTime;
57 };
58 
59 #endif /* __PDG_COMMAND_H__ */
PDG_CommandType
Definition: PDG_Types.h:542
#define PDG_API
Definition: PDG_API.h:23
bool result() const
Definition: PDG_Command.h:33
time_t creationTime() const
Definition: PDG_Command.h:47
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