CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
RxVariantValue.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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-2022 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 OdRxVariant : public OdRxObject, public OdVariant { };
45
52class OdRxVariantValue : public OdSmartPtr<OdRxVariant>
53{
54public:
59 void assign(const OdRxVariant* pVariant) { OdSmartPtr<OdRxVariant>::operator=(pVariant); }
60
67 OdRxVariantValue(const OdRxObject* pObject) : OdSmartPtr<OdRxVariant>(pObject) {}
68
69 OdRxVariantValue(const OdRxVariant* pVariant) : OdSmartPtr<OdRxVariant>(pVariant) {}
70
71#define ODRXVARVAL_CONSTR(type, setter) \
72 OdRxVariantValue(type value) \
73 { \
74 assign(OdRxObjectImpl<OdRxVariant>::createObject()); \
75 get()->setter(value); \
76 }
77 ODRXVARVAL_CONSTR(bool , setBool)
78 ODRXVARVAL_CONSTR(OdUInt8 , setUInt8)
79 ODRXVARVAL_CONSTR(OdInt8 , setInt8)
80 ODRXVARVAL_CONSTR(OdUInt16 , setUInt16)
81 ODRXVARVAL_CONSTR(OdInt16 , setInt16)
82 ODRXVARVAL_CONSTR(OdUInt32 , setUInt32)
83 ODRXVARVAL_CONSTR(OdInt32 , setInt32)
84 ODRXVARVAL_CONSTR(OdUInt64 , setUInt64)
85 ODRXVARVAL_CONSTR(OdInt64 , setInt64)
86#ifdef OD_INTPTR_UNIQUE
87 ODRXVARVAL_CONSTR(OdIntPtr , setIntPtr)
88#endif
89 ODRXVARVAL_CONSTR(double , setDouble)
90 ODRXVARVAL_CONSTR(const OdString&, setString)
91 ODRXVARVAL_CONSTR(const OdAnsiString&, setAnsiString)
92 ODRXVARVAL_CONSTR(const OdStringArray&, setStringArray)
93 ODRXVARVAL_CONSTR(const OdRxObjectPtrArray&, setRxObjectPtrArray)
94 ODRXVARVAL_CONSTR(const OdDoubleArray&, setDoubleArray)
95 ODRXVARVAL_CONSTR(const OdUInt64Array&, setUInt64Array)
96#undef ODRXVARVAL_CONSTR
97
102#define ODRXVARVAL_IMPLICIT(type, getter) \
103 operator type() const \
104 { \
105 return get()->getter(); \
106 } \
107 operator type() \
108 { \
109 return get()->getter(); \
110 }
111 // #7196 : override OdSmartPtr<T>::operator bool() private member.
112 // #7196 : some compilers (MSVC) require non-const for all types if bool() member available.
113 ODRXVARVAL_IMPLICIT(bool , getBool)
114 ODRXVARVAL_IMPLICIT(OdUInt8 , getUInt8)
115 ODRXVARVAL_IMPLICIT(OdUInt16, getUInt16)
116 ODRXVARVAL_IMPLICIT(OdUInt32, getUInt32)
117 ODRXVARVAL_IMPLICIT(OdUInt64, getUInt64)
118 ODRXVARVAL_IMPLICIT(OdInt8 , getInt8)
119 ODRXVARVAL_IMPLICIT(OdInt16 , getInt16)
120 ODRXVARVAL_IMPLICIT(OdInt32 , getInt32)
121 ODRXVARVAL_IMPLICIT(OdInt64 , getInt64)
122#ifdef OD_INTPTR_UNIQUE
123 ODRXVARVAL_IMPLICIT(OdIntPtr, getIntPtr)
124#endif
125 ODRXVARVAL_IMPLICIT(double , getDouble)
126 ODRXVARVAL_IMPLICIT(OdString, getString)
127 ODRXVARVAL_IMPLICIT(OdAnsiString, getAnsiString)
128 ODRXVARVAL_IMPLICIT(OdStringArray, getStringArray)
129 ODRXVARVAL_IMPLICIT(OdRxObjectPtrArray, getRxObjectPtrArray)
130 ODRXVARVAL_IMPLICIT(OdDoubleArray, getDoubleArray)
131 ODRXVARVAL_IMPLICIT(OdUInt64Array, getUInt64Array)
132#undef ODRXVARVAL_IMPLICIT
133};
134
135#include "TD_PackPop.h"
136
137#endif //_VARIANTVALUE_H_INCLUDED_
unsigned int OdUInt32
short OdInt16
signed char OdInt8
unsigned short OdUInt16
int OdInt32
unsigned char OdUInt8
ptrdiff_t OdIntPtr
#define ODRXVARVAL_IMPLICIT(type, getter)
#define ODRXVARVAL_CONSTR(type, setter)
OdSmartPtr< OdRxVariant > OdRxVariantPtr
Definition: Int64.h:43
OdRxVariantValue(const OdRxObject *pObject)
OdRxVariantValue(const OdRxVariant *pVariant)
void assign(const OdRxVariant *pVariant)
OdSmartPtr & operator=(const OdSmartPtr &pObject)
Definition: SmartPtr.h:303