CFx SDK Documentation  2022 SP0
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);
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_
#define TOOLKIT_EXPORT
Definition: DbExport.h:40
int OdInt32
OdResult
Definition: OdResult.h:29
OdString OdString
Definition: OdString.h:1224
OdSmartPtr< OdValue > OdValuePtr
Definition: OdValue.h:33
Definition: Int64.h:43
bool get(OdInt32 &value) const
bool get(double &value) const
DataType
Definition: OdValue.h:45
OdValue & operator=(double value)
bool get(OdString &value) const
OdValue(void)
OdValue(double value)
OdString format(OdDbDatabase *pDb=0) const
bool get(void *&pBuf, OdInt32 &bufferSize) const
bool set(const OdString &value)
bool convertTo(OdValue::DataType nDataType, OdValue::UnitType nUnitType)
ParseOption
Definition: OdValue.h:72
bool set(const OdInt64 &date)
OdValue & operator=(OdInt64 date)
bool get(OdResBufPtr &resBuf) const
virtual OdResult dwgInFields(OdDbDwgFiler *pFiler)
bool get(double &x, double &y) const
bool isValid() const
OdString format(const OdString &pszFormat, OdValue::FormatOption nOption, OdDbDatabase *pDb=0)
OdValue & operator=(const OdDbObjectId &objectId)
bool set(OdInt32 value)
bool set(double value)
bool reset()
bool get(OdInt64 &date) const
OdValue(OdValueImpl *pValImpl)
bool set(double x, double y, double z)
bool format(const OdString &pszFormat, OdString &pszValue, OdDbDatabase *pDb=0) const
OdValue(const OdValue &value)
virtual OdResult dxfInFields(OdDbDxfFiler *pFiler)
bool set(const OdDbObjectId &objectId)
OdValue & operator=(const OdString &value)
bool set(const void *buffer, OdInt32 bufferSize)
OdValue & operator=(OdInt32 value)
OdValue & operator=(const OdValue &value)
ODRX_HEAP_OPERATORS()
OdValue::UnitType unitType(void) const
bool get(double &x, double &y, double &z) const
bool set(const OdResBufPtr &resBuf)
OdValue(const void *buffer, OdInt32 bufferSize)
bool convertTo(OdValue::DataType nDataType, OdValue::UnitType nUnitType, bool bResetIfIncompatible)
OdValue(const OdDbObjectId &objectId)
OdValue(OdInt32 value)
ODRX_DECLARE_MEMBERS(OdValue)
bool get(OdDbObjectId &objectId) const
OdValue & operator=(const OdResBufPtr &resBuf)
~OdValue(void)
bool set(double x, double y)
OdValue(const OdInt64 &date)
virtual void dwgOutFields(OdDbDwgFiler *pFiler) const
bool set(const OdValue &value)
void setUnitType(OdValue::UnitType nUnitType)
OdString format(OdValue::FormatOption nOption, OdDbDatabase *pDb=0)
OdString getFormat(void) const
OdValue::DataType dataType() const
UnitType
Definition: OdValue.h:61
bool reset(OdValue::DataType nDataType)
OdValue(const OdResBufPtr &resBuf)
OdValueImpl * m_pImpl
Definition: OdValue.h:396
virtual void dxfOutFields(OdDbDxfFiler *pFiler) const
FormatOption
Definition: OdValue.h:82
OdValue(const OdString &value)
OdValue(double x, double y)
void setFormat(const OdString &pszFormat)
OdValue(double x, double y, double z)
GLfloat GLfloat GLfloat z
Definition: gles2_ext.h:318
GLuint buffer
Definition: gles2_ext.h:178
GLfloat x
Definition: gles2_ext.h:314
GLfloat GLfloat y
Definition: gles2_ext.h:316
GLsizei const GLfloat * value
Definition: gles2_ext.h:302