CFx SDK Documentation  2023 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 OdTimeStamp& time); //FELIX_CHANGE Backport from 22.4
107  // OdValue(const OdRxVariantValue& var);
108 
109  OdValue(const void* buffer, OdInt32 bufferSize);
110 
116  bool reset();
140  bool isValid () const;
141 
148  operator OdString() const;
149  operator OdInt32() const;
150  operator double() const;
151  operator OdInt64() const;
152  operator OdDbObjectId() const;
153 
159  OdValue& operator=(const OdDbObjectId& objectId);
160  OdValue& operator=(const OdResBufPtr& resBuf);
161 
162  // OdValue& operator= (const OdRxVariantValue& var);
163 
164  // bool get (const OdChar*& pszValue) const;
165 
173  bool get(OdString& value) const;
181  bool get(OdInt32& value) const;
189  bool get(double& value) const;
198  bool get(OdInt64& date) const;
208  bool get(double& x, double& y) const;
219  bool get(double& x, double& y, double& z) const;
228  bool get(OdDbObjectId& objectId) const;
237  bool get(OdResBufPtr& resBuf) const;
238 
239  // bool get(OdRxVariantValue& var) const;
240 
250  bool get(void*& pBuf, OdInt32& bufferSize) const;
251  bool get(OdTimeStamp& time) const; //FELIX_CHANGE Backport from 22.4
260  bool set(const OdValue& value);
269  bool set(const OdString& value);
287  bool set(double value);
296  bool set(const OdInt64& date);
306  bool set(double x, double y);
317  bool set(double x, double y, double z);
326  bool set(const OdDbObjectId& objectId);
335  bool set(const OdResBufPtr& resBuf);
336 
337  // bool set (const OdRxVariantValue& var);
338 
348  bool set(const void* buffer, OdInt32 bufferSize);
349 
350  bool set(const OdTimeStamp& time); //FELIX_CHANGE Backport from 22.4
351 // bool reset (void);
358  bool reset (OdValue::DataType nDataType);
359 // bool resetValue (void);
360 
362  void setUnitType (OdValue::UnitType nUnitType);
363  OdString getFormat (void) const;
364  void setFormat (const OdString& pszFormat);
365 
366 // bool parse (const OdString& pszText,
367 // OdValue::DataType nDataType,
368 // OdValue::UnitType nUnitType,
369 // const ACHAR* pszFormat,
370 // OdValue::ParseOption nOption,
371 // const AcDbObjectId* pTextStyleId);
372 //
373 
374  OdString format(OdDbDatabase* pDb = 0) const;
376  OdString format(const OdString& pszFormat, OdValue::FormatOption nOption, OdDbDatabase* pDb = 0);
377  bool format(const OdString& pszFormat, OdString& pszValue, OdDbDatabase* pDb = 0) const;
378 
379  bool convertTo (OdValue::DataType nDataType,
380  OdValue::UnitType nUnitType);
381  bool convertTo (OdValue::DataType nDataType,
382  OdValue::UnitType nUnitType,
383  bool bResetIfIncompatible);
384 
386  OdDbDwgFiler* pFiler);
387  virtual void dwgOutFields(
388  OdDbDwgFiler* pFiler) const;
389 
391  OdDbDxfFiler* pFiler);
392  virtual void dxfOutFields(
393  OdDbDxfFiler* pFiler) const;
394 
395 protected:
396  OdValue(OdValueImpl* pValImpl);
397 
398  friend class OdDbSystemInternals;
399  OdValueImpl* m_pImpl;
400 };
401 
402 #include "TD_PackPop.h"
403 
404 #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)
bool set(const OdTimeStamp &time)
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)
OdValue(const OdTimeStamp &time)
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(OdTimeStamp &time) const
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:399
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