Crazy Eddie's GUI System 0.8.7
Loading...
Searching...
No Matches
StringTranscoder.h
1/***********************************************************************
2 created: Thu May 31 2012
3 author: Paul D Turner <paul@cegui.org.uk>
4*************************************************************************/
5/***************************************************************************
6 * Copyright (C) 2004 - 2012 Paul D Turner & The CEGUI Development Team
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 ***************************************************************************/
27#ifndef _CEGUIStringTranscoder_h_
28#define _CEGUIStringTranscoder_h_
29
30#include "CEGUI/String.h"
31
32namespace CEGUI
33{
41class CEGUIEXPORT StringTranscoder :
42 public AllocatedObject<StringTranscoder>
43{
44public:
56 virtual uint16* stringToUTF16(const String& input) const = 0;
57
77 virtual std::wstring stringToStdWString(const String& input) const = 0;
78
79 /*
80 \brief
81 Constructs a String object from the given null terminated UTF-16 encoded
82 buffer.
83
84 \param input
85 Pointer to a null terminated array of uint16 values representing a
86 string encoded using UTF-16.
87
88 \return
89 String object holding the transcoded data.
90 */
91 virtual String stringFromUTF16(const uint16* input) const = 0;
92
93 /*
94 \brief
95 Constructs a String object from the given std::wstring.
96
97 \param input
98 reference to a std::wstring object holding the string data to be
99 transcoded.
100
101 \return
102 String object holding the transcoded data.
103
104 \note
105 What is represented by std::wstring and how it should be interpreted is
106 implementation specific. This means that the content of the
107 std::wstring you pass must be consistent with what is expected given the
108 implementation. This largely means that on Microsoft Windows you will
109 use UTF-16 and on *nix type environments you will use UTF-32. Do NOT
110 assume that blithely passing what you think is UTF-16 data in a
111 std::wstring will work everywhere - because it wont.
112 */
113 virtual String stringFromStdWString(const std::wstring& input) const = 0;
114
116 virtual void deleteUTF16Buffer(uint16* input) const = 0;
117
118protected:
119 virtual ~StringTranscoder() {}
120};
121
122}
123
124#endif
125
Definition MemoryAllocatedObject.h:110
Interface for a string transcoding utility. Instances of classes that implement this interface can be...
Definition StringTranscoder.h:43
virtual std::wstring stringToStdWString(const String &input) const =0
Transcode the given string to a std::wstring object.
virtual void deleteUTF16Buffer(uint16 *input) const =0
deletes a buffer returned from the stringToUTF16 function.
virtual uint16 * stringToUTF16(const String &input) const =0
Transcode the given string to a UTF-16 encoded buffer.
String class used within the GUI system.
Definition String.h:64
base class for properties able to do native set/get
Definition TypedProperty.h:50
Main namespace for Crazy Eddie's GUI Library.
Definition arch_overview.dox:1