HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OP_MultiparmInfo.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_MultiparmInfo.h ( OP Library, C++)
7  *
8  * COMMENTS:
9  * This class holds information usedto initialize multiparm instances
10  * in OP_Parameters::initMultiparmInstance.
11  */
12 
13 #ifndef __OP_MultiparmInfo_h__
14 #define __OP_MultiparmInfo_h__
15 
16 #include "OP_API.h"
17 #include "OP_Parameters.h"
18 #include <UT/UT_StringArray.h>
19 #include <iosfwd>
20 
22 {
23 public:
26 
27  // Returns the number of multiparm links stored here.
28  int entries() const;
29  // Returns the specified referenced parm.
30  const UT_StringHolder &getReferencedChannel(int index) const;
31  // Returns the specified instance parm.
32  const UT_StringHolder &getInstanceChannel(int index) const;
33 
34  // Associates an instance channel with a referenced channel. If the
35  // instance channel is already referenced, the new value replaces the
36  // old. A null or empty reference clears that reference. A detailed
37  // error message is returned in the error parameter.
38  bool setReference(const char *instancechannel,
39  const char *referencedchannel,
40  UT_String &error);
41 
42  // Performs pattern matching to find the instance channel that best
43  // matches the passed in channel name. The referenced channel is returned
44  // with appropriate replacements already done.
45  bool getReferencedChannel(const char *instancechannel,
46  UT_String &referencedchannel) const;
47 
48  // Saves the opmultiparm commands required to set up the current
49  // set of references. The "opmultiparm" and node name parts of the
50  // command are not saved, and must be output before calling this
51  // funtion.
52  void saveCommands(std::ostream &os) const;
53 
54  // Saves the multiparm info as into a hip file.
55  void save(std::ostream &os, bool binary) const;
56 
57  // Loads multiparm info as from a hip file.
58  bool load(UT_IStream &is);
59 
60  // Save undo block
61  void saveForUndo();
62 
63  // Tries to match a specific channel name (instancechannel) with a
64  // generic channel name containing "#"s (genericinstancechannel).
65  // The numeric replacements required to match the channel names
66  // are stored in the hashreplacements array.
67  static bool matchChannels(const char *instancechannel,
68  const char *genericinstancechannel,
69  UT_IntArray &hashreplacements);
70 
71  int64 getMemoryUsage(bool inclusive) const
72  {
73  int64 mem = inclusive ? sizeof(*this) : 0;
74  mem += myInstanceChannels.getMemoryUsage(false);
75  mem += myReferencedChannels.getMemoryUsage(false);
76  return mem;
77  }
78 
79  class Undo;
80  friend class Undo;
81 
82 private:
83  OP_Parameters &myOwner;
84  UT_StringArray myInstanceChannels;
85  UT_StringArray myReferencedChannels;
86 };
87 
88 #endif
89 
const GLuint GLenum const void * binary
Definition: glcorearb.h:1923
long long int64
Definition: SYS_Types.h:106
int64 getMemoryUsage(bool inclusive) const
png_infop png_sPLT_tpp entries
Definition: png.h:2481
#define OP_API
Definition: OP_API.h:10
GLuint index
Definition: glcorearb.h:785