CFx SDK Documentation  2020SP3
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);
112  OdVariant& operator =(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 
FIRSTDLL_EXPORT
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
OdVariant::OdVariant
OdVariant(OdInt16 val)
OdVariant::setBoolPtr
OdVariant & setBoolPtr(bool *val)
OdVariant::asAnsiStringArray
OdAnsiStringArray & asAnsiStringArray()
OdVariant::getStringArrayPtr
OdStringArray * getStringArrayPtr() const
OdPdfPublish::Action::Type
Type
Definition: PdfPublishCommon.h:444
OdString
Definition: OdString.h:95
OdVariant::setBoolArray
OdVariant & setBoolArray(const OdBoolArray &val)
OdVariant::getStringArray
const OdStringArray & getStringArray() const
OdRxObjectPtr
Definition: RxObject.h:345
OdVariant::getDoublePtr
double * getDoublePtr() const
OdVariant::setUInt8Ptr
OdVariant & setUInt8Ptr(OdUInt8 *val)
OdVariant::getUInt32ArrayPtr
OdUInt32Array * getUInt32ArrayPtr() const
OdUInt8
unsigned char OdUInt8
Definition: OdPlatformSettings.h:759
OdVariant::getUInt16
OdUInt16 getUInt16() const
Int32Array.h
OdVariant::getBoolArrayPtr
OdBoolArray * getBoolArrayPtr() const
UInt64Array.h
OdVariant::setUInt64Ptr
OdVariant & setUInt64Ptr(OdUInt64 *val)
OdInt64
Definition: Int64.h:43
OdVariant::asUInt64Array
OdUInt64Array & asUInt64Array()
OdVariant::setRxObjectPtrArrayPtr
OdVariant & setRxObjectPtrArrayPtr(OdRxObjectPtrArray *val)
OdVariant::setInt16ArrayPtr
OdVariant & setInt16ArrayPtr(OdInt16Array *val)
OdVariant::OdVariant
OdVariant(OdUInt16 val)
OdVariant::setAnsiStringArrayPtr
OdVariant & setAnsiStringArrayPtr(OdAnsiStringArray *val)
type
GLuint GLsizei GLsizei GLint GLenum * type
Definition: gles2_ext.h:274
OdVariant::setUInt32Array
OdVariant & setUInt32Array(const OdUInt32Array &val)
OdVariant::typeFactory
static const TypeFactory * typeFactory(int type)
OdVariant::TypeFactory::destroy
virtual void destroy(void *pData) const =0
StringArray.h
OdVariant::getString
const OdString & getString() const
OdVariant::OdVariant
OdVariant(const OdRxObjectPtr &val)
OdVariant::getInt64Ptr
OdInt64 * getInt64Ptr() const
OdError_InvalidVariantType::OdError_InvalidVariantType
OdError_InvalidVariantType()
OdVariant::getInt32ArrayPtr
OdInt32Array * getInt32ArrayPtr() const
OdVariant::TypeFactory
Definition: RxVariant.h:82
OdVariant::data
void * data() const
Definition: RxVariant.h:77
OdVariant::getAnsiStringPtr
OdAnsiString * getAnsiStringPtr() const
OdVariant::OdVariant
OdVariant(OdUInt64 val)
OdVariant::getDoubleArray
const OdDoubleArray & getDoubleArray() const
OdVariant::setIntPtr
OdVariant & setIntPtr(OdIntPtr val)
OdVariant::setUInt8
OdVariant & setUInt8(OdUInt8 val)
OdVariant::setInt64
OdVariant & setInt64(OdInt64 val)
DoubleArray.h
OdVariant::setInt16
OdVariant & setInt16(OdInt16 val)
OdVariant::dbl
double dbl
Definition: RxVariant.h:74
OdArray< OdString >
OdVariant::getBoolPtr
bool * getBoolPtr() const
TD_PackPop.h
OdVariant::setInt16Ptr
OdVariant & setInt16Ptr(OdInt16 *val)
OdVariant::setInt64Ptr
OdVariant & setInt64Ptr(OdInt64 *val)
OdVariant::asRxObjectPtrArray
OdRxObjectPtrArray & asRxObjectPtrArray()
OdVariant::setAnsiStringArray
OdVariant & setAnsiStringArray(const OdAnsiStringArray &val)
OdVariant::OdVariant
OdVariant(const OdAnsiString &val)
OdVariant::asUInt32Array
OdUInt32Array & asUInt32Array()
OdVariant::setAnsiStringPtr
OdVariant & setAnsiStringPtr(OdAnsiString *val)
OdUInt16
unsigned short OdUInt16
Definition: OdPlatformSettings.h:760
OdVariant::getDoubleArrayPtr
OdDoubleArray * getDoubleArrayPtr() const
OdVariant::setUInt32ArrayPtr
OdVariant & setUInt32ArrayPtr(OdUInt32Array *val)
OdVariant::asStringArray
OdStringArray & asStringArray()
RxObject.h
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
OdInt16
short OdInt16
Definition: OdPlatformSettings.h:756
OdVariant::getStringPtr
OdString * getStringPtr() const
OdError_InvalidVariantType
Definition: RxVariant.h:55
data
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
Definition: gles2_ext.h:110
OdVariant::OdVariant
OdVariant(OdUInt32 val)
OdVariant::getInt64
OdInt64 getInt64() const
OdVariant::setUInt16Array
OdVariant & setUInt16Array(const OdUInt16Array &val)
OdVariant::setVarType
virtual void setVarType(int newType, int &type, void *data)
OdVariant::TypeFactory::construct
virtual void construct(void *pData) const =0
OdVariant::isByRef
bool isByRef() const
Definition: RxVariant.h:130
OdVariant::Type
Type
Definition: RxVariant.h:89
OdString.h
OdVariant::getBool
bool getBool() const
nOdVariantDataSize
const int nOdVariantDataSize
Definition: RxVariant.h:60
OdVariant::getUInt64Array
const OdUInt64Array & getUInt64Array() const
OdVariant::OdVariant
OdVariant(double val)
OdVariant::getInt8Array
const OdInt8Array & getInt8Array() const
BoolArray.h
OdVariant::getBoolArray
const OdBoolArray & getBoolArray() const
OdInt32
int OdInt32
Definition: OdPlatformSettings.h:782
OdVariant::setUInt16Ptr
OdVariant & setUInt16Ptr(OdUInt16 *val)
OdVariant::getUInt32Ptr
OdUInt32 * getUInt32Ptr() const
OdVariant::setInt32ArrayPtr
OdVariant & setInt32ArrayPtr(OdInt32Array *val)
OdVariant::getInt16ArrayPtr
OdInt16Array * getInt16ArrayPtr() const
OdAnsiString.h
OdVariant::getInt16Ptr
OdInt16 * getInt16Ptr() const
OdVariant::asUInt8Array
OdUInt8Array & asUInt8Array()
OdVariant::setInt32
OdVariant & setInt32(OdInt32 val)
OdVariant::setAnsiString
OdVariant & setAnsiString(const OdAnsiString &val)
OdVariant::setRxObjectPtrPtr
OdVariant & setRxObjectPtrPtr(OdRxObjectPtr *val)
OdVariant::setStringArrayPtr
OdVariant & setStringArrayPtr(OdStringArray *val)
OdVariant::getInt16
OdInt16 getInt16() const
OdVariant::getUInt32Array
const OdUInt32Array & getUInt32Array() const
OdVariant::getInt32Array
const OdInt32Array & getInt32Array() const
OdVariant::setDoubleArrayPtr
OdVariant & setDoubleArrayPtr(OdDoubleArray *val)
OdVariant::asUInt16Array
OdUInt16Array & asUInt16Array()
OdVariant::setStringArray
OdVariant & setStringArray(const OdStringArray &val)
OdVariant::setInt64Array
OdVariant & setInt64Array(const OdInt64Array &val)
OdVariant::m_type
int m_type
Definition: RxVariant.h:70
Int8Array.h
OdVariant::setStringPtr
OdVariant & setStringPtr(OdString *val)
OdPlatformSettings.h
OdVariant::getRxObjectPtrArray
const OdRxObjectPtrArray & getRxObjectPtrArray() const
OdVariant::getUInt64Ptr
OdUInt64 * getUInt64Ptr() const
OdVariant::getUInt8Ptr
OdUInt8 * getUInt8Ptr() const
OdVariant::getUInt64ArrayPtr
OdUInt64Array * getUInt64ArrayPtr() const
OdVariant::setRxObjectPtr
OdVariant & setRxObjectPtr(const OdRxObjectPtr &val)
OdVariant::~OdVariant
virtual ~OdVariant()
OdVariant::setBool
OdVariant & setBool(bool val)
OdVariant::setUInt64
OdVariant & setUInt64(OdUInt64 val)
OdVariant
Definition: RxVariant.h:68
TD_PackPush.h
UInt16Array.h
OdVariant::setDoubleArray
OdVariant & setDoubleArray(const OdDoubleArray &val)
OdVariant::setUInt16
OdVariant & setUInt16(OdUInt16 val)
OdVariant::isArray
bool isArray() const
Definition: RxVariant.h:126
OdVariant::getInt8ArrayPtr
OdInt8Array * getInt8ArrayPtr() const
OdInt8
signed char OdInt8
Definition: OdPlatformSettings.h:755
OdVariant::setInt32Ptr
OdVariant & setInt32Ptr(OdInt32 *val)
OdVariant::getAnsiStringArray
const OdAnsiStringArray & getAnsiStringArray() const
OdVariant::ptr
void * ptr
Definition: RxVariant.h:75
OdVariant::setInt16Array
OdVariant & setInt16Array(const OdInt16Array &val)
OdVariant::OdVariant
OdVariant(OdInt8 val)
OdVariant::setUInt8ArrayPtr
OdVariant & setUInt8ArrayPtr(OdUInt8Array *val)
OdVariant::setUInt8Array
OdVariant & setUInt8Array(const OdUInt8Array &val)
OdVariant::setInt8Array
OdVariant & setInt8Array(const OdInt8Array &val)
OdVariant::setRxObjectPtrArray
OdVariant & setRxObjectPtrArray(const OdRxObjectPtrArray &val)
OdVariant::OdVariant
OdVariant(OdUInt8 val)
OdVariant::setString
OdVariant & setString(const OdString &val)
OdVariant::getInt32Ptr
OdInt32 * getInt32Ptr() const
OdVariant::OdVariant
OdVariant(const OdVariant &val)
OdVariant::OdVariant
OdVariant(const OdString &val)
OdVariant::getInt64Array
const OdInt64Array & getInt64Array() const
OdVariant::getInt64ArrayPtr
OdInt64Array * getInt64ArrayPtr() const
OdVariant::getUInt16Ptr
OdUInt16 * getUInt16Ptr() const
OdVariant::OdVariant
OdVariant(OdInt64 val)
OdVariant::getUInt8Array
const OdUInt8Array & getUInt8Array() const
OdIntPtr
ptrdiff_t OdIntPtr
Definition: OdPlatformSettings.h:884
OdVariant::setBoolArrayPtr
OdVariant & setBoolArrayPtr(OdBoolArray *val)
OdVariant::type
Type type() const
Definition: RxVariant.h:122
OdVariant::OdVariant
OdVariant(bool val)
OdVariant::setInt64ArrayPtr
OdVariant & setInt64ArrayPtr(OdInt64Array *val)
OdVariant::setDouble
OdVariant & setDouble(double val)
UInt8Array.h
OdVariant::asBoolArray
OdBoolArray & asBoolArray()
OdVariant::setUInt64Array
OdVariant & setUInt64Array(const OdUInt64Array &val)
OdVariant::getUInt8
OdUInt8 getUInt8() const
OdError
Definition: OdError.h:43
Int16Array.h
OdVariant::setInt8Ptr
OdVariant & setInt8Ptr(OdInt8 *val)
OdVariant::getIntPtr
OdIntPtr getIntPtr() const
OdVariant::asInt8Array
OdInt8Array & asInt8Array()
OdVariant::getInt8Ptr
OdInt8 * getInt8Ptr() const
kVoid
@ kVoid
Definition: BrepBuilder.h:41
OdVariant::setInt32Array
OdVariant & setInt32Array(const OdInt32Array &val)
OdVariant::setInt8ArrayPtr
OdVariant & setInt8ArrayPtr(OdInt8Array *val)
OdVariant::getUInt64
OdUInt64 getUInt64() const
Int64Array.h
OdVariant::getInt32
OdInt32 getInt32() const
OdVariant::setUInt64ArrayPtr
OdVariant & setUInt64ArrayPtr(OdUInt64Array *val)
OdVariant::OdVariant
OdVariant(OdInt32 val)
OdVariant::asInt32Array
OdInt32Array & asInt32Array()
OdVariant::setInt8
OdVariant & setInt8(OdInt8 val)
OdVariant::varType
int varType() const
Definition: RxVariant.h:118
OdVariant::setUInt16ArrayPtr
OdVariant & setUInt16ArrayPtr(OdUInt16Array *val)
OdVariant::asInt64Array
OdInt64Array & asInt64Array()
OdVariant::getDouble
double getDouble() const
OdVariant::setUInt32Ptr
OdVariant & setUInt32Ptr(OdUInt32 *val)
OdVariant::getUInt32
OdUInt32 getUInt32() const
OdVariant::getRxObjectPtrPtr
OdRxObjectPtr * getRxObjectPtrPtr() const
OdVariant::getUInt16ArrayPtr
OdUInt16Array * getUInt16ArrayPtr() const
OdVariant::getRxObjectPtrArrayPtr
OdRxObjectPtrArray * getRxObjectPtrArrayPtr() const
OdVariant::getRxObjectPtr
const OdRxObjectPtr & getRxObjectPtr() const
OdVariant::setDoublePtr
OdVariant & setDoublePtr(double *val)
UInt32Array.h
OdVariant::getInt8
OdInt8 getInt8() const
OdVariant::getInt16Array
const OdInt16Array & getInt16Array() const
OdVariant::getAnsiStringArrayPtr
OdAnsiStringArray * getAnsiStringArrayPtr() const
OdVariant::getUInt16Array
const OdUInt16Array & getUInt16Array() const
OdVariant::asInt16Array
OdInt16Array & asInt16Array()
OdVariant::getAnsiString
const OdAnsiString & getAnsiString() const
OdVariant::getUInt8ArrayPtr
OdUInt8Array * getUInt8ArrayPtr() const
OdVariant::asDoubleArray
OdDoubleArray & asDoubleArray()
OdUInt64
Definition: Int64.h:137
OdVariant::OdVariant
OdVariant()
OdVariant::setUInt32
OdVariant & setUInt32(OdUInt32 val)