Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cVariantType.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cVariantType_H
7 #define _INC_cVariantType_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "../GrayLibBase.h"
15 
16 namespace GrayLib
17 {
19  {
23 
24  VARTYPE_NoType = 0, // equiv to JSON null.
25 
26 #define cVariantTypeDEF(a,b,c,d,e,f) VARTYPE_##a,
27 #include "cVariantTypes.tbl"
28 #undef cVariantTypeDEF
30 
31  // Some types have alternate names
32  VARTYPE_Int = VARTYPE_Int32,
33  VARTYPE_UInt = VARTYPE_DWord,
35 #ifdef USE_LONG_AS_INT64
36  VARTYPE_Long = VARTYPE_Int64,
37  VARTYPE_ULong = VARTYPE_QWord,
38 #else
39  VARTYPE_Long = VARTYPE_Int32,
40  VARTYPE_ULong = VARTYPE_DWord,
41 #endif
43  };
44 
46  {
49 
50  public:
51  const ATOMCHAR_t* get_Name() const noexcept
52  {
53  return m_pszName;
54  }
55  size_t get_Size() const noexcept
56  {
57  return m_nSize;
58  }
59 
60  bool isStaticSized() const noexcept
61  {
64  return (m_bFlags & CTYPE_FLAG_Alloc) == 0;
65  }
66  bool isNumeric() const noexcept
67  {
69  return (m_bFlags & CTYPE_FLAG_Numeric) != 0;
70  }
71  bool isNumSigned() const noexcept
72  {
74  return (m_bFlags & CTYPE_FLAG_NumSigned) != 0;
75  }
76  bool isFloat() const noexcept
77  {
79  return (m_bFlags & CTYPE_FLAG_Float) != 0;
80  }
81  bool isString() const noexcept
82  {
84  }
85  bool isStringA() const noexcept
86  {
87  return (m_bFlags & CTYPE_FLAG_StringA) != 0;
88  }
89  bool isStringW() const noexcept
90  {
92  return (m_bFlags & CTYPE_FLAG_StringW) != 0;
93  }
94  bool isTime() const noexcept
95  {
96  return (m_bFlags & CTYPE_FLAG_Time) != 0;
97  }
98 
99  public:
101  size_t m_nSize;
102  BYTE m_bFlags;
103  };
104 }
105 
106 #endif
Definition: cVariantType.h:46
size_t m_nSize
base sizeof() for the native data type. (if applicable)
Definition: cVariantType.h:101
bool isStringA() const noexcept
Definition: cVariantType.h:85
bool isStaticSized() const noexcept
Definition: cVariantType.h:60
bool isFloat() const noexcept
Definition: cVariantType.h:76
size_t get_Size() const noexcept
Definition: cVariantType.h:55
bool isNumSigned() const noexcept
Definition: cVariantType.h:71
bool isString() const noexcept
Definition: cVariantType.h:81
BYTE m_bFlags
CTYPE_FLAG_TYPE describes attributes of the type.
Definition: cVariantType.h:102
bool isStringW() const noexcept
Definition: cVariantType.h:89
const ATOMCHAR_t * get_Name() const noexcept
Definition: cVariantType.h:51
bool isTime() const noexcept
Definition: cVariantType.h:94
bool isNumeric() const noexcept
Definition: cVariantType.h:66
const ATOMCHAR_t * m_pszName
Our Type Name. NOT the same as 'C' type name.
Definition: cVariantType.h:100
Definition: cMesh.h:22
VARTYPE_TYPE
< define types of structure/record elements. (COM uses VARTYPE=VARENUM for this) stored as BYTE
Definition: cVariantType.h:19
@ VARTYPE_Long
for sizing types using native type int
Definition: cVariantType.h:39
@ VARTYPE_NoType
Definition: cVariantType.h:24
@ VARTYPE_Enum
for sizing types using enum {}
Definition: cVariantType.h:34
@ VARTYPE_UInt
Definition: cVariantType.h:33
@ VARTYPE_ULong
Definition: cVariantType.h:40
@ VARTYPE_FLAG_ZERO
shortcut for SerializeOutput() such that it is marked as 0 or empty. NOT the same as VARTYPE_NoType.
Definition: cVariantType.h:42
@ VARTYPE_Int
for sizing types using native C type int
Definition: cVariantType.h:32
@ VARTYPE_QTY
Definition: cVariantType.h:29
char ATOMCHAR_t
the char form (UNICODE or not) for an atom. (for symbolic names)
Definition: StrConst.h:15
@ CTYPE_FLAG_Float
Floating point. double or float.
Definition: cTypes.h:22
@ CTYPE_FLAG_Time
Number represents a time. number of time units from some epoch.
Definition: cTypes.h:23
@ CTYPE_FLAG_NumSigned
a signed numeric value. float or int.
Definition: cTypes.h:21
@ CTYPE_FLAG_StringA
UTF8 format string.
Definition: cTypes.h:26
@ CTYPE_FLAG_Alloc
Contains pointer to allocated memory. variable length? Blob?
Definition: cTypes.h:25
@ CTYPE_FLAG_Numeric
A numeric value of some sort. (maybe time, float or int)
Definition: cTypes.h:20
@ CTYPE_FLAG_StringW
UNICODE format string.
Definition: cTypes.h:27