libUTL++
types.h
1 #pragma once
2 
4 
5 UTL_NS_BEGIN;
6 
8 
9 /*
10  Each of these types has global constants to represent its minimum and maximum values.
11  For example, the minimum and maximum values of \b uint_t are defined by \b uint_t_min and
12  \b uint_t_max, respectively.
13 */
14 
16 // typedefs ////////////////////////////////////////////////////////////////////////////////////////
18 
23 typedef double double_t;
24 
26 
31 typedef unsigned char byte_t;
32 
37 typedef signed char char_t;
38 
40 
45 typedef unsigned short ushort_t;
46 
51 typedef signed short short_t;
52 
54 
59 typedef unsigned int uint_t;
60 
65 typedef signed int int_t;
66 
68 
73 typedef unsigned long ulong_t;
74 
79 typedef signed long long_t;
80 
82 
87 typedef unsigned char uint8_t;
88 
93 typedef signed char int8_t;
94 
96 
101 typedef unsigned short uint16_t;
102 
107 typedef signed short int16_t;
108 
110 
115 typedef unsigned int uint32_t;
116 
121 typedef signed int int32_t;
122 
124 
125 #if UTL_HOST_WORDSIZE == 32
126 
128 
133 typedef unsigned long long uint64_t;
134 
139 typedef long long int64_t;
140 
142 
143 #else // UTL_WORDSIZE == 64
144 
146 
151 #if UTL_HOST_OS == UTL_OS_MINGW
152 typedef unsigned long long uint64_t;
153 #else
154 typedef unsigned long uint64_t;
155 #endif
156 
161 #if UTL_HOST_OS == UTL_OS_MINGW
162 typedef long long int64_t;
163 #else
164 typedef long int64_t;
165 #endif
166 
168 
169 #endif
170 
172 // Minimum and Maximum Values //////////////////////////////////////////////////////////////////////
174 
179 extern const double_t double_t_min;
180 
185 extern const double_t double_t_max;
186 
188 
193 extern const byte_t byte_t_min;
194 
199 extern const byte_t byte_t_max;
200 
205 extern const char_t char_t_min;
206 
211 extern const char_t char_t_max;
212 
214 
219 extern const ushort_t ushort_t_min;
220 
225 extern const ushort_t ushort_t_max;
226 
231 extern const short_t short_t_min;
232 
237 extern const short_t short_t_max;
238 
240 
245 extern const uint_t uint_t_min;
246 
251 extern const uint_t uint_t_max;
252 
257 extern const int_t int_t_min;
258 
263 extern const int_t int_t_max;
264 
266 
271 extern const ulong_t ulong_t_min;
272 
277 extern const ulong_t ulong_t_max;
278 
283 extern const long_t long_t_min;
284 
289 extern const long_t long_t_max;
290 
292 
297 extern const size_t size_t_min;
298 
303 extern const size_t size_t_max;
304 
309 extern const ssize_t ssize_t_min;
310 
315 extern const ssize_t ssize_t_max;
316 
318 
323 extern const uint8_t uint8_t_min;
324 
329 extern const uint8_t uint8_t_max;
330 
335 extern const int8_t int8_t_min;
336 
341 extern const int8_t int8_t_max;
342 
344 
349 extern const uint16_t uint16_t_min;
350 
355 extern const uint16_t uint16_t_max;
356 
361 extern const int16_t int16_t_min;
362 
367 extern const int16_t int16_t_max;
368 
370 
375 extern const uint32_t uint32_t_min;
376 
381 extern const uint32_t uint32_t_max;
382 
387 extern const int32_t int32_t_min;
388 
393 extern const int32_t int32_t_max;
394 
396 
401 extern const uint64_t uint64_t_min;
402 
407 extern const uint64_t uint64_t_max;
408 
413 extern const int64_t int64_t_min;
414 
419 extern const int64_t int64_t_max;
420 
422 // Printf //////////////////////////////////////////////////////////////////////////////////////////
424 
432 
434 template <typename T>
435 struct Printf
436 {
437  static const char* formatType;
438  static const char* formatLength;
439 };
440 
442 
443 UTL_NS_END;
444 
446 
447 // these names may exist in other headers -- prefer UTL versions
448 // (should be defined the same way everywhere)
449 using utl::byte_t; // unsigned char
450 using utl::uint_t; // unsigned integer
451 using utl::ulong_t; // unsigned long
452 using utl::int8_t; // 8-bit signed integer
453 using utl::uint8_t; // 8-bit unsigned integer
454 using utl::int16_t; // 16-bit signed integer
455 using utl::uint16_t; // 16-bit unsigned integer
456 using utl::int32_t; // 32-bit signed integer
457 using utl::uint32_t; // 32-bit unsigned integer
458 using utl::int64_t; // 64-bit signed integer
459 using utl::uint64_t; // 64-bit unsigned integer
const double_t double_t_max
Maximum double_t value.
const short_t short_t_max
Maximum short_t value.
const double_t double_t_min
Minimum double_t value.
const byte_t byte_t_min
Minimum byte_t value.
const uint32_t uint32_t_min
Minimum uint32_t value.
signed int int_t
Signed integer.
Definition: types.h:65
const int64_t int64_t_min
Minimum int64_t value.
const char_t char_t_max
Maximum char_t value.
const int16_t int16_t_max
Maximum int16_t value.
unsigned char uint8_t
Unsigned 8-bit integer.
Definition: types.h:87
signed char char_t
Signed character.
Definition: types.h:37
const size_t size_t_min
Minimum size_t value.
const ushort_t ushort_t_min
Minimum ushort_t value.
const int64_t int64_t_max
Maximum int64_t value.
const int_t int_t_min
Minimum int_t value.
unsigned char byte_t
Unsigned character.
Definition: types.h:31
const uint32_t uint32_t_max
Maximum uint32_t value.
const size_t size_t_max
Maximum size_t value.
const ssize_t ssize_t_min
Minimum ssize_t value.
long int64_t
Signed 64-bit integer.
Definition: types.h:164
unsigned int uint32_t
Unsigned 32-bit integer.
Definition: types.h:115
const uint8_t uint8_t_max
Maximum uint8_t value.
unsigned long uint64_t
Unsigned 64-bit integer.
Definition: types.h:154
const int_t int_t_max
Maximum int_t value.
signed char int8_t
Signed 8-bit integer.
Definition: types.h:93
const long_t long_t_max
Maximum long value.
const int8_t int8_t_max
Maximum int8_t value.
unsigned int uint_t
Unsigned integer.
Definition: types.h:59
signed long long_t
Signed long integer.
Definition: types.h:79
const int16_t int16_t_min
Minimum int16_t value.
const uint_t uint_t_max
Maximum uint_t value.
const ushort_t ushort_t_max
Maximum ushort_t value.
const uint16_t uint16_t_min
Minimum uint16_t value.
signed short short_t
Signed short integer.
Definition: types.h:51
unsigned short ushort_t
Unsigned short integer.
Definition: types.h:45
unsigned short uint16_t
Unsigned 16-bit integer.
Definition: types.h:101
Provide printf formatting strings for common types.
Definition: types.h:435
unsigned long ulong_t
Unsigned long integer.
Definition: types.h:73
signed int int32_t
Signed 32-bit integer.
Definition: types.h:121
const ssize_t ssize_t_max
Maximum ssize_t value.
const uint64_t uint64_t_max
Maximum uint64_t value.
double double_t
Floating-point value.
Definition: types.h:5
const long_t long_t_min
Minimum long value.
const int32_t int32_t_min
Minimum int32_t value.
const ulong_t ulong_t_max
Maximum unsigned long value.
signed short int16_t
Signed 16-bit integer.
Definition: types.h:107
const uint8_t uint8_t_min
Minimum uint8_t value.
const char_t char_t_min
Minimum char_t value.
const byte_t byte_t_max
Maximum byte_t value.
const short_t short_t_min
Minimum short_t value.
const uint64_t uint64_t_min
Minimum uint64_t value.
const int8_t int8_t_min
Minimum int8_t value.
const int32_t int32_t_max
Maximum int32_t value.
const uint16_t uint16_t_max
Maximum uint16_t value.
const uint_t uint_t_min
Minimum uint_t value.
const ulong_t ulong_t_min
Minimum unsigned long value.