CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
GiVariant.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// OdGiVariant type for generic procedural material.
25
26#ifndef __ODGIVARIANT_H__
27#define __ODGIVARIANT_H__
28
29#include "RootExport.h"
30#include "GiExport.h"
31
32#include "CmColorBase.h"
33#include "RxVariant.h"
34#include "RxObject.h"
35
36#include "TD_PackPush.h"
37
46class FIRSTDLL_EXPORT OdGiVariant : public OdRxObject
47{
48 static void copyDataFrom(OdGiVariant &vTo, const OdGiVariant &vFrom);
49 public:
54 {
55 kUndefined = 0, // Variant type is undefined (the default type).
56 kBoolean, // An OdGiVariant is of a boolean type (bool).
57 kInt, // An OdGiVariant is of a long type (OdInt32).
58 kDouble, // An OdGiVariant is of a double type (double).
59 kColor, // An OdGiVariant is of a color type (OdCmEntityColor).
60 kString, // An OdGiVariant is of a string type (OdString).
61 kTable // An OdGiVariant is a table of key/value pairs.
62 };
63 public:
68 {
69 public:
74 explicit EnumType(int value) : m_value(value) { }
75 //DOM-IGNORE-BEGIN
76 template <typename T> operator T() { return static_cast<T>(m_value); }
77 //DOM-IGNORE-END
84 template <typename T> bool operator ==(T right) const { return static_cast<int>(right) == m_value; }
91 template <typename T> bool operator !=(T right) const { return !(*this == right); }
92 protected:
94 };
95 public:
97
98 // Constructors
99 //OdGiVariant();
100 //OdGiVariant(const OdGiVariant &value);
101 //OdGiVariant(bool value);
102 //OdGiVariant(OdInt32 value);
103 //OdGiVariant(double value);
104 //OdGiVariant(const OdCmEntityColor &value);
105 //OdGiVariant(const OdString &value);
106 //OdGiVariant(const OdChar *value);
107 protected:
109 public:
116
123
130
137
144
151
158
163
175 bool operator ==(const OdGiVariant& value) const;
176
181 OdGiVariant &operator =(const OdGiVariant& value);
182
195 virtual void copyFrom(const OdRxObject* pSource);
196
201
207 void set(bool value);
208
215
221 void set(double value);
222
229
235 void set(const OdString &value);
236
242 void set(const OdChar *value);
243
247 bool asBoolean() const;
248
252 OdInt32 asInt() const;
253
257 double asDouble() const;
258
262 const OdCmEntityColor &asColor() const;
263
267 const OdString &asString() const;
268
272 float asFloat() const;
273
277 OdInt8 asChar() const;
278
283
288
293
298
303
308
313
323 bool getElem(const OdString &elem, OdGiVariant &value) const;
324
333 const OdGiVariant *getElem(const OdString &elem) const;
334
341 void setElem(const OdString &elem, const OdGiVariant &value);
342
348 void deleteElem(const OdString &elem);
349
354
366 bool getElemAt(OdInt32 nElem, OdString &elem, OdGiVariant &value) const;
367
377 const OdGiVariant *getElemAt(OdInt32 nElem, OdString &elem) const;
378
392 static bool isEquivalent(const OdGiVariant *v1, const OdGiVariant *v2);
393 private:
394 VariantType m_type;
395 OdVariant m_variant;
396};
397
398template <typename T>
399inline bool operator ==(T left, const OdGiVariant::EnumType right)
400{
401 return (right == left);
402}
403
404template <typename T>
405inline bool operator !=(T left, const OdGiVariant::EnumType right)
406{
407 return (right != left);
408}
409
416
417#include "TD_PackPop.h"
418
419#endif // __ODGIVARIANT_H__
bool operator!=(T left, const OdGiVariant::EnumType right)
Definition GiVariant.h:405
OdSmartPtr< OdGiVariant > OdGiVariantPtr
Definition GiVariant.h:415
bool operator==(T left, const OdGiVariant::EnumType right)
Definition GiVariant.h:399
unsigned int OdUInt32
short OdInt16
signed char OdInt8
unsigned short OdUInt16
int OdInt32
unsigned char OdUInt8
wchar_t OdChar
#define FIRSTDLL_EXPORT
Definition RootExport.h:39
EnumType(int value)
Definition GiVariant.h:74
OdUInt32 asUlong() const
static OdSmartPtr< OdGiVariant > createObject(OdInt32 value)
static bool isEquivalent(const OdGiVariant *v1, const OdGiVariant *v2)
void set(OdInt32 value)
ODRX_DECLARE_MEMBERS(OdGiVariant)
float asFloat() const
OdInt8 asChar() const
VariantType type() const
OdInt16 asShort() const
OdUInt32 asUint() const
const OdGiVariant * getElemAt(OdInt32 nElem, OdString &elem) const
static OdSmartPtr< OdGiVariant > createObject(const OdCmEntityColor &value)
void set(const OdString &value)
static OdSmartPtr< OdGiVariant > createObject(const OdGiVariant &value)
void setElem(const OdString &elem, const OdGiVariant &value)
bool getElemAt(OdInt32 nElem, OdString &elem, OdGiVariant &value) const
OdInt32 asLong() const
void set(bool value)
EnumType asEnum() const
const OdString & asString() const
bool asBoolean() const
static OdSmartPtr< OdGiVariant > createObject(const OdChar *value)
void set(const OdCmEntityColor &value)
void set(const OdChar *value)
static OdSmartPtr< OdGiVariant > createObject(const OdString &value)
void set(double value)
static OdSmartPtr< OdGiVariant > createObject(double value)
OdUInt16 asUshort() const
double asDouble() const
static OdSmartPtr< OdGiVariant > createObject(bool value)
const OdCmEntityColor & asColor() const
bool getElem(const OdString &elem, OdGiVariant &value) const
OdInt32 getElemCount() const
OdUInt8 asUchar() const
void deleteElem(const OdString &elem)
OdInt32 asInt() const
virtual void copyFrom(const OdRxObject *pSource)
const OdGiVariant * getElem(const OdString &elem) const
GLfloat GLfloat v1
Definition gles2_ext.h:295
GLfloat GLfloat GLfloat v2
Definition gles2_ext.h:296
GLsizei const GLfloat * value
Definition gles2_ext.h:302