Crazy Eddie's GUI System  0.8.4
StringTranscoder.h
00001 /***********************************************************************
00002     created:    Thu May 31 2012
00003     author:     Paul D Turner <paul@cegui.org.uk>
00004 *************************************************************************/
00005 /***************************************************************************
00006  *   Copyright (C) 2004 - 2012 Paul D Turner & The CEGUI Development Team
00007  *
00008  *   Permission is hereby granted, free of charge, to any person obtaining
00009  *   a copy of this software and associated documentation files (the
00010  *   "Software"), to deal in the Software without restriction, including
00011  *   without limitation the rights to use, copy, modify, merge, publish,
00012  *   distribute, sublicense, and/or sell copies of the Software, and to
00013  *   permit persons to whom the Software is furnished to do so, subject to
00014  *   the following conditions:
00015  *
00016  *   The above copyright notice and this permission notice shall be
00017  *   included in all copies or substantial portions of the Software.
00018  *
00019  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00020  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00021  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00022  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00023  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00024  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00025  *   OTHER DEALINGS IN THE SOFTWARE.
00026  ***************************************************************************/
00027 #ifndef _CEGUIStringTranscoder_h_
00028 #define _CEGUIStringTranscoder_h_
00029 
00030 #include "CEGUI/String.h"
00031 
00032 namespace CEGUI
00033 {
00041 class CEGUIEXPORT StringTranscoder :
00042     public AllocatedObject<StringTranscoder>
00043 {
00044 public:
00056     virtual uint16* stringToUTF16(const String& input) const = 0;
00057 
00077     virtual std::wstring stringToStdWString(const String& input) const = 0;
00078 
00079     /*
00080     \brief
00081         Constructs a String object from the given null terminated UTF-16 encoded
00082         buffer.
00083 
00084     \param input
00085         Pointer to a null terminated array of uint16 values representing a
00086         string encoded using UTF-16.
00087 
00088     \return
00089         String object holding the transcoded data.
00090     */
00091     virtual String stringFromUTF16(const uint16* input) const = 0;
00092 
00093     /*
00094     \brief
00095         Constructs a String object from the given std::wstring.
00096 
00097     \param input
00098         reference to a std::wstring object holding the string data to be
00099         transcoded.
00100 
00101     \return
00102         String object holding the transcoded data.
00103 
00104     \note
00105         What is represented by std::wstring and how it should be interpreted is
00106         implementation specific.  This means that the content of the
00107         std::wstring you pass must be consistent with what is expected given the
00108         implementation.  This largely means that on Microsoft Windows you will
00109         use UTF-16 and on *nix type environments you will use UTF-32.  Do NOT
00110         assume that blithely passing what you think is UTF-16 data in a
00111         std::wstring will work everywhere - because it wont.
00112     */
00113     virtual String stringFromStdWString(const std::wstring& input) const = 0;
00114 
00116     virtual void deleteUTF16Buffer(uint16* input) const = 0;
00117 
00118 protected:
00119     virtual ~StringTranscoder() {}
00120 };
00121 
00122 }
00123 
00124 #endif
00125 
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends