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