00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef CAL_PLATFORM_H
00012 #define CAL_PLATFORM_H
00013
00014
00015
00016
00017
00018 #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
00019 #pragma warning(disable : 4251)
00020 #pragma warning(disable : 4786)
00021 #endif
00022
00023 #if !defined(_WIN32) || defined(__MINGW32__) || defined(__CYGWIN__)
00024 #define stricmp strcasecmp
00025 #endif
00026
00027
00028
00029
00030
00031
00032 #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
00033
00034 #ifndef CAL3D_API
00035 #ifdef CAL3D_EXPORTS
00036 #define CAL3D_API __declspec(dllexport)
00037 #else
00038 #define CAL3D_API __declspec(dllimport)
00039 #endif
00040 #endif
00041
00042 #else
00043
00044 #define CAL3D_API
00045
00046 #endif
00047
00048
00049
00050
00051
00052 #if defined(__i386__) || \
00053 defined(__ia64__) || \
00054 defined(WIN32) || \
00055 defined(__alpha__) || defined(__alpha) || \
00056 defined(__arm__) || \
00057 (defined(__mips__) && defined(__MIPSEL__)) || \
00058 defined(__SYMBIAN32__) || \
00059 defined(__x86_64__) || \
00060 defined(__LITTLE_ENDIAN__)
00061
00062 #define CAL3D_LITTLE_ENDIAN
00063
00064 #else
00065
00066 #define CAL3D_BIG_ENDIAN
00067
00068 #endif
00069
00070
00071
00072
00073
00074
00075 #include <stdlib.h>
00076 #include <math.h>
00077
00078
00079 #include <assert.h>
00080
00081
00082 #include <iostream>
00083 #include <fstream>
00084 #include <sstream>
00085 #include <string>
00086 #include <vector>
00087 #include <list>
00088 #include <map>
00089
00090
00091
00092
00093
00094
00098 class CAL3D_API CalPlatform
00099 {
00100
00101 protected:
00102 CalPlatform();
00103 virtual ~CalPlatform();
00104
00105
00106 public:
00107 static bool readBytes(std::istream& input, void *pBuffer, int length);
00108 static bool readFloat(std::istream& input, float& value);
00109 static bool readInteger(std::istream& input, int& value);
00110 static bool readString(std::istream& input, std::string& strValue);
00111
00112 static bool readBytes(char* input, void *pBuffer, int length);
00113 static bool readFloat(char* input, float& value);
00114 static bool readInteger(char* input, int& value);
00115 static bool readString(char* input, std::string& strValue);
00116
00117 static bool writeBytes(std::ostream& output, const void *pBuffer, int length);
00118 static bool writeFloat(std::ostream& output, float value);
00119 static bool writeInteger(std::ostream& output, int value);
00120 static bool writeString(std::ostream& output, const std::string& strValue);
00121 };
00122
00123 #endif
00124
00125