BALL
1.4.1
|
00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 00005 #ifndef BALL_COMMON_GLOBAL_H 00006 #define BALL_COMMON_GLOBAL_H 00007 00008 #ifndef BALL_CONFIG_CONFIG_H 00009 # include <BALL/CONFIG/config.h> 00010 #endif 00011 00012 #include <limits.h> 00013 #include <time.h> 00014 00015 #ifdef BALL_HAS_BASETSD_H 00016 # include <basetsd.h> 00017 #endif 00018 00019 // If possible use the ISO C99-compliant header stdint.h 00020 // to define the portable integer types. 00021 #ifdef BALL_HAS_STDINT_H 00022 # include <stdint.h> 00023 #endif 00024 00025 #ifdef BALL_COMPILER_MSVC 00026 # define BALL_HIDE 00027 # ifdef BALL_BUILD_DLL 00028 # define BALL_EXPORT __declspec(dllexport) 00029 # define BALL_EXTERN_VARIABLE __declspec(dllexport) extern 00030 # else 00031 # define BALL_EXPORT __declspec(dllimport) 00032 # define BALL_EXTERN_VARIABLE __declspec(dllimport) extern 00033 # endif 00034 # ifdef BALL_VIEW_BUILD_DLL 00035 # define BALL_VIEW_EXPORT __declspec(dllexport) 00036 # else 00037 # define BALL_VIEW_EXPORT __declspec(dllimport) 00038 # endif 00039 #elif defined(BALL_COMPILER_GXX) && (BALL_COMPILER_VERSION_MAJOR > 4 || (BALL_COMPILER_VERSION_MAJOR == 4 && BALL_COMPILER_VERSION_MINOR >= 3)) 00040 # define BALL_EXPORT __attribute((visibility ("default"))) 00041 # define BALL_HIDE __attribute((visibility ("hidden"))) 00042 # define BALL_VIEW_EXPORT __attribute((visibility ("default"))) 00043 # define BALL_EXTERN_VARIABLE extern __attribute((visibility ("default"))) 00044 #else 00045 # define BALL_EXPORT 00046 # define BALL_HIDE 00047 # define BALL_VIEW_EXPORT 00048 # define BALL_EXTERN_VARIABLE extern 00049 #endif 00050 00051 //This declares a BALL_DEPRECATED macro that can be used to mark deprecated api 00052 //It is essentially copied from Qt 4.4.1 but simplified, thus there might be 00053 //some cases where it does not work as expected, yet. 00054 #if defined(BALL_COMPILER_MSVC) && (_MSC_VER >= 1300) 00055 #define BALL_DEPRECATED __declspec(deprecated) 00056 #elif defined(BALL_COMPILER_GXX) && (BALL_COMPILER_VERSION_MAJOR - 0 > 3 || (BALL_COMPILER_VERSION_MAJOR - 0 == 3 && BALL_COMPILER_VERSION_MINOR - 0 >= 2)) 00057 #define BALL_DEPRECATED __attribute__((deprecated)) 00058 #else 00059 #define BALL_DEPRECATED 00060 #endif 00061 00062 namespace BALL 00063 { 00064 00065 typedef int (*ComparatorType)(const void *, const void *); 00066 00074 00081 typedef BALL_INDEX_TYPE Distance; 00082 00091 typedef BALL_SIZE_TYPE Handle; 00092 00100 typedef BALL_INDEX_TYPE Index; 00101 00109 typedef BALL_SIZE_TYPE Size; 00110 00118 typedef time_t Time; 00119 00126 typedef BALL_SIZE_TYPE HashIndex; 00127 00135 typedef BALL_SIZE_TYPE Position; 00136 00143 typedef float Real; 00144 00151 typedef double DoubleReal; 00152 00160 typedef BALL_SIZE_TYPE Property; 00161 00168 typedef BALL_INDEX_TYPE ErrorCode; 00169 00170 00178 typedef unsigned char Byte; 00179 00187 typedef BALL_ULONG64_TYPE LongSize; 00188 00196 typedef BALL_LONG64_TYPE LongIndex; 00197 00202 typedef BALL_POINTERSIZEUINT_TYPE PointerSizeUInt; 00203 00205 00206 enum ASCII 00207 { 00208 ASCII__BACKSPACE = '\b', 00209 ASCII__BELL = '\a', 00210 ASCII__CARRIAGE_RETURN = '\r', 00211 ASCII__HORIZONTAL_TAB = '\t', 00212 ASCII__NEWLINE = '\n', 00213 ASCII__RETURN = ASCII__NEWLINE, 00214 ASCII__SPACE = ' ', 00215 ASCII__TAB = ASCII__HORIZONTAL_TAB, 00216 ASCII__VERTICAL_TAB = '\v', 00217 00218 ASCII__COLON = ':', 00219 ASCII__COMMA = ',', 00220 ASCII__EXCLAMATION_MARK = '!', 00221 ASCII__POINT = '.', 00222 ASCII__QUESTION_MARK = '?', 00223 ASCII__SEMICOLON = ';' 00224 }; 00225 00226 static const Distance INVALID_DISTANCE = INT_MIN; 00227 static const Distance DISTANCE_MIN = (INT_MIN + 1); 00228 static const Distance DISTANCE_MAX = INT_MAX; 00229 00230 static const Handle INVALID_HANDLE = INT_MAX; 00231 static const Handle HANDLE_MIN = 0 ; 00232 static const Handle HANDLE_MAX = INT_MAX - 1; 00233 00234 static const Index INVALID_INDEX = -1; 00235 static const Index INDEX_MIN = 0; 00236 static const Index INDEX_MAX = INT_MAX; 00237 00238 static const Position INVALID_POSITION = INT_MAX; 00239 static const Position POSITION_MIN = 0; 00240 static const Position POSITION_MAX = INT_MAX - 1; 00241 00242 # undef SIZE_MAX 00243 static const Size INVALID_SIZE = INT_MAX; 00244 static const Size SIZE_MIN = 0; 00245 static const Size SIZE_MAX = INT_MAX - 1; 00246 00247 00248 } 00249 00250 #endif // BALL_COMMON_GLOBAL_H