00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #define MOCKPP_NEED_EXPORTS
00031 #include <mockpp/mockpp.h>
00032
00033 #include <cstdlib>
00034
00035 MOCKPP_NS_START
00036
00037
00038 MOCKPP_API_IMPL(void)
00039 getVersion (int &major, int &minor, int &patch,
00040 bool &debug, MOCKPP_STL::string &info)
00041 {
00042 MOCKPP_STL::string s = MOCKPP_VERSION;
00043 MOCKPP_STL::string num;
00044 info = "";
00045
00046 MOCKPP_STD_NS::size_t pos = s.find('.');
00047 bool good = true;
00048 if (pos != MOCKPP_STL::string::npos)
00049 {
00050 num = s.substr(0, pos);
00051 if (num.length() == 0)
00052 good = false;
00053 #ifdef _MSC_VER_60_70 // MAT using namespace std; instead ? EA: no :-)
00054 major = atoi(num.c_str());
00055 #else
00056 major = MOCKPP_STD_NS::atoi(num.c_str());
00057 #endif
00058 s.erase(0, pos+1);
00059 pos = s.find('.');
00060
00061 if (pos != MOCKPP_STL::string::npos)
00062 {
00063 num = s.substr(0, pos);
00064 if (num.length() == 0)
00065 good = false;
00066 #ifdef _MSC_VER_60_70
00067 minor = atoi(num.c_str());
00068 #else
00069 minor = MOCKPP_STD_NS::atoi(num.c_str());
00070 #endif
00071 s.erase(0, pos+1);
00072
00073 if (s.length() == 0)
00074 good = false;
00075 #ifdef _MSC_VER_60_70
00076 patch = atoi(s.c_str());
00077 #else
00078 patch = MOCKPP_STD_NS::atoi(s.c_str());
00079 #endif
00080 }
00081 else
00082 good = false;
00083 }
00084 else
00085 good = false;
00086
00087 if (!good)
00088 {
00089 major = -1;
00090 minor = -1;
00091 patch = -1;
00092 info = "";
00093 }
00094
00095 #ifdef DEBUG
00096 debug = true;
00097 #else
00098 debug = false;
00099 #endif
00100 }
00101
00102
00103 #ifdef MOCKPP_UNICODE
00104
00105 MOCKPP_API_IMPL(MOCKPP_STL::basic_string<wchar_t>) getUnicode(const MOCKPP_STL::string &latin1)
00106 {
00107 MOCKPP_STL::basic_string<wchar_t> ret;
00108 for (unsigned i = 0; i < latin1.length(); ++i)
00109 ret += (wchar_t) latin1[i];
00110
00111 return ret;
00112 }
00113
00114
00115 MOCKPP_API_IMPL(MOCKPP_STL::string) getLatin1(const MOCKPP_STL::basic_string<wchar_t> &uni)
00116 {
00117 MOCKPP_STL::string ret;
00118 for (unsigned i = 0; i < uni.length(); ++i)
00119 ret += (MOCKPP_NS::Char) uni[i];
00120
00121 return ret;
00122 }
00123
00124 #endif
00125
00129 extern AssertionFailedForwarder_t forwardAssertionFailed;
00130
00131
00132 MOCKPP_API_IMPL(AssertionFailedForwarder_t)
00133 setAssertionFailedForwarder(AssertionFailedForwarder_t fwd)
00134 {
00135 AssertionFailedForwarder_t temp = forwardAssertionFailed;
00136 forwardAssertionFailed = fwd;
00137 return temp;
00138 }
00139
00140
00141 MOCKPP_NS_END