32 #ifndef CPL_BASE_H_INCLUDED 33 #define CPL_BASE_H_INCLUDED 45 #if defined(_WIN32) && !defined(WIN32) 49 #if defined(_WINDOWS) && !defined(WIN32) 58 # ifndef _CRT_SECURE_NO_DEPRECATE 59 # define _CRT_SECURE_NO_DEPRECATE 61 # ifndef _CRT_NONSTDC_NO_DEPRECATE 62 # define _CRT_NONSTDC_NO_DEPRECATE 66 #include "cpl_config.h" 73 #if !defined(SIZEOF_INT) || SIZEOF_INT != 4 74 #error "Unexpected value for SIZEOF_INT" 77 #if !defined(SIZEOF_UNSIGNED_LONG) || (SIZEOF_UNSIGNED_LONG != 4 && SIZEOF_UNSIGNED_LONG != 8) 78 #error "Unexpected value for SIZEOF_UNSIGNED_LONG" 81 #if !defined(SIZEOF_VOIDP) || (SIZEOF_VOIDP != 4 && SIZEOF_VOIDP != 8) 82 #error "Unexpected value for SIZEOF_VOIDP" 95 #if defined(VSI_NEED_LARGEFILE64_SOURCE) && !defined(_LARGEFILE64_SOURCE) 96 # define _LARGEFILE64_SOURCE 1 105 #if defined(HAVE_ICONV) 106 # define CPL_RECODE_ICONV 109 #define CPL_RECODE_STUB 118 #if defined(__MINGW32__) 119 #ifndef __MSVCRT_VERSION__ 120 #define __MSVCRT_VERSION__ 0x0601 138 #if defined(HAVE_ERRNO_H) 151 # include <strings.h> 154 #if defined(HAVE_LIBDBMALLOC) && defined(HAVE_DBMALLOC_H) && defined(DEBUG) 156 # include <dbmalloc.h> 159 #if !defined(DBMALLOC) && defined(HAVE_DMALLOC_H) 161 # include <dmalloc.h> 174 # if __cplusplus >= 201103L 175 # define HAVE_CXX11 1 183 #if UINT_MAX == 65535 185 typedef unsigned long GUInt32;
188 typedef unsigned int GUInt32;
191 typedef short GInt16;
192 typedef unsigned short GUInt16;
193 typedef unsigned char GByte;
196 #ifndef CPL_GBOOL_DEFINED 197 #define CPL_GBOOL_DEFINED 205 #if defined(WIN32) && defined(_MSC_VER) 207 #define VSI_LARGE_API_SUPPORTED 208 typedef __int64 GIntBig;
209 typedef unsigned __int64 GUIntBig;
211 #define GINTBIG_MIN ((GIntBig)(0x80000000) << 32) 212 #define GINTBIG_MAX (((GIntBig)(0x7FFFFFFF) << 32) | 0xFFFFFFFFU) 213 #define GUINTBIG_MAX (((GUIntBig)(0xFFFFFFFFU) << 32) | 0xFFFFFFFFU) 217 typedef long long GIntBig;
218 typedef unsigned long long GUIntBig;
220 #define GINTBIG_MIN ((GIntBig)(0x80000000) << 32) 221 #define GINTBIG_MAX (((GIntBig)(0x7FFFFFFF) << 32) | 0xFFFFFFFFU) 222 #define GUINTBIG_MAX (((GUIntBig)(0xFFFFFFFFU) << 32) | 0xFFFFFFFFU) 226 typedef long GIntBig;
227 typedef unsigned long GUIntBig;
229 #define GINTBIG_MIN INT_MIN 230 #define GINTBIG_MAX INT_MAX 231 #define GUINTBIG_MAX UINT_MAX 234 #if SIZEOF_VOIDP == 8 235 typedef GIntBig GPtrDiff_t;
237 typedef int GPtrDiff_t;
240 #if defined(__MSVCRT__) || (defined(WIN32) && defined(_MSC_VER)) 241 #define CPL_FRMT_GB_WITHOUT_PREFIX "I64" 243 #define CPL_FRMT_GB_WITHOUT_PREFIX "ll" 245 #define CPL_FRMT_GB_WITHOUT_PREFIX "l" 248 #define CPL_FRMT_GIB "%" CPL_FRMT_GB_WITHOUT_PREFIX "d" 249 #define CPL_FRMT_GUIB "%" CPL_FRMT_GB_WITHOUT_PREFIX "u" 252 #if defined(_MSC_VER) && (_MSC_VER <= 1200) 253 #define GUINTBIG_TO_DOUBLE(x) (double)(GIntBig)(x) 255 #define GUINTBIG_TO_DOUBLE(x) (double)(x) 258 #ifdef COMPAT_WITH_ICC_CONVERSION_CHECK 259 #define CPL_INT64_FITS_ON_INT32(x) ((x) >= INT_MIN && (x) <= INT_MAX) 261 #define CPL_INT64_FITS_ON_INT32(x) (((GIntBig)(int)(x)) == (x)) 268 # define CPL_C_START extern "C" { 276 #if defined(_MSC_VER) && !defined(CPL_DISABLE_DLL) 277 # define CPL_DLL __declspec(dllexport) 279 # if defined(USE_GCC_VISIBILITY_FLAG) 280 # define CPL_DLL __attribute__ ((visibility("default"))) 288 #ifdef CPL_OPTIONAL_APIS 289 # define CPL_ODLL CPL_DLL 295 #if defined(_MSC_VER) && !defined(CPL_DISABLE_STDCALL) 296 # define CPL_STDCALL __stdcall 303 # define FORCE_CDECL __cdecl 309 #if (defined(__GNUC__) && !defined(__NO_INLINE__)) || defined(_MSC_VER) 310 #define HAS_CPL_INLINE 1 311 #define CPL_INLINE __inline 312 #elif defined(__SUNPRO_CC) 313 #define HAS_CPL_INLINE 1 314 #define CPL_INLINE inline 321 #if defined(NULL_AS_NULLPTR) && HAVE_CXX11 329 #include <sys/types.h> 334 #include <sys/mman.h> 365 # define MIN(a,b) ((a<b) ? a : b) 366 # define MAX(a,b) ((a>b) ? a : b) 370 # define ABS(x) ((x<0) ? (-1*(x)) : x) 374 # define M_PI 3.14159265358979323846 384 # define CPLIsEqual(x,y) (fabs((x) - (y)) < 0.0000000000001) 392 #if defined(AFL_FRIENDLY) && defined(__GNUC__) 394 static inline int CPL_afl_friendly_memcmp(
const void* ptr1,
const void* ptr2,
size_t len)
395 __attribute__((always_inline));
397 static inline int CPL_afl_friendly_memcmp(
const void* ptr1,
const void* ptr2,
size_t len)
399 const unsigned char* bptr1 = (
const unsigned char*)ptr1;
400 const unsigned char* bptr2 = (
const unsigned char*)ptr2;
403 unsigned char b1 = *(bptr1++);
404 unsigned char b2 = *(bptr2++);
405 if( b1 != b2 )
return b1 - b2;
410 static inline int CPL_afl_friendly_strcmp(
const char* ptr1,
const char* ptr2)
411 __attribute__((always_inline));
413 static inline int CPL_afl_friendly_strcmp(
const char* ptr1,
const char* ptr2)
415 const unsigned char* usptr1 = (
const unsigned char*)ptr1;
416 const unsigned char* usptr2 = (
const unsigned char*)ptr2;
419 unsigned char ch1 = *(usptr1++);
420 unsigned char ch2 = *(usptr2++);
421 if( ch1 == 0 || ch1 != ch2 )
return ch1 - ch2;
425 static inline int CPL_afl_friendly_strncmp(
const char* ptr1,
const char* ptr2,
size_t len)
426 __attribute__((always_inline));
428 static inline int CPL_afl_friendly_strncmp(
const char* ptr1,
const char* ptr2,
size_t len)
430 const unsigned char* usptr1 = (
const unsigned char*)ptr1;
431 const unsigned char* usptr2 = (
const unsigned char*)ptr2;
434 unsigned char ch1 = *(usptr1++);
435 unsigned char ch2 = *(usptr2++);
436 if( ch1 == 0 || ch1 != ch2 )
return ch1 - ch2;
441 static inline int CPL_afl_friendly_strcasecmp(
const char* ptr1,
const char* ptr2)
442 __attribute__((always_inline));
444 static inline int CPL_afl_friendly_strcasecmp(
const char* ptr1,
const char* ptr2)
446 const unsigned char* usptr1 = (
const unsigned char*)ptr1;
447 const unsigned char* usptr2 = (
const unsigned char*)ptr2;
450 unsigned char ch1 = *(usptr1++);
451 unsigned char ch2 = *(usptr2++);
452 ch1 = (
unsigned char)toupper(ch1);
453 ch2 = (
unsigned char)toupper(ch2);
454 if( ch1 == 0 || ch1 != ch2 )
return ch1 - ch2;
458 static inline int CPL_afl_friendly_strncasecmp(
const char* ptr1,
const char* ptr2,
size_t len)
459 __attribute__((always_inline));
461 static inline int CPL_afl_friendly_strncasecmp(
const char* ptr1,
const char* ptr2,
size_t len)
463 const unsigned char* usptr1 = (
const unsigned char*)ptr1;
464 const unsigned char* usptr2 = (
const unsigned char*)ptr2;
467 unsigned char ch1 = *(usptr1++);
468 unsigned char ch2 = *(usptr2++);
469 ch1 = (
unsigned char)toupper(ch1);
470 ch2 = (
unsigned char)toupper(ch2);
471 if( ch1 == 0 || ch1 != ch2 )
return ch1 - ch2;
476 static inline char* CPL_afl_friendly_strstr(
const char* haystack,
const char* needle)
477 __attribute__((always_inline));
479 static inline char* CPL_afl_friendly_strstr(
const char* haystack,
const char* needle)
481 const char* ptr_haystack = haystack;
484 const char* ptr_haystack2 = ptr_haystack;
485 const char* ptr_needle = needle;
488 char ch1 = *(ptr_haystack2++);
489 char ch2 = *(ptr_needle++);
491 return (
char*)ptr_haystack;
495 if( *ptr_haystack == 0 )
503 #define memcmp CPL_afl_friendly_memcmp 504 #define strcmp CPL_afl_friendly_strcmp 505 #define strncmp CPL_afl_friendly_strncmp 506 #define strcasecmp CPL_afl_friendly_strcasecmp 507 #define strncasecmp CPL_afl_friendly_strncasecmp 508 #define strstr CPL_afl_friendly_strstr 513 # define STRCASECMP(a,b) (stricmp(a,b)) 514 # define STRNCASECMP(a,b,n) (strnicmp(a,b,n)) 516 # define STRCASECMP(a,b) (strcasecmp(a,b)) 517 # define STRNCASECMP(a,b,n) (strncasecmp(a,b,n)) 519 # define EQUALN(a,b,n) (STRNCASECMP(a,b,n)==0) 520 # define EQUAL(a,b) (STRCASECMP(a,b)==0) 527 #ifndef STARTS_WITH_CI 528 #define STARTS_WITH(a,b) (strncmp(a,b,strlen(b)) == 0) 529 #define STARTS_WITH_CI(a,b) EQUALN(a,b,strlen(b)) 532 #ifndef CPL_THREADLOCAL 533 # define CPL_THREADLOCAL 547 # define CPLIsNan(x) _isnan(x) 548 # define CPLIsInf(x) (!_isnan(x) && !_finite(x)) 549 # define CPLIsFinite(x) _finite(x) 551 # define CPLIsNan(x) isnan(x) 553 # define CPLIsInf(x) isinf(x) 554 # define CPLIsFinite(x) (!isnan(x) && !isinf(x)) 555 # elif defined(__sun__) 557 # define CPLIsInf(x) (!finite(x) && !isnan(x)) 558 # define CPLIsFinite(x) finite(x) 560 # define CPLIsInf(x) (0) 561 # define CPLIsFinite(x) (!isnan(x)) 572 #if defined(WORDS_BIGENDIAN) && !defined(CPL_MSB) && !defined(CPL_LSB) 576 #if ! ( defined(CPL_LSB) || defined(CPL_MSB) ) 581 # define CPL_IS_LSB 1 583 # define CPL_IS_LSB 0 593 static void my_function() {}
598 #define CPL_STATIC_ASSERT(x) CPLStaticAssert<x>::my_function() 599 #define CPL_STATIC_ASSERT_IF_AVAILABLE(x) CPL_STATIC_ASSERT(x) 603 #define CPL_STATIC_ASSERT_IF_AVAILABLE(x) 611 #define CPL_SWAP16(x) \ 613 (((GUInt16)(x) & 0x00ffU) << 8) | \ 614 (((GUInt16)(x) & 0xff00U) >> 8) )) 616 #define CPL_SWAP16PTR(x) \ 618 GByte byTemp, *_pabyDataT = (GByte *) (x); \ 619 CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2); \ 621 byTemp = _pabyDataT[0]; \ 622 _pabyDataT[0] = _pabyDataT[1]; \ 623 _pabyDataT[1] = byTemp; \ 626 #define CPL_SWAP32(x) \ 628 (((GUInt32)(x) & (GUInt32)0x000000ffUL) << 24) | \ 629 (((GUInt32)(x) & (GUInt32)0x0000ff00UL) << 8) | \ 630 (((GUInt32)(x) & (GUInt32)0x00ff0000UL) >> 8) | \ 631 (((GUInt32)(x) & (GUInt32)0xff000000UL) >> 24) )) 633 #define CPL_SWAP32PTR(x) \ 635 GByte byTemp, *_pabyDataT = (GByte *) (x); \ 636 CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4); \ 638 byTemp = _pabyDataT[0]; \ 639 _pabyDataT[0] = _pabyDataT[3]; \ 640 _pabyDataT[3] = byTemp; \ 641 byTemp = _pabyDataT[1]; \ 642 _pabyDataT[1] = _pabyDataT[2]; \ 643 _pabyDataT[2] = byTemp; \ 646 #define CPL_SWAP64PTR(x) \ 648 GByte byTemp, *_pabyDataT = (GByte *) (x); \ 649 CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8); \ 651 byTemp = _pabyDataT[0]; \ 652 _pabyDataT[0] = _pabyDataT[7]; \ 653 _pabyDataT[7] = byTemp; \ 654 byTemp = _pabyDataT[1]; \ 655 _pabyDataT[1] = _pabyDataT[6]; \ 656 _pabyDataT[6] = byTemp; \ 657 byTemp = _pabyDataT[2]; \ 658 _pabyDataT[2] = _pabyDataT[5]; \ 659 _pabyDataT[5] = byTemp; \ 660 byTemp = _pabyDataT[3]; \ 661 _pabyDataT[3] = _pabyDataT[4]; \ 662 _pabyDataT[4] = byTemp; \ 682 #define CPL_SWAPDOUBLE(p) CPL_SWAP64PTR(p) 685 # define CPL_MSBWORD16(x) (x) 686 # define CPL_LSBWORD16(x) CPL_SWAP16(x) 687 # define CPL_MSBWORD32(x) (x) 688 # define CPL_LSBWORD32(x) CPL_SWAP32(x) 689 # define CPL_MSBPTR16(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2) 690 # define CPL_LSBPTR16(x) CPL_SWAP16PTR(x) 691 # define CPL_MSBPTR32(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4) 692 # define CPL_LSBPTR32(x) CPL_SWAP32PTR(x) 693 # define CPL_MSBPTR64(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8) 694 # define CPL_LSBPTR64(x) CPL_SWAP64PTR(x) 696 # define CPL_LSBWORD16(x) (x) 697 # define CPL_MSBWORD16(x) CPL_SWAP16(x) 698 # define CPL_LSBWORD32(x) (x) 699 # define CPL_MSBWORD32(x) CPL_SWAP32(x) 700 # define CPL_LSBPTR16(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2) 701 # define CPL_MSBPTR16(x) CPL_SWAP16PTR(x) 702 # define CPL_LSBPTR32(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4) 703 # define CPL_MSBPTR32(x) CPL_SWAP32PTR(x) 704 # define CPL_LSBPTR64(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8) 705 # define CPL_MSBPTR64(x) CPL_SWAP64PTR(x) 709 #define CPL_LSBINT16PTR(x) ((*(GByte*)(x)) | (*(((GByte*)(x))+1) << 8)) 712 #define CPL_LSBINT32PTR(x) ((*(GByte*)(x)) | (*(((GByte*)(x))+1) << 8) | \ 713 (*(((GByte*)(x))+2) << 16) | (*(((GByte*)(x))+3) << 24)) 716 #define CPL_LSBSINT16PTR(x) ((GInt16) CPL_LSBINT16PTR(x)) 719 #define CPL_LSBUINT16PTR(x) ((GUInt16)CPL_LSBINT16PTR(x)) 722 #define CPL_LSBSINT32PTR(x) ((GInt32) CPL_LSBINT32PTR(x)) 725 #define CPL_LSBUINT32PTR(x) ((GUInt32)CPL_LSBINT32PTR(x)) 729 #ifndef UNREFERENCED_PARAM 730 # ifdef UNREFERENCED_PARAMETER 731 # define UNREFERENCED_PARAM(param) UNREFERENCED_PARAMETER(param) 733 # define UNREFERENCED_PARAM(param) ((void)param) 745 #ifndef DISABLE_CVSID 746 #if defined(__GNUC__) && __GNUC__ >= 4 747 # define CPL_CVSID(string) static const char cpl_cvsid[] __attribute__((used)) = string; 749 # define CPL_CVSID(string) static const char cpl_cvsid[] = string; \ 750 static const char *cvsid_aw() { return( cvsid_aw() ? NULL : cpl_cvsid ); } 753 # define CPL_CVSID(string) 758 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP) && !(defined(__MINGW64__) && __GNUC__ == 4 && __GNUC_MINOR__ == 6) 759 # define CPL_NULL_TERMINATED __attribute__((__sentinel__)) 761 # define CPL_NULL_TERMINATED 764 #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(DOXYGEN_SKIP) 765 #define CPL_PRINT_FUNC_FORMAT( format_idx, arg_idx ) __attribute__((__format__ (__printf__, format_idx, arg_idx))) 766 #define CPL_SCAN_FUNC_FORMAT( format_idx, arg_idx ) __attribute__((__format__ (__scanf__, format_idx, arg_idx))) 768 #define CPL_PRINT_FUNC_FORMAT( format_idx, arg_idx ) 769 #define CPL_SCAN_FUNC_FORMAT( format_idx, arg_idx ) 772 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP) 773 #define CPL_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) 775 #define CPL_WARN_UNUSED_RESULT 778 #if defined(__GNUC__) && __GNUC__ >= 4 779 # define CPL_UNUSED __attribute((__unused__)) 785 #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(DOXYGEN_SKIP) 786 #define CPL_NO_RETURN __attribute__((noreturn)) 788 #define CPL_NO_RETURN 792 #ifndef __has_attribute 793 #define __has_attribute(x) 0 // Compatibility with non-clang compilers. 796 #if ((defined(__GNUC__) && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9))) || __has_attribute(returns_nonnull)) && !defined(DOXYGEN_SKIP) 797 # define CPL_RETURNS_NONNULL __attribute__((returns_nonnull)) 799 # define CPL_RETURNS_NONNULL 803 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP) 804 #define CPL_RESTRICT __restrict__ 817 # define CPL_FINAL final 818 # define CPL_DISALLOW_COPY_ASSIGN(ClassName) \ 819 ClassName( const ClassName & ) = delete; \ 820 ClassName &operator=( const ClassName & ) = delete; 823 # define CPL_DISALLOW_COPY_ASSIGN(ClassName) \ 824 ClassName( const ClassName & ); \ 825 ClassName &operator=( const ClassName & ); 830 #if !defined(DOXYGEN_SKIP) 831 #if defined(__has_extension) 832 #if __has_extension(attribute_deprecated_with_message) 834 #define CPL_WARN_DEPRECATED(x) __attribute__ ((deprecated(x))) 836 #define CPL_WARN_DEPRECATED(x) 838 #elif defined(__GNUC__) 839 #define CPL_WARN_DEPRECATED(x) __attribute__ ((deprecated)) 841 #define CPL_WARN_DEPRECATED(x) 845 #if !defined(_MSC_VER) && !defined(__APPLE__) 847 #ifdef WARN_STANDARD_PRINTF 848 int vsnprintf(
char *str,
size_t size,
const char* fmt, va_list args) CPL_WARN_DEPRECATED(
"Use CPLvsnprintf() instead");
849 int snprintf(
char *str,
size_t size,
const char* fmt, ...) CPL_PRINT_FUNC_FORMAT(3,4) CPL_WARN_DEPRECATED("Use
CPLsnprintf() instead");
850 int sprintf(
char *str, const
char* fmt, ...) CPL_PRINT_FUNC_FORMAT(2, 3) CPL_WARN_DEPRECATED("Use
CPLsnprintf() instead");
851 #elif defined(GDAL_COMPILATION) && !defined(DONT_DEPRECATE_SPRINTF) 852 int sprintf(
char *str,
const char* fmt, ...) CPL_PRINT_FUNC_FORMAT(2, 3) CPL_WARN_DEPRECATED("Use snprintf() or
CPLsnprintf() instead");
857 #if defined(MAKE_SANITIZE_HAPPY) || !(defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)) 858 #define CPL_CPU_REQUIRES_ALIGNED_ACCESS 859 #define CPL_IS_DOUBLE_A_INT(d) ( (d) >= INT_MIN && (d) <= INT_MAX && (double)(int)(d) == (d) ) 862 #define CPL_IS_DOUBLE_A_INT(d) ( (double)(int)(d) == (d) ) 867 #define CPL_ARRAYSIZE(array) \ 868 ((sizeof(array) / sizeof(*(array))) / \ 869 static_cast<size_t>(!(sizeof(array) % sizeof(*(array))))) 872 template<
class T>
static void CPL_IGNORE_RET_VAL(T) {}
873 inline static bool CPL_TO_BOOL(
int x) {
return x != 0; }
878 #if (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) || (defined(__clang__) && __clang_major__ >= 3)) && !defined(_MSC_VER)) 879 #define HAVE_GCC_DIAGNOSTIC_PUSH 882 #if ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) && !defined(_MSC_VER)) 883 #define HAVE_GCC_SYSTEM_HEADER 886 #if defined(__clang__) 887 # define CPL_FALLTHROUGH [[clang::fallthrough]]; 889 # define CPL_FALLTHROUGH 896 #if defined(__cplusplus) && defined(DEBUG_BOOL) && !defined(DO_NOT_USE_DEBUG_BOOL) 898 class MSVCPedanticBool
901 friend bool operator== (
const bool& one,
const MSVCPedanticBool& other);
902 friend bool operator!= (
const bool& one,
const MSVCPedanticBool& other);
905 MSVCPedanticBool(
int bIn);
910 MSVCPedanticBool() {}
911 MSVCPedanticBool(
bool bIn) : b(bIn) {}
912 MSVCPedanticBool(
const MSVCPedanticBool& other) : b(other.b) {}
914 MSVCPedanticBool& operator= (
const MSVCPedanticBool& other) { b = other.b;
return *
this; }
915 MSVCPedanticBool& operator&= (
const MSVCPedanticBool& other) { b &= other.b;
return *
this; }
916 MSVCPedanticBool& operator|= (
const MSVCPedanticBool& other) { b |= other.b;
return *
this; }
918 bool operator== (
const bool& other)
const {
return b == other; }
919 bool operator!= (
const bool& other)
const {
return b != other; }
920 bool operator== (
const MSVCPedanticBool& other)
const {
return b == other.b; }
921 bool operator!= (
const MSVCPedanticBool& other)
const {
return b != other.b; }
923 bool operator! ()
const {
return !b; }
924 operator bool()
const {
return b; }
925 operator int()
const {
return b; }
928 inline bool operator== (
const bool& one,
const MSVCPedanticBool& other) {
return one == other.b; }
929 inline bool operator!= (
const bool& one,
const MSVCPedanticBool& other) {
return one != other.b; }
950 #define EMULATED_BOOL int 953 #define bool MSVCPedanticBool 957 #define VOLATILE_BOOL bool 969 #define EMULATED_BOOL bool 970 #define VOLATILE_BOOL volatile bool Definition: cpl_port.h:590
int CPLsnprintf(char *str, size_t size, const char *fmt,...)
Definition: cpl_string.cpp:1305