diff options
author | George Hazan <george.hazan@gmail.com> | 2014-03-05 12:52:30 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-03-05 12:52:30 +0000 |
commit | 3576b67db9fa0a3d8d5c1747cc3560504d31d125 (patch) | |
tree | f6a6cb9916cbf1aab83bac572fec8822f6ad065e /plugins/HistoryStats/src/utf8buffer.h | |
parent | 73e6231455372205e912963083624aaa371bab0b (diff) |
- adaptation for standard Windows ways of handling Unicode;
- obsoleted code removed;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@8407 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/HistoryStats/src/utf8buffer.h')
-rw-r--r-- | plugins/HistoryStats/src/utf8buffer.h | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/plugins/HistoryStats/src/utf8buffer.h b/plugins/HistoryStats/src/utf8buffer.h index 9d1b013d99..e4727afc30 100644 --- a/plugins/HistoryStats/src/utf8buffer.h +++ b/plugins/HistoryStats/src/utf8buffer.h @@ -5,37 +5,37 @@ #include <string>
class UTF8Buffer
- : public std::basic_streambuf<mu_text, std::char_traits<mu_text> >
+ : public std::basic_streambuf<TCHAR, std::char_traits<TCHAR> >
, private pattern::NotCopyable<UTF8Buffer>
{
private:
- typedef std::char_traits<mu_text> _Tr;
+ typedef std::char_traits<TCHAR> _Tr;
private:
int m_BufSize;
- mu_text* m_pBuf;
+ TCHAR* m_pBuf;
ext::a::ostream& m_Stream;
- mu_ansi* m_pUTF8Buf;
- mu_wide* m_pBufW;
+ char* m_pUTF8Buf;
+ WCHAR* m_pBufW;
-#if !defined(MU_WIDE)
- mu_wide m_CharMap[256];
-#endif // MU_WIDE
+#if !defined(_UNICODE)
+ WCHAR m_CharMap[256];
+#endif // _UNICODE
private:
- void dump(const mu_text* pBegin, const mu_text* pEnd)
+ void dump(const TCHAR* pBegin, const TCHAR* pEnd)
{
size_t len = pEnd - pBegin;
-#if !defined(MU_WIDE)
- mu_wide* pW = m_pBufW;
- mu_ansi* pA = m_pBuf;
+#if !defined(_UNICODE)
+ WCHAR* pW = m_pBufW;
+ char* pA = m_pBuf;
while (pA < pEnd)
{
*pW++ = m_CharMap[static_cast<unsigned char>(*pA++)];
}
-#endif // MU_WIDE
+#endif // _UNICODE
size_t utf8_len = utils::rawUTF8Encode(m_pBufW, len, m_pUTF8Buf);
m_Stream.write(m_pUTF8Buf, utf8_len);
@@ -81,26 +81,26 @@ public: explicit UTF8Buffer(ext::a::ostream& outStream, int bufferSize = 4096)
: m_BufSize(bufferSize), m_Stream(outStream)
{
- m_pBuf = new mu_text[m_BufSize];
- m_pUTF8Buf = new mu_ansi[3 * m_BufSize];
+ m_pBuf = new TCHAR[m_BufSize];
+ m_pUTF8Buf = new char[3 * m_BufSize];
-#if defined(MU_WIDE)
+#if defined(_UNICODE)
m_pBufW = m_pBuf;
-#else // MU_WIDE
- m_pBufW = new mu_wide[m_BufSize];
-#endif // MU_WIDE
+#else // _UNICODE
+ m_pBufW = new WCHAR[m_BufSize];
+#endif // _UNICODE
-#if !defined(MU_WIDE)
- mu_ansi ANSIChars[256];
+#if !defined(_UNICODE)
+ char ANSIChars[256];
array_each_(i, ANSIChars)
{
- ANSIChars[i] = static_cast<mu_ansi>(i);
+ ANSIChars[i] = static_cast<char>(i);
}
- m_CharMap[0] = muC(' ');
+ m_CharMap[0] = ' ';
MultiByteToWideChar(CP_ACP, 0, ANSIChars + 1, 255, m_CharMap + 1, 255);
-#endif // MU_WIDE
+#endif // _UNICODE
setp(m_pBuf, m_pBuf + m_BufSize);
}
@@ -110,9 +110,9 @@ public: delete[] m_pBuf;
delete[] m_pUTF8Buf;
-#if !defined(MU_WIDE)
+#if !defined(_UNICODE)
delete[] m_pBufW;
-#endif // MU_WIDE
+#endif // _UNICODE
}
};
|