HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_CloneManager.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  * NAME: OP_CloneManager.h (C++)
7  */
8 
9 #ifndef _OP_CloneManager_h_
10 #define _OP_CloneManager_h_
11 
12 #include "OP_API.h"
13 #include <UT/UT_Function.h>
14 #include <UT/UT_Map.h>
15 #include <UT/UT_StringHolder.h>
16 #include <iosfwd>
17 
18 class UT_Options;
19 
20 #define OP_CLONE_CPIO_PACKET ".clones"
21 
23 
25 typedef UT_Function<void(const UT_StringRef &,
26  const UT_StringRef &,
28 
30 {
31 public:
33  virtual ~OP_CloneManager();
34 
35  static bool hasInstance()
36  { return theCloneManager != nullptr; }
38  { return theCloneManager; }
39  static void setRunningAsClone(bool running_as_clone)
40  { theRunningAsClone = running_as_clone; }
41  static bool isRunningAsClone()
42  { return theRunningAsClone; }
43 
44  virtual void remoteExecute(const UT_StringHolder &function,
45  const UT_Options &parameters) = 0;
46  virtual void saveClones(std::ostream &os) const = 0;
47  virtual void deleteAllClones() = 0;
48 
49  // The returned id will always be >= 0.
50  static int addConnectionChangeCallback(OP_CloneChangeCallback cb);
51  static void removeConnectionChangeCallback(int id);
52 
53  // The returned id will always be >= 0.
54  static int addImageChangeCallback(OP_CloneImageChangeCallback cb);
55  static void removeImageChangeCallback(int id);
56 
57 protected:
58  void runCallbacks(const UT_StringRef &id);
59  void runImageCallbacks(const UT_StringRef &id,
60  const UT_StringRef &galleryid,
61  const UT_StringRef &imagepath);
62 
63 private:
64  static OP_CloneManager *theCloneManager;
66  static UT_SortedMap<int, OP_CloneImageChangeCallback> theImageCallbacks;
67  static int theUniqueCallbackId;
68  static bool theRunningAsClone;
69 };
70 
71 #endif
72 
void
Definition: png.h:1083
UT_Function< void(const UT_StringRef &)> OP_CloneChangeCallback
static OP_CloneManager * getInstance()
static void setRunningAsClone(bool running_as_clone)
UT_Function< void(const UT_StringRef &, const UT_StringRef &, const UT_StringRef &)> OP_CloneImageChangeCallback
static bool hasInstance()
std::function< T > UT_Function
Definition: UT_Function.h:37
A map of string to various well defined value types.
Definition: UT_Options.h:84
OP_API const UT_StringHolder OP_CLONEFUNC_NODE_GETORCREATEOUTPUT
#define OP_API
Definition: OP_API.h:10
static bool isRunningAsClone()