summaryrefslogtreecommitdiff
path: root/plugins/BasicHistory/codecvt_CodePage.h
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-07-05 13:27:02 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-07-05 13:27:02 +0000
commit3a56ba391bf176c11cc5bde6f860759a3ce4477c (patch)
treee6e82e3d87e43303e1e01fb2b206a812f3683af6 /plugins/BasicHistory/codecvt_CodePage.h
parentcde14766d167f10dbad62c66acc0c7cc9d62f518 (diff)
BasicHistory: folder structure change
git-svn-id: http://svn.miranda-ng.org/main/trunk@773 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/BasicHistory/codecvt_CodePage.h')
-rw-r--r--plugins/BasicHistory/codecvt_CodePage.h98
1 files changed, 0 insertions, 98 deletions
diff --git a/plugins/BasicHistory/codecvt_CodePage.h b/plugins/BasicHistory/codecvt_CodePage.h
deleted file mode 100644
index 37b6b7d26f..0000000000
--- a/plugins/BasicHistory/codecvt_CodePage.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
-Basic History plugin
-Copyright (C) 2011-2012 Krzysztof Kral
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#pragma once
-
-template<class _Elem>
-class codecvt_CodePage : public std::codecvt<_Elem, char, mbstate_t>
-{
-private:
- UINT codePage;
-public:
- typedef std::codecvt<_Elem, char, mbstate_t> _Mybase;
- typedef typename _Mybase::result result;
- typedef char _Byte;
- typedef _Elem intern_type;
- typedef _Byte extern_type;
- typedef mbstate_t state_type;
-
- explicit codecvt_CodePage(UINT _codePage)
- : _Mybase(0),
- codePage(_codePage)
- { // construct with ref count
- }
-
- virtual ~codecvt_CodePage()
- { // destroy the object
- }
-
-protected:
- virtual result do_in(mbstate_t& _State, const _Byte *_First1, const _Byte *_Last1, const _Byte *& _Mid1, _Elem *_First2, _Elem *_Last2, _Elem *& _Mid2) const
- { // convert bytes [_First1, _Last1) to [_First2, _Last)
- return (_Mybase::error); // not implemented
- }
-
- virtual result do_out(mbstate_t& _State, const _Elem *_First1, const _Elem *_Last1, const _Elem *& _Mid1, _Byte *_First2, _Byte *_Last2, _Byte *& _Mid2) const
- { // convert [_First1, _Last1) to bytes [_First2, _Last)
- _Mid1 = _First1;
- _Mid2 = _First2;
-
- int conv = WideCharToMultiByte(codePage, 0, _First1, _Last1 - _First1, _First2, _Last2 - _First2, NULL, NULL);
- if(conv == 0)
- {
- if(GetLastError() == ERROR_INSUFFICIENT_BUFFER)
- return (_Mybase::partial);
- else
- return (_Mybase::error);
- }
- else
- {
- _Mid1 = _Last1;
- _Mid2 = _First2 + conv;
- }
-
- return (_Mybase::ok);
- }
-
- virtual result do_unshift(mbstate_t&,
- _Byte *_First2, _Byte *, _Byte *& _Mid2) const
- { // generate bytes to return to default shift state
- _Mid2 = _First2;
- return (_Mybase::ok);
- }
-
- virtual int do_length(const mbstate_t& _State, const _Byte *_First1, const _Byte *_Last1, size_t _Count) const _THROW0()
- { // return min(_Count, converted length of bytes [_First1, _Last1))
- return (int)_Count; // not implemented
- }
-
- virtual bool do_always_noconv() const _THROW0()
- { // return true if conversions never change input
- return (false);
- }
-
- virtual int do_max_length() const _THROW0()
- { // return maximum length required for a conversion
- return 6;
- }
-
- virtual int do_encoding() const _THROW0()
- { // return length of code sequence (from codecvt)
- return 0; // -1 => state dependent, 0 => varying length
- }
-};