CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
RxVariantValue.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, 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 Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2024 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#ifndef _VARIANTVALUE_H_INCLUDED_
25#define _VARIANTVALUE_H_INCLUDED_
26
27#include "TD_PackPush.h"
28
29#include "RxObject.h"
30#include "RxVariant.h"
31#include "RxObjectImpl.h"
32
33class OdRxVariant;
35
44class FIRSTDLL_EXPORT OdRxVariant : public OdRxObject, public OdVariant
45{
46 public:
48};
49
56class OdRxVariantValue : public OdSmartPtr<OdRxVariant>
57{
58public:
63 void assign(const OdRxVariant* pVariant) { OdSmartPtr<OdRxVariant>::operator=(pVariant); }
64
71 OdRxVariantValue(const OdRxObject* pObject) : OdSmartPtr<OdRxVariant>(pObject) {}
72
73 OdRxVariantValue(const OdRxVariant* pVariant) : OdSmartPtr<OdRxVariant>(pVariant) {}
74
75#define ODRXVARVAL_CONSTR(type, setter) \
76 OdRxVariantValue(type value) \
77 { \
78 assign(OdRxObjectImpl<OdRxVariant>::createObject()); \
79 get()->setter(value); \
80 }
81 ODRXVARVAL_CONSTR(bool , setBool)
82 ODRXVARVAL_CONSTR(OdUInt8 , setUInt8)
83 ODRXVARVAL_CONSTR(OdInt8 , setInt8)
84 ODRXVARVAL_CONSTR(OdUInt16 , setUInt16)
85 ODRXVARVAL_CONSTR(OdInt16 , setInt16)
86 ODRXVARVAL_CONSTR(OdUInt32 , setUInt32)
87 ODRXVARVAL_CONSTR(OdInt32 , setInt32)
88 ODRXVARVAL_CONSTR(OdUInt64 , setUInt64)
89 ODRXVARVAL_CONSTR(OdInt64 , setInt64)
90#ifdef OD_INTPTR_UNIQUE
91 ODRXVARVAL_CONSTR(OdIntPtr , setIntPtr)
92#endif
93 ODRXVARVAL_CONSTR(double , setDouble)
94 ODRXVARVAL_CONSTR(const OdString&, setString)
95 ODRXVARVAL_CONSTR(const OdAnsiString&, setAnsiString)
96 ODRXVARVAL_CONSTR(const OdStringArray&, setStringArray)
97 ODRXVARVAL_CONSTR(const OdRxObjectPtrArray&, setRxObjectPtrArray)
98 ODRXVARVAL_CONSTR(const OdDoubleArray&, setDoubleArray)
99 ODRXVARVAL_CONSTR(const OdUInt64Array&, setUInt64Array)
100#undef ODRXVARVAL_CONSTR
101
106#define ODRXVARVAL_IMPLICIT(type, getter) \
107 operator type() const \
108 { \
109 return get()->getter(); \
110 } \
111 operator type() \
112 { \
113 return get()->getter(); \
114 }
115 // #7196 : override OdSmartPtr<T>::operator bool() private member.
116 // #7196 : some compilers (MSVC) require non-const for all types if bool() member available.
117 ODRXVARVAL_IMPLICIT(bool , getBool)
118 ODRXVARVAL_IMPLICIT(OdUInt8 , getUInt8)
119 ODRXVARVAL_IMPLICIT(OdUInt16, getUInt16)
120 ODRXVARVAL_IMPLICIT(OdUInt32, getUInt32)
121 ODRXVARVAL_IMPLICIT(OdUInt64, getUInt64)
122 ODRXVARVAL_IMPLICIT(OdInt8 , getInt8)
123 ODRXVARVAL_IMPLICIT(OdInt16 , getInt16)
124 ODRXVARVAL_IMPLICIT(OdInt32 , getInt32)
125 ODRXVARVAL_IMPLICIT(OdInt64 , getInt64)
126#ifdef OD_INTPTR_UNIQUE
127 ODRXVARVAL_IMPLICIT(OdIntPtr, getIntPtr)
128#endif
129 ODRXVARVAL_IMPLICIT(double , getDouble)
130 ODRXVARVAL_IMPLICIT(OdString, getString)
131 ODRXVARVAL_IMPLICIT(OdAnsiString, getAnsiString)
132 ODRXVARVAL_IMPLICIT(OdStringArray, getStringArray)
133 ODRXVARVAL_IMPLICIT(OdRxObjectPtrArray, getRxObjectPtrArray)
134 ODRXVARVAL_IMPLICIT(OdDoubleArray, getDoubleArray)
135 ODRXVARVAL_IMPLICIT(OdUInt64Array, getUInt64Array)
136#undef ODRXVARVAL_IMPLICIT
137};
138
139#include "TD_PackPop.h"
140
141#endif //_VARIANTVALUE_H_INCLUDED_
OdArray< OdDouble, OdMemoryAllocator< OdDouble > > OdDoubleArray
Definition DoubleArray.h:36
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
OdArray< OdRxObjectPtr > OdRxObjectPtrArray
Definition RxObject.h:1196
#define ODRXVARVAL_IMPLICIT(type, getter)
#define ODRXVARVAL_CONSTR(type, setter)
OdSmartPtr< OdRxVariant > OdRxVariantPtr
OdArray< OdString > OdStringArray
Definition StringArray.h:32
OdArray< OdUInt64, OdMemoryAllocator< OdUInt64 > > OdUInt64Array
ODRX_DECLARE_MEMBERS(OdRxVariant)
OdRxVariantValue(const OdRxObject *pObject)
OdRxVariantValue(const OdRxVariant *pVariant)
void assign(const OdRxVariant *pVariant)
OdSmartPtr & operator=(const OdSmartPtr &pObject)
Definition SmartPtr.h:279