CFx SDK Documentation  2022 SP0
DbHandle.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 
27 #ifndef ODDBHANDLE
28 #define ODDBHANDLE
30 #include "TD_PackPush.h"
31 
32 #include "DbRootExport.h"
33 #include "OdArrayPreDef.h"
34 #include "OdaDefs.h"
35 #include "OdString.h"
36 
46  int hexDigit);
47 
52 //TOOLKIT_EXPORT OdInt64 atoi64(const OdChar* pStr);
53 //TOOLKIT_EXPORT void i64toA(const OdInt64 &val, OdChar* pStr);
54 
67 {
68 public:
69  OdDbHandle() : m_val(0) {}
70 
71  OdDbHandle(const OdDbHandle& value) : m_val(value.m_val) {}
72 
74 
75  OdDbHandle(const OdChar* value) { *this = value; }
76  OdDbHandle(const char* value) { *this = value; }
77  OdDbHandle(const OdString& value) { *this = (const OdChar*)value; }
78  OdDbHandle(const OdAnsiString& value) { *this = (const char*)value; }
79  OdDbHandle(int value) : m_val(value) {}
80 #if OD_SIZEOF_LONG == 4
81  OdDbHandle(OdInt32 value) : m_val(value) {}
82 #endif
84  {
85  m_val = value;
86  return *this;
87  }
88 
90  OdDbHandle& operator=(const char* value);
91 
93  {
94  m_val = value.m_val;
95  return *this;
96  }
98  {
99  m_val = value;
100  return *this;
101  }
102 
103  operator OdUInt64() const { return m_val; }
104 
114  OdChar* pBuf) const;
115 
119  OdString ascii() const;
123  bool isNull() const { return m_val == 0; }
124 
126  OdUInt64 value) const { return m_val == value; }
127 
129  OdUInt64 value) const { return m_val != value; }
130 
132  OdUInt64 value) const { return m_val > value; }
133 
135  OdUInt64 value) const { return m_val < value; }
136 
138  OdUInt64 value) const { return m_val < value || m_val == value; }
139 
141  OdUInt64 value) const { return m_val > value || m_val == value; }
142 
144  const OdInt64& value)
145  {
146  m_val += value;
147  ODA_ASSERT_ONCE(!isNull()); // check handle stuff overflow
148  return *this;
149  }
151  const OdInt64& value)
152  {
153  OdDbHandle res;
154  res.m_val = m_val + value;
155  return res;
156  }
157 
169  void bytes(
170  OdUInt8 * bytes) const
171  {
172  OdUInt64 val = m_val;
173  *bytes++ = (OdUInt8)(val & 0xFF);
174  val >>= 8;
175  *bytes++ = (OdUInt8)(val & 0xFF);
176  val >>= 8;
177  *bytes++ = (OdUInt8)(val & 0xFF);
178  val >>= 8;
179  *bytes++ = (OdUInt8)(val & 0xFF);
180  val >>= 8;
181  *bytes++ = (OdUInt8)(val & 0xFF);
182  val >>= 8;
183  *bytes++ = (OdUInt8)(val & 0xFF);
184  val >>= 8;
185  *bytes++ = (OdUInt8)(val & 0xFF);
186  val >>= 8;
187  *bytes = (OdUInt8)(val & 0xFF);
188  }
189 
190 private:
191  OdUInt64 m_val;
192 };
193 
194 
199 
200 #include "TD_PackPop.h"
201 
202 #endif
203 
OdArray< OdDbHandle > OdHandleArray
Definition: DbHandle.h:198
DBROOT_EXPORT int getHexValue(int hexDigit)
#define DBROOT_EXPORT
Definition: DbRootExport.h:39
#define ODA_ASSERT_ONCE(exp)
Definition: DebugStuff.h:51
int OdInt32
unsigned char OdUInt8
wchar_t OdChar
bool operator>=(const OdString &s1, const OdString &s2)
Definition: OdString.h:1351
bool operator<=(const OdString &s1, const OdString &s2)
Definition: OdString.h:1329
bool operator<(const OdString &s1, const OdString &s2)
Definition: OdString.h:1284
bool operator>(const OdString &s1, const OdString &s2)
Definition: OdString.h:1307
OdDbHandle(const OdString &value)
Definition: DbHandle.h:77
OdDbHandle & operator=(OdUInt64 value)
Definition: DbHandle.h:83
OdDbHandle()
Definition: DbHandle.h:69
OdDbHandle(const OdAnsiString &value)
Definition: DbHandle.h:78
OdString ascii() const
bool isNull() const
Definition: DbHandle.h:123
OdDbHandle(OdUInt64 value)
Definition: DbHandle.h:73
OdDbHandle(const OdChar *value)
Definition: DbHandle.h:75
OdDbHandle operator+(const OdInt64 &value)
Definition: DbHandle.h:150
void getIntoAsciiBuffer(OdChar *pBuf) const
OdDbHandle & operator=(const char *value)
OdDbHandle & operator+=(const OdInt64 &value)
Definition: DbHandle.h:143
void bytes(OdUInt8 *bytes) const
Definition: DbHandle.h:169
OdDbHandle(const OdDbHandle &value)
Definition: DbHandle.h:71
OdDbHandle & operator=(int value)
Definition: DbHandle.h:97
OdDbHandle & operator=(const OdChar *value)
OdDbHandle & operator=(const OdDbHandle &value)
Definition: DbHandle.h:92
OdDbHandle(int value)
Definition: DbHandle.h:79
OdDbHandle(const char *value)
Definition: DbHandle.h:76
Definition: Int64.h:43
GLsizei const GLfloat * value
Definition: gles2_ext.h:302
bool DAI_EXPORT operator!=(const OdDAI::OdSelect &left, const OdDAI::OdSelect &right)
bool DAI_EXPORT operator==(const OdFileDescriptionAuto &left, const OdFileDescriptionAuto &right)