HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_DotList.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_DotList.h (OP Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __OP_DotList__
12 #define __OP_DotList__
13 
14 #include "OP_API.h"
15 #include "OP_Error.h"
16 #include "OP_SaveFlags.h"
17 #include <UT/UT_Array.h>
18 #include <iosfwd>
19 
20 class UT_IStream;
21 class OP_Network;
22 class OP_Input;
23 class OP_Dot;
24 
26 {
28 
29 public:
30  OP_DotList(OP_Network &net);
31  ~OP_DotList();
32 
33  exint entries() const
34  { return myDots.entries(); }
35  OP_Dot *operator()(exint idx) const
36  { return (idx >= 0 && idx < entries())
37  ? myDots(idx)
38  : nullptr; }
39  exint find(OP_Dot *dot) const
40  { return myDots.find(dot); }
41 
44 
45  iterator begin() { return myDots.begin(); }
46  iterator end() { return myDots.end(); }
47  const_iterator begin() const { return myDots.begin(); }
48  const_iterator end() const { return myDots.end(); }
49 
50  OP_Dot *findDot(const char *name) const;
51  OP_Dot *createDot(bool save_undo = true);
52  bool deleteDot(OP_Dot &dot_to_delete,
53  bool save_undo = true);
54  void clearAndDestroy();
55 
56  /// Save a single dot into a CPIO packet.
57  OP_ERROR save(std::ostream &os,
58  OP_Dot &dot,
59  const OP_SaveFlags &flags,
60  const char *path_prefix) const;
61 
62  /// Load a network box from 'is'. Can load from both .hip files and the
63  /// clipboard. 'path' is used as the new netbox's name (only the portion of
64  /// path after the last slash). If 'overwrite' is specified, the new netbox
65  /// will overwrite any other netboxes in this network with the same name,
66  /// rather than modify its name to be unique. 'created' is used to return a
67  /// ptr to the new network box.
68  bool load(UT_IStream &is, const char *path,
69  bool path_contains_network,
70  bool path_contains_packet_ext,
71  int overwrite = 0, OP_Dot **created = NULL);
72 
73  /// Return the amount of memory owned by this OP_DotList
74  int64 getMemoryUsage(bool inclusive) const;
75 
76 private:
77  bool deleteDot(int idx, bool save_undo = true);
78 
79  DotArray myDots;
80  OP_Network &myNetwork;
81 };
82 
83 #endif
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
exint find(OP_Dot *dot) const
Definition: OP_DotList.h:39
UT_ErrorSeverity
Definition: UT_Error.h:25
GLbitfield flags
Definition: glcorearb.h:1595
DotArray::const_iterator const_iterator
Definition: OP_DotList.h:43
long long int64
Definition: SYS_Types.h:107
DotArray::iterator iterator
Definition: OP_DotList.h:42
int64 exint
Definition: SYS_Types.h:116
fpreal64 dot(const CE_VectorT< T > &a, const CE_VectorT< T > &b)
Definition: CE_Vector.h:218
const_iterator begin() const
Definition: OP_DotList.h:47
base_iterator< OP_Dot *, true > iterator
Definition: UT_Array.h:771
GLuint const GLchar * name
Definition: glcorearb.h:785
Definition: OP_Dot.h:24
const_iterator end() const
Definition: OP_DotList.h:48
png_infop png_sPLT_tpp entries
Definition: png.h:2481
OP_Dot * operator()(exint idx) const
Definition: OP_DotList.h:35
#define OP_API
Definition: OP_API.h:10
base_iterator< const OP_Dot *, true > const_iterator
Definition: UT_Array.h:772
exint entries() const
Definition: OP_DotList.h:33
iterator end()
Definition: OP_DotList.h:46
iterator begin()
Definition: OP_DotList.h:45