These days ,I compiled LibreCAD with Visual Studio 2010,
I encountered some problems:Visual Studio 2010 does not support C++99,such as class RS_FileIO { private: //singleton RS_FileIO(); RS_FileIO(RS_FileIO&) = delete; RS_FileIO& operator = (RS_FileIO&) = delete; ..... } these process ,I solved the following problems: msvc complains that more than one overloaded functions matches: std::ofstream << (double) x; msvc complains that it could match both of the following: std::ofstream << double std::ofstream << long double just noted these codes: /* inline ofstream& operator<< (ofstream& ofstr, const DWORD& output) { ofstr.write((char*)&output, sizeof(DWORD)); return ofstr; } inline ifstream& operator>> (ifstream& ifstr, DWORD& input) { ifstr.read((char*)&input, sizeof(DWORD)); return ifstr; } inline ofstream& operator<< (ofstream& ofstr, const WORD& output) { ofstr.write((char*)&output, sizeof(WORD)); return ofstr; } inline ifstream& operator>> (ifstream& ifstr, WORD& input) { ifstr.read((char*)&input, sizeof(WORD)); return ifstr; } inline ofstream& operator<< (ofstream& ofstr, const BYTE& output) { ofstr.write((char*)&output, sizeof(BYTE)); return ofstr; } inline ifstream& operator>> (ifstream& ifstr, BYTE& input) { ifstr.read((char*)&input, sizeof(BYTE)); return ifstr; } inline ofstream& operator<< (ofstream& ofstr, const int& output) { ofstr.write((char*)&output, sizeof(int)); return ofstr; } inline ifstream& operator>> (ifstream& ifstr, int& input) { ifstr.read((char*)&input, sizeof(int)); return ifstr; } class String { private: char* data; size_t size; public: String(const char* str = 0) { if( str ){ data = new char[strlen(str)+1]; strcpy(data, str); size = strlen(str); }else{ data = NULL; size = 0; } } ~String() { if(data) delete data; size = 0; } char* ascii(){return data;} int length(){return size;} String& operator=(String& str) { if(str.length()==0) return *this; if(data) delete data; data = new char[str.length()+1]; strcpy(data, str.ascii()); size = str.size; return *this; } String& operator=(char *str) { if(strlen(str)==0) return *this; if(data) delete data; size = strlen(str); data = new char[size+1]; strcpy(data, str); return *this; } friend inline ofstream& operator<<(ofstream&, const String&); friend inline ifstream& operator>>(ifstream&, String&); friend inline ostream& operator<<(ostream&, const String&); friend inline istream& operator>>(istream&, String&); }; inline ofstream& operator<< (ofstream& ofstr, const String& output) { ofstr.write((char*)&(output.size), sizeof(size_t)); ofstr.write(output.data, output.size); return ofstr; } inline ostream& operator<< (ostream& ostr, const String& output) { return ostr << output.data; } inline ifstream& operator>> (ifstream& ifstr, String& input) { ifstr.read((char*)&(input.size), sizeof(size_t)); input.data = new char[input.size+1]; ifstr.read(input.data, input.size); input.data[input.size] = (char)NULL; return ifstr; } inline istream& operator>> (istream& istr, String& input) { const int maxline = 512; char holder[maxline]; istr.get(holder, maxline, '\n'); input = holder; return istr; } */ |
hi, please supply a patch or a pull Request by GitHub. thanks! dxli
|
Free forum by Nabble | Edit this page |