CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GiVariant.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// 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
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 template <typename T> operator T() { return static_cast<T>(m_value); }
82 template <typename T> bool operator ==(T right) const { return static_cast<int>(right) == m_value; }
89 template <typename T> bool operator !=(T right) const { return !(*this == right); }
90 protected:
92 };
93 public:
95
96 // Constructors
97 //OdGiVariant();
98 //OdGiVariant(const OdGiVariant &value);
99 //OdGiVariant(bool value);
100 //OdGiVariant(OdInt32 value);
101 //OdGiVariant(double value);
102 //OdGiVariant(const OdCmEntityColor &value);
103 //OdGiVariant(const OdString &value);
104 //OdGiVariant(const OdChar *value);
105 protected:
107 public:
114
121
128
135
142
149
156
161
173 bool operator ==(const OdGiVariant& value) const;
174
179 OdGiVariant &operator =(const OdGiVariant& value);
180
193 virtual void copyFrom(const OdRxObject* pSource);
194
199
205 void set(bool value);
206
213
219 void set(double value);
220
227
233 void set(const OdString &value);
234
240 void set(const OdChar *value);
241
245 bool asBoolean() const;
246
250 OdInt32 asInt() const;
251
255 double asDouble() const;
256
260 const OdCmEntityColor &asColor() const;
261
265 const OdString &asString() const;
266
270 float asFloat() const;
271
275 OdInt8 asChar() const;
276
281
286
291
296
301
306
311
321 bool getElem(const OdString &elem, OdGiVariant &value) const;
322
331 const OdGiVariant *getElem(const OdString &elem) const;
332
339 void setElem(const OdString &elem, const OdGiVariant &value);
340
346 void deleteElem(const OdString &elem);
347
352
364 bool getElemAt(OdInt32 nElem, OdString &elem, OdGiVariant &value) const;
365
375 const OdGiVariant *getElemAt(OdInt32 nElem, OdString &elem) const;
376
390 static bool isEquivalent(const OdGiVariant *v1, const OdGiVariant *v2);
391 private:
392 VariantType m_type;
393 OdVariant m_variant;
394};
395
396template <typename T>
397inline bool operator ==(T left, const OdGiVariant::EnumType right)
398{
399 return (right == left);
400}
401
402template <typename T>
403inline bool operator !=(T left, const OdGiVariant::EnumType right)
404{
405 return (right != left);
406}
407
414
415#include "TD_PackPop.h"
416
417#endif // __ODGIVARIANT_H__
bool operator!=(T left, const OdGiVariant::EnumType right)
Definition: GiVariant.h:403
OdSmartPtr< OdGiVariant > OdGiVariantPtr
Definition: GiVariant.h:413
bool operator==(T left, const OdGiVariant::EnumType right)
Definition: GiVariant.h:397
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