From 58973a21a30bf95427fd43c456e41e35c386218c Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Fri, 15 Jun 2012 18:52:16 +0000 Subject: another portion of "#ifsef Unicode" removal git-svn-id: http://svn.miranda-ng.org/main/trunk@434 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Boltun/Engine/Mind.cpp | 22 ++++++++++------------ plugins/Boltun/Engine/Mind.h | 3 +-- plugins/Boltun/Engine/MyCodeCvt.cpp | 4 ---- 3 files changed, 11 insertions(+), 18 deletions(-) (limited to 'plugins/Boltun/Engine') diff --git a/plugins/Boltun/Engine/Mind.cpp b/plugins/Boltun/Engine/Mind.cpp index 667e1faf1a..fc4520de55 100644 --- a/plugins/Boltun/Engine/Mind.cpp +++ b/plugins/Boltun/Engine/Mind.cpp @@ -26,9 +26,7 @@ #include -#ifdef UNICODE #include "MyCodeCvt.h" -#endif using namespace std; @@ -108,19 +106,19 @@ void Mind::Load(tstring filename) { basic_ifstream > file; setlocale(LC_ALL, ""); -#ifdef UNICODE + locale ulocale(locale(), new MyCodeCvt); file.imbue(ulocale); -#endif + file.open(filename.c_str(), ios_base::in | ios_base::binary); tstring s1, st; TCHAR *c, *co; size_t count; int error = 0; int line = 1; -#ifdef UNICODE + bool start = true; -#endif + try { while (file.good()) @@ -129,7 +127,7 @@ void Mind::Load(tstring filename) if (st.empty()) break; line++; -#ifdef UNICODE + if (start) { if (st[0] == 65279) @@ -141,7 +139,7 @@ void Mind::Load(tstring filename) fileTypeMark = false; start = false; } -#endif + format(st); count = st.length(); c = co = new TCHAR[count+1]; @@ -317,15 +315,15 @@ void Mind::Load(tstring filename) void Mind::Save(tstring filename) const { basic_ofstream > file; -#ifdef UNICODE + locale ulocale(locale(), new MyCodeCvt); file.imbue(ulocale); -#endif + file.open(filename.c_str(), ios_base::out | ios_base::binary); -#ifdef UNICODE + if (fileTypeMark) file << TCHAR(65279); -#endif + for (string_mmap::iterator it = data->study.begin(); it != data->study.end(); it++) { file << (*it).first << _T('\r') << endl; diff --git a/plugins/Boltun/Engine/Mind.h b/plugins/Boltun/Engine/Mind.h index ecf3f5d199..23e0a41bd3 100644 --- a/plugins/Boltun/Engine/Mind.h +++ b/plugins/Boltun/Engine/Mind.h @@ -59,9 +59,8 @@ class Mind { private: MindData *data; -#ifdef UNICODE bool fileTypeMark; -#endif + std::vector Parse(tstring s); public: Mind(); diff --git a/plugins/Boltun/Engine/MyCodeCvt.cpp b/plugins/Boltun/Engine/MyCodeCvt.cpp index 49722e6f7b..5d7baf4d88 100644 --- a/plugins/Boltun/Engine/MyCodeCvt.cpp +++ b/plugins/Boltun/Engine/MyCodeCvt.cpp @@ -18,8 +18,6 @@ // //*********************************************************** -#ifdef UNICODE - #include "MyCodeCvt.h" using namespace std; @@ -81,5 +79,3 @@ int MyCodeCvt::do_encoding() const _THROW0() { return 2; } - -#endif \ No newline at end of file -- cgit v1.2.3