From b3008a50cdda200d0f53344edc4f8fa1ffa25bec Mon Sep 17 00:00:00 2001 From: pescuma Date: Fri, 18 Dec 2009 03:28:38 +0000 Subject: utils: sync with berliOS git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@186 c086bb3d-8645-0410-b8da-73a8550f86e7 --- Plugins/utils/utf8_helpers.h | 104 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 97 insertions(+), 7 deletions(-) (limited to 'Plugins/utils/utf8_helpers.h') diff --git a/Plugins/utils/utf8_helpers.h b/Plugins/utils/utf8_helpers.h index 1b7785d..c48eb67 100644 --- a/Plugins/utils/utf8_helpers.h +++ b/Plugins/utils/utf8_helpers.h @@ -1,3 +1,23 @@ +/* +Copyright (C) 2009 Ricardo Pescuma Domenecci + +This is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +This 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this file; see the file license.txt. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. +*/ + + #ifndef __UTF8_HELPERS_H__ # define __UTF8_HELPERS_H__ @@ -39,11 +59,21 @@ public: mir_free(utf8); } - operator char *() + char * get() const + { + return utf8; + } + + operator char *() const { return utf8; } + char operator[](int pos) const + { + return utf8[pos]; + } + private: char *utf8; @@ -121,11 +151,21 @@ public: return ret; } - operator TCHAR *() + TCHAR * get() const + { + return tchar; + } + + operator TCHAR *() const { return tchar; } + TCHAR operator[](int pos) const + { + return tchar[pos]; + } + private: TCHAR *tchar; }; @@ -171,11 +211,21 @@ public: return ret; } - operator const TCHAR *() + const TCHAR * get() const + { + return tchar; + } + + operator const TCHAR *() const { return tchar; } + TCHAR operator[](int pos) const + { + return tchar[pos]; + } + private: #ifdef UNICODE TCHAR *tchar; @@ -225,11 +275,21 @@ public: return ret; } - operator const TCHAR *() + const TCHAR * get() const { return tchar; } + operator const TCHAR *() const + { + return tchar; + } + + TCHAR operator[](int pos) const + { + return tchar[pos]; + } + private: #ifdef UNICODE const TCHAR *tchar; @@ -266,11 +326,21 @@ public: return ret; } - operator const WCHAR *() + const WCHAR * get() const { return wchar; } + operator const WCHAR *() const + { + return wchar; + } + + WCHAR operator[](int pos) const + { + return wchar[pos]; + } + private: WCHAR *wchar; }; @@ -317,11 +387,21 @@ public: return ret; } - operator const char *() + const char * get() const { return val; } + operator const char *() const + { + return val; + } + + char operator[](int pos) const + { + return val[pos]; + } + private: #ifdef UNICODE char *val; @@ -371,11 +451,21 @@ public: return ret; } - operator const WCHAR *() + const WCHAR * get() const { return val; } + operator const WCHAR *() const + { + return val; + } + + WCHAR operator[](int pos) const + { + return val[pos]; + } + private: #ifdef UNICODE const WCHAR *val; -- cgit v1.2.3