CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
DbHandle.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, 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-2024 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
29
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
55
56template <class T>
58
59
71
72template <class T>
74
75
76
78{
79public:
86 OdDbHandle() : m_val(0) {}
87
93 OdDbHandle(const OdDbHandle& value) = default;
94
95#ifndef SWIG
96 template <class T, std::enable_if<OdDbHandleConvertible<typename std::remove_reference<typename std::remove_cv<T>::type>::type>::value>* = nullptr>
97
105 OdDbHandle(T value) : m_val(static_cast<OdUInt64>(value)) {}
106#endif
107
114
120 OdDbHandle(const OdChar* value) { *this = value; }
121
127 OdDbHandle(const char* value) { *this = value; }
128
134 OdDbHandle(const OdString& value) { *this = (const OdChar*)value; }
135
141 OdDbHandle(const OdAnsiString& value) { *this = (const char*)value; }
142
148 OdDbHandle(int value) : m_val(value) {}
149#if OD_SIZEOF_LONG == 4
150
156 OdDbHandle(OdInt32 value) : m_val(value) {}
157#endif
165 {
166 m_val = value;
167 return *this;
168 }
169
177
185
193
201 {
202 m_val = value;
203 return *this;
204 }
205
211 operator OdUInt64() const { return m_val; }
212
221 OdChar* pBuf) const;
222
230 bool isNull() const { return m_val == 0; }
231
239 OdUInt64 value) const { return m_val == value; }
240
248 OdUInt64 value) const { return m_val != value; }
249
257 OdUInt64 value) const { return m_val > value; }
258
266 OdUInt64 value) const { return m_val < value; }
267
275 OdUInt64 value) const { return m_val < value || m_val == value; }
276
284 OdUInt64 value) const { return m_val > value || m_val == value; }
285
293 const OdInt64& value)
294 {
295 m_val += value;
296 ODA_ASSERT_ONCE(!isNull()); // check handle stuff overflow
297 return *this;
298 }
299
307 const OdInt64& value)
308 {
309 OdDbHandle res;
310 res.m_val = m_val + value;
311 return res;
312 }
313
322 void bytes(
323 OdUInt8 * bytes) const
324 {
325 OdUInt64 val = m_val;
326 *bytes++ = (OdUInt8)(val & 0xFF);
327 val >>= 8;
328 *bytes++ = (OdUInt8)(val & 0xFF);
329 val >>= 8;
330 *bytes++ = (OdUInt8)(val & 0xFF);
331 val >>= 8;
332 *bytes++ = (OdUInt8)(val & 0xFF);
333 val >>= 8;
334 *bytes++ = (OdUInt8)(val & 0xFF);
335 val >>= 8;
336 *bytes++ = (OdUInt8)(val & 0xFF);
337 val >>= 8;
338 *bytes++ = (OdUInt8)(val & 0xFF);
339 val >>= 8;
340 *bytes = (OdUInt8)(val & 0xFF);
341 }
342
343private:
344 OdUInt64 m_val;
345};
346
347
352
353#include "TD_PackPop.h"
354
355#endif
356
OdArray< OdDbHandle > OdHandleArray
Definition DbHandle.h:351
DBROOT_EXPORT int getHexValue(int hexDigit)
#define DBROOT_EXPORT
#define ODA_ASSERT_ONCE(exp)
Definition DebugStuff.h:73
bool operator!=(T left, const OdGiVariant::EnumType right)
Definition GiVariant.h:405
bool operator==(T left, const OdGiVariant::EnumType right)
Definition GiVariant.h:399
int OdInt32
unsigned char OdUInt8
wchar_t OdChar
bool operator>=(const OdString &s1, const OdString &s2)
Definition OdString.h:1384
bool operator<=(const OdString &s1, const OdString &s2)
Definition OdString.h:1362
bool operator<(const OdString &s1, const OdString &s2)
Definition OdString.h:1317
bool operator>(const OdString &s1, const OdString &s2)
Definition OdString.h:1340
OdDbHandle(const OdString &value)
Definition DbHandle.h:134
OdDbHandle(T value)
Definition DbHandle.h:105
OdDbHandle & operator=(const OdChar *value)
OdDbHandle & operator=(int value)
Definition DbHandle.h:200
OdDbHandle(const OdAnsiString &value)
Definition DbHandle.h:141
OdString ascii() const
bool isNull() const
Definition DbHandle.h:230
OdDbHandle(OdUInt64 value)
Definition DbHandle.h:113
OdDbHandle(const OdChar *value)
Definition DbHandle.h:120
OdDbHandle operator+(const OdInt64 &value)
Definition DbHandle.h:306
void getIntoAsciiBuffer(OdChar *pBuf) const
OdDbHandle & operator=(const char *value)
OdDbHandle & operator+=(const OdInt64 &value)
Definition DbHandle.h:292
OdDbHandle & operator=(OdUInt64 value)
Definition DbHandle.h:164
OdDbHandle(const OdDbHandle &value)=default
void bytes(OdUInt8 *bytes) const
Definition DbHandle.h:322
OdDbHandle & operator=(const OdDbHandle &value)=default
OdDbHandle(int value)
Definition DbHandle.h:148
OdDbHandle(const char *value)
Definition DbHandle.h:127
GLuint GLsizei GLsizei GLint GLenum * type
Definition gles2_ext.h:274
GLsizei const GLfloat * value
Definition gles2_ext.h:302