CFx SDK Documentation  2023 SP0
RxVariant.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 
25 
26 
27 #if !defined(_ODVARIANT_H_INCLUDED_)
28 #define _ODVARIANT_H_INCLUDED_
29 
30 #include "TD_PackPush.h"
31 #include "OdPlatformSettings.h"
32 #include "RxObject.h"
33 
34 #include "StringArray.h"
35 #include "BoolArray.h"
36 #include "Int8Array.h"
37 #include "Int16Array.h"
38 #include "Int32Array.h"
39 #include "Int64Array.h"
40 #include "UInt8Array.h"
41 #include "UInt16Array.h"
42 #include "UInt32Array.h"
43 #include "UInt64Array.h"
44 #include "DoubleArray.h"
45 #include "OdString.h"
46 #include "OdAnsiString.h"
47 
55 {
56 public:
58 };
59 
60 const int nOdVariantDataSize = 8;
61 
68 {
69 protected:
70  int m_type;
71  union // Union is required to have proper data alignment which is important
72  { // for some platforms
74  double dbl;
75  void* ptr;
76  } m_uData;
77  void* data() const {return (void*)m_uData.uint8;}
78 
79  virtual void setVarType(int newType, int& type, void* data);
80 public:
81  struct TypeFactory
82  {
83  virtual void construct(void* pData) const = 0;
84  virtual void destroy(void* pData) const = 0;
85  };
86  static const TypeFactory* typeFactory(int type);
87 public:
88  typedef enum
89  {
90  kVoid = 0x0000,
91  kString = 0x0001,
92  kBool = 0x0002,
93  kInt8 = 0x0003,
94  kUInt8 = 0x0003,
95  kInt16 = 0x0004,
96  kUInt16 = 0x0004,
97  kInt32 = 0x0005,
98  kUInt32 = 0x0005,
99  kInt64 = 0x0006,
100  kUInt64 = 0x0006,
101  kDouble = 0x0007,
102  kWString = 0x0008,
103  kAnsiString = 0x0008,
104  kRxObjectPtr = 0x0009,
105  kNextType = 0x000A,
106  kByRef = 0x0040,
107  kArray = 0x0080
108  } Type;
109 
111  OdVariant(const OdVariant& val);
113  virtual ~OdVariant();
114 
118  int varType() const { return m_type; }
122  Type type() const { return Type(m_type & (0x3F)); }
126  bool isArray() const { return (m_type & kArray)!=0; }
130  bool isByRef() const { return (m_type & kByRef)!=0; }
131 
132  OdVariant(const OdString& val);
133  OdVariant(const OdAnsiString& val);
135  OdVariant(bool val);
144  OdVariant(double val);
145 #ifdef OD_INTPTR_UNIQUE
146  OdVariant(OdIntPtr val);
147 #endif
148 
154  const OdString& getString() const;
155 
161  const OdAnsiString& getAnsiString() const;
162 
169 
175  bool getBool() const;
176 
182  OdInt8 getInt8() const;
183 
189  OdUInt8 getUInt8() const;
190 
196  OdInt16 getInt16() const;
197 
204 
210  OdInt32 getInt32() const;
211 
218 
224  OdInt64 getInt64() const;
225 
232 
239 
245  double getDouble() const;
246 
247 
254 
260  OdAnsiString* getAnsiStringPtr() const;
261 
268 
274  bool* getBoolPtr() const;
275 
281  OdInt8* getInt8Ptr() const;
282 
289 
296 
303 
310 
317 
324 
331 
337  double* getDoublePtr() const;
338 
339 
346 
352  const OdAnsiStringArray& getAnsiStringArray() const;
353 
360 
366  const OdBoolArray& getBoolArray () const;
367 
373  const OdInt8Array& getInt8Array () const;
374 
380  const OdUInt8Array& getUInt8Array () const;
381 
387  const OdInt16Array& getInt16Array () const;
388 
395 
401  const OdInt32Array& getInt32Array () const;
402 
409 
415  const OdInt64Array& getInt64Array () const;
416 
423 
430 
435 
442  OdAnsiStringArray& asAnsiStringArray();
443 
451 
459 
467 
475 
483 
491 
499 
507 
515 
523 
531 
538 
544  OdAnsiStringArray* getAnsiStringArrayPtr() const;
545 
552 
559 
566 
573 
580 
587 
594 
601 
608 
615 
622 
629 
638  OdVariant& setAnsiString(const OdAnsiString& val);
639 
649 
658  OdVariant& setBool (bool val);
659 
669 
679 
689 
699 
709 
719 
729 
739 
749 
758  OdVariant& setDouble(double val);
759 
769 
778  OdVariant& setAnsiStringPtr(OdAnsiString* val);
779 
789 
798  OdVariant& setBoolPtr (bool* val);
799 
809 
819 
829 
839 
849 
859 
869 
879 
888  OdVariant& setDoublePtr(double* val);
889 
899 
908  OdVariant& setAnsiStringArray(const OdAnsiStringArray& val);
909 
919 
929 
939 
949 
959 
969 
979 
989 
999 
1009 
1019 
1020 
1030 
1039  OdVariant& setAnsiStringArrayPtr(OdAnsiStringArray* val);
1040 
1050 
1060 
1070 
1080 
1090 
1100 
1110 
1120 
1130 
1140 
1150 };
1151 
1152 
1153 
1154 #include "TD_PackPop.h"
1155 
1156 #endif //_ODVARIANT_H_INCLUDED_
1157 
@ kVoid
Definition: BrepBuilder.h:41
unsigned int OdUInt32
short OdInt16
signed char OdInt8
unsigned short OdUInt16
int OdInt32
unsigned char OdUInt8
ptrdiff_t OdIntPtr
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
const int nOdVariantDataSize
Definition: RxVariant.h:60
OdError & operator=(const OdError &source)
Definition: Int64.h:43
OdInt8 * getInt8Ptr() const
OdString * getStringPtr() const
const OdStringArray & getStringArray() const
static const TypeFactory * typeFactory(int type)
OdVariant & setStringArray(const OdStringArray &val)
OdInt32 * getInt32Ptr() const
OdVariant & setInt32Array(const OdInt32Array &val)
virtual void setVarType(int newType, int &type, void *data)
OdUInt16 * getUInt16Ptr() const
bool isByRef() const
Definition: RxVariant.h:130
OdVariant(const OdAnsiString &val)
double getDouble() const
OdVariant & setIntPtr(OdIntPtr val)
OdVariant(OdUInt32 val)
OdRxObjectPtrArray * getRxObjectPtrArrayPtr() const
const OdAnsiString & getAnsiString() const
double dbl
Definition: RxVariant.h:74
bool getBool() const
void * data() const
Definition: RxVariant.h:77
OdVariant & setBoolArray(const OdBoolArray &val)
OdVariant(OdUInt64 val)
bool isArray() const
Definition: RxVariant.h:126
OdUInt64Array * getUInt64ArrayPtr() const
OdVariant & setUInt32(OdUInt32 val)
OdInt8Array * getInt8ArrayPtr() const
OdUInt16Array * getUInt16ArrayPtr() const
const OdBoolArray & getBoolArray() const
OdUInt32 getUInt32() const
OdVariant(OdUInt16 val)
OdUInt16 getUInt16() const
OdUInt8 * getUInt8Ptr() const
const OdRxObjectPtrArray & getRxObjectPtrArray() const
OdVariant(OdInt8 val)
OdVariant & setUInt32Array(const OdUInt32Array &val)
OdInt64 * getInt64Ptr() const
OdVariant(OdInt32 val)
OdInt64 getInt64() const
OdAnsiStringArray & asAnsiStringArray()
const OdUInt32Array & getUInt32Array() const
OdVariant & setAnsiStringArray(const OdAnsiStringArray &val)
OdUInt8 getUInt8() const
OdAnsiStringArray * getAnsiStringArrayPtr() const
OdVariant & setUInt8ArrayPtr(OdUInt8Array *val)
OdStringArray * getStringArrayPtr() const
OdUInt64 getUInt64() const
OdInt16 * getInt16Ptr() const
OdVariant & setUInt32Ptr(OdUInt32 *val)
OdVariant(bool val)
const OdInt32Array & getInt32Array() const
OdInt8Array & asInt8Array()
OdVariant(OdInt16 val)
OdUInt8Array * getUInt8ArrayPtr() const
OdVariant & setUInt8(OdUInt8 val)
const OdInt16Array & getInt16Array() const
OdVariant(OdUInt8 val)
OdVariant & setUInt64Array(const OdUInt64Array &val)
const OdDoubleArray & getDoubleArray() const
OdVariant & setUInt64ArrayPtr(OdUInt64Array *val)
OdVariant & setDouble(double val)
OdVariant(const OdString &val)
OdVariant & setInt64Ptr(OdInt64 *val)
OdInt64Array & asInt64Array()
virtual ~OdVariant()
OdVariant & setInt16ArrayPtr(OdInt16Array *val)
OdVariant(const OdVariant &val)
OdVariant & setInt8(OdInt8 val)
OdVariant & setAnsiString(const OdAnsiString &val)
OdVariant & setUInt16ArrayPtr(OdUInt16Array *val)
OdVariant & setUInt64Ptr(OdUInt64 *val)
OdVariant & setAnsiStringArrayPtr(OdAnsiStringArray *val)
OdVariant & setInt16(OdInt16 val)
OdVariant & setRxObjectPtrArrayPtr(OdRxObjectPtrArray *val)
OdVariant & setString(const OdString &val)
bool * getBoolPtr() const
OdUInt8Array & asUInt8Array()
int m_type
Definition: RxVariant.h:70
const OdUInt64Array & getUInt64Array() const
OdAnsiString * getAnsiStringPtr() const
OdVariant & setStringArrayPtr(OdStringArray *val)
OdStringArray & asStringArray()
OdInt32Array & asInt32Array()
OdBoolArray * getBoolArrayPtr() const
OdUInt32Array * getUInt32ArrayPtr() const
OdVariant(double val)
double * getDoublePtr() const
OdVariant & setDoubleArray(const OdDoubleArray &val)
OdVariant & setInt64(OdInt64 val)
OdVariant & setUInt16(OdUInt16 val)
void * ptr
Definition: RxVariant.h:75
OdUInt64Array & asUInt64Array()
OdVariant & setAnsiStringPtr(OdAnsiString *val)
OdVariant & setInt8Ptr(OdInt8 *val)
OdVariant & setBoolArrayPtr(OdBoolArray *val)
OdVariant & setInt8ArrayPtr(OdInt8Array *val)
OdVariant & setDoublePtr(double *val)
OdIntPtr getIntPtr() const
const OdRxObjectPtr & getRxObjectPtr() const
OdVariant & setUInt16Ptr(OdUInt16 *val)
OdVariant(OdInt64 val)
OdRxObjectPtrArray & asRxObjectPtrArray()
OdVariant & setStringPtr(OdString *val)
OdInt16Array & asInt16Array()
const OdUInt8Array & getUInt8Array() const
OdInt32Array * getInt32ArrayPtr() const
OdVariant & setRxObjectPtrArray(const OdRxObjectPtrArray &val)
OdVariant & setInt8Array(const OdInt8Array &val)
OdVariant & setInt32Ptr(OdInt32 *val)
const OdString & getString() const
const OdInt8Array & getInt8Array() const
OdUInt32 * getUInt32Ptr() const
Type type() const
Definition: RxVariant.h:122
OdVariant(const OdRxObjectPtr &val)
OdVariant & setUInt8Array(const OdUInt8Array &val)
OdVariant & setInt64Array(const OdInt64Array &val)
const OdInt64Array & getInt64Array() const
OdInt16 getInt16() const
OdVariant & setUInt8Ptr(OdUInt8 *val)
const OdUInt16Array & getUInt16Array() const
OdVariant & setUInt16Array(const OdUInt16Array &val)
OdVariant & setInt32(OdInt32 val)
OdVariant & setInt32ArrayPtr(OdInt32Array *val)
OdVariant & setBoolPtr(bool *val)
OdBoolArray & asBoolArray()
OdRxObjectPtr * getRxObjectPtrPtr() const
int varType() const
Definition: RxVariant.h:118
OdDoubleArray * getDoubleArrayPtr() const
OdVariant & setRxObjectPtrPtr(OdRxObjectPtr *val)
OdVariant & setUInt32ArrayPtr(OdUInt32Array *val)
OdInt64Array * getInt64ArrayPtr() const
OdInt8 getInt8() const
const OdAnsiStringArray & getAnsiStringArray() const
OdVariant & setBool(bool val)
OdVariant & setRxObjectPtr(const OdRxObjectPtr &val)
OdVariant & setInt16Ptr(OdInt16 *val)
OdVariant & setInt64ArrayPtr(OdInt64Array *val)
OdInt32 getInt32() const
OdUInt32Array & asUInt32Array()
OdVariant & setInt16Array(const OdInt16Array &val)
OdVariant & setDoubleArrayPtr(OdDoubleArray *val)
OdUInt16Array & asUInt16Array()
OdUInt64 * getUInt64Ptr() const
OdInt16Array * getInt16ArrayPtr() const
OdDoubleArray & asDoubleArray()
OdVariant & setUInt64(OdUInt64 val)
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
Definition: gles2_ext.h:110
GLuint GLsizei GLsizei GLint GLenum * type
Definition: gles2_ext.h:274
virtual void destroy(void *pData) const =0
virtual void construct(void *pData) const =0