CFx SDK Documentation  2020SP3
OdValue.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 #ifndef _ODVALUE_INCLUDED_
27 #define _ODVALUE_INCLUDED_
28 
29 #include "TD_PackPush.h"
30 #include "StaticRxObject.h"
31 
32 class OdValueImpl;
33 class OdValue;
35 
39 class TOOLKIT_EXPORT OdValue : public OdStaticRxObject<OdRxObject>
40 {
41 public:
43 
44  enum DataType
45  {
46  kUnknown = 0x00,
47  kLong = 0x01,
48  kDouble = 0x02,
49  kString = 0x04,
50  kDate = 0x08,
51  kPoint = 0x10,
52  k3dPoint = 0x20,
53  kObjectId = 0x40,
54  kBuffer = 0x80,
55  kResbuf = 0x100,
56  kGeneral = 0x200,
57  kColor = 0x400
58  };
59 
60  enum UnitType
61  {
62  kUnitless = 0x00,
63  kDistance = 0x01,
64  kAngle = 0x02,
65  kArea = 0x04,
66  kVolume = 0x08,
67  kCurrency = 0x10,
68  kPercentage = 0x20
69  };
70 
72  {
73  kParseOptionNone = 0x00,
74  kSetDefaultFormat = 0x01,
75  kPreserveMtextFormat = 0x02,
76  kConvertTextToValue = 0x04,
77  kChangeDataType = 0x08,
78  kParseTextForFieldCode = 0x10
79  };
80 
82  {
83  kFormatOptionNone = 0x00,
84  kForEditing = 0x01,
85  kForExpression = 0x02,
86  kUseMaximumPrecision = 0x04,
87  kIgnoreMtextFormat = 0x08
88  };
89 
90 
91 public:
93 
94  OdValue(void);
95  ~OdValue(void);
96 
100  OdValue(double value);
101  OdValue(const OdInt64& date);
102  OdValue(double x, double y);
103  OdValue(double x, double y, double z);
104  OdValue(const OdDbObjectId& objectId);
105  OdValue(const OdResBufPtr& resBuf);
106  // OdValue(const OdRxVariantValue& var);
107 
108  OdValue(const void* buffer, OdInt32 bufferSize);
109 
115  bool reset();
139  bool isValid () const;
140 
147  operator OdString() const;
148  operator OdInt32() const;
149  operator double() const;
150  operator OdInt64() const;
151  operator OdDbObjectId() const;
152 
158  OdValue& operator=(const OdDbObjectId& objectId);
159  OdValue& operator=(const OdResBufPtr& resBuf);
160 
161  // OdValue& operator= (const OdRxVariantValue& var);
162 
163  // bool get (const OdChar*& pszValue) const;
164 
172  bool get(OdString& value) const;
180  bool get(OdInt32& value) const;
188  bool get(double& value) const;
197  bool get(OdInt64& date) const;
207  bool get(double& x, double& y) const;
218  bool get(double& x, double& y, double& z) const;
227  bool get(OdDbObjectId& objectId) const;
236  bool get(OdResBufPtr& resBuf) const;
237 
238  // bool get(OdRxVariantValue& var) const;
239 
249  bool get(void*& pBuf, OdInt32& bufferSize) const;
258  bool set(const OdValue& value);
267  bool set(const OdString& value);
276  bool set(OdInt32 value);
285  bool set(double value);
294  bool set(const OdInt64& date);
304  bool set(double x, double y);
315  bool set(double x, double y, double z);
324  bool set(const OdDbObjectId& objectId);
333  bool set(const OdResBufPtr& resBuf);
334 
335  // bool set (const OdRxVariantValue& var);
336 
346  bool set(const void* buffer, OdInt32 bufferSize);
347 
348 // bool reset (void);
355  bool reset (OdValue::DataType nDataType);
356 // bool resetValue (void);
357 
359  void setUnitType (OdValue::UnitType nUnitType);
360  OdString getFormat (void) const;
361  void setFormat (const OdString& pszFormat);
362 
363 // bool parse (const OdString& pszText,
364 // OdValue::DataType nDataType,
365 // OdValue::UnitType nUnitType,
366 // const ACHAR* pszFormat,
367 // OdValue::ParseOption nOption,
368 // const AcDbObjectId* pTextStyleId);
369 //
370 
371  OdString format(OdDbDatabase* pDb = 0) const;
373  OdString format(const OdString& pszFormat, OdValue::FormatOption nOption, OdDbDatabase* pDb = 0);
374  bool format(const OdString& pszFormat, OdString& pszValue, OdDbDatabase* pDb = 0) const;
375 
376  bool convertTo (OdValue::DataType nDataType,
377  OdValue::UnitType nUnitType);
378  bool convertTo (OdValue::DataType nDataType,
379  OdValue::UnitType nUnitType,
380  bool bResetIfIncompatible);
381 
383  OdDbDwgFiler* pFiler);
384  virtual void dwgOutFields(
385  OdDbDwgFiler* pFiler) const;
386 
388  OdDbDxfFiler* pFiler);
389  virtual void dxfOutFields(
390  OdDbDxfFiler* pFiler) const;
391 
392 protected:
393  OdValue(OdValueImpl* pValImpl);
394 
395  friend class OdDbSystemInternals;
396  OdValueImpl* m_pImpl;
397 };
398 
399 #include "TD_PackPop.h"
400 
401 #endif // _ODVALUE_INCLUDED_
OdValue::~OdValue
~OdValue(void)
OdResult
OdResult
Definition: OdResult.h:29
OdString
Definition: OdString.h:95
OdDbDatabase
Definition: DbDatabase.h:421
OdValue::OdValue
OdValue(OdValueImpl *pValImpl)
OdValue::isValid
bool isValid() const
OdValue::operator=
OdValue & operator=(OdInt32 value)
OdInt64
Definition: Int64.h:43
OdValue::DataType
DataType
Definition: OdValue.h:45
OdValue::OdValue
OdValue(const void *buffer, OdInt32 bufferSize)
buffer
GLuint buffer
Definition: gles2_ext.h:178
OdGiVisualStyleProperties::kColor
@ kColor
Definition: GiVisualStyle.h:800
OdDbObjectId
Definition: DbObjectId.h:99
OdValue::setFormat
void setFormat(const OdString &pszFormat)
OdValue::operator=
OdValue & operator=(double value)
OdValue::reset
bool reset()
OdValue::convertTo
bool convertTo(OdValue::DataType nDataType, OdValue::UnitType nUnitType, bool bResetIfIncompatible)
OdValue::UnitType
UnitType
Definition: OdValue.h:61
TD_PackPop.h
OdIfc::kAngle
@ kAngle
Definition: IfcAttributesEnum.h:60
kUnknown
@ kUnknown
Definition: DbManagerSubentData.h:39
x
GLfloat x
Definition: gles2_ext.h:314
OdValue::dxfInFields
virtual OdResult dxfInFields(OdDbDxfFiler *pFiler)
OdValue::operator=
OdValue & operator=(OdInt64 date)
OdValue::format
OdString format(OdDbDatabase *pDb=0) const
OdValue::operator=
OdValue & operator=(const OdDbObjectId &objectId)
OdValue::FormatOption
FormatOption
Definition: OdValue.h:82
OdValue::getFormat
OdString getFormat(void) const
OdString
OdString OdString
Definition: OdString.h:1224
OdSmartPtr
Definition: SmartPtr.h:58
OdValue::OdValue
OdValue(double x, double y, double z)
OdValue::reset
bool reset(OdValue::DataType nDataType)
OdInt32
int OdInt32
Definition: OdPlatformSettings.h:782
OdValue::OdValue
OdValue(void)
OdValue::dwgOutFields
virtual void dwgOutFields(OdDbDwgFiler *pFiler) const
OdValuePtr
OdSmartPtr< OdValue > OdValuePtr
Definition: OdValue.h:33
y
GLfloat GLfloat y
Definition: gles2_ext.h:316
OdValue
Definition: OdValue.h:40
OdValue::format
OdString format(OdValue::FormatOption nOption, OdDbDatabase *pDb=0)
OdValue::unitType
OdValue::UnitType unitType(void) const
OdValue::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(OdValue)
OdValue::ParseOption
ParseOption
Definition: OdValue.h:72
OdValue::dwgInFields
virtual OdResult dwgInFields(OdDbDwgFiler *pFiler)
OdValue::OdValue
OdValue(const OdDbObjectId &objectId)
OdValue::convertTo
bool convertTo(OdValue::DataType nDataType, OdValue::UnitType nUnitType)
OdValue::operator=
OdValue & operator=(const OdString &value)
OdValue::operator=
OdValue & operator=(const OdValue &value)
OdDbDxfFiler
Definition: DbFiler.h:194
OdValue::OdValue
OdValue(OdInt32 value)
TD_PackPush.h
StaticRxObject.h
OdValue::OdValue
OdValue(const OdString &value)
OdIfc::kCurrency
@ kCurrency
Definition: IfcAttributesEnum.h:237
OdValue::OdValue
OdValue(const OdValue &value)
OdValue::OdValue
OdValue(double value)
OdStaticRxObject
Definition: StaticRxObject.h:57
OdValue::operator=
OdValue & operator=(const OdResBufPtr &resBuf)
OdValue::format
OdString format(const OdString &pszFormat, OdValue::FormatOption nOption, OdDbDatabase *pDb=0)
value
GLsizei const GLfloat * value
Definition: gles2_ext.h:302
OdValue::dataType
OdValue::DataType dataType() const
OdValue::m_pImpl
OdValueImpl * m_pImpl
Definition: OdValue.h:396
TOOLKIT_EXPORT
#define TOOLKIT_EXPORT
Definition: DbExport.h:40
OdValue::setUnitType
void setUnitType(OdValue::UnitType nUnitType)
OdValue::OdValue
OdValue(double x, double y)
OdValue::OdValue
OdValue(const OdInt64 &date)
OdValue::dxfOutFields
virtual void dxfOutFields(OdDbDxfFiler *pFiler) const
z
GLfloat GLfloat GLfloat z
Definition: gles2_ext.h:318
OdValue::OdValue
OdValue(const OdResBufPtr &resBuf)
OdIfc::kDistance
@ kDistance
Definition: IfcAttributesEnum.h:295
OdDbDwgFiler
Definition: DbFiler.h:1031
OdValue::ODRX_HEAP_OPERATORS
ODRX_HEAP_OPERATORS()
OdValue::format
bool format(const OdString &pszFormat, OdString &pszValue, OdDbDatabase *pDb=0) const