Plasma Engine  2.0
Loading...
Searching...
No Matches
StringConversion_inl.h
1#pragma once
2
3#include <Foundation/ThirdParty/utf8/utf8.h>
4
5#include <Foundation/Strings/UnicodeUtils.h>
6
7// **************** plStringWChar ****************
8
9inline plStringWChar::plStringWChar(plAllocator* pAllocator)
10 : m_Data(pAllocator)
11{
12 m_Data.PushBack('\0');
13}
14
15inline plStringWChar::plStringWChar(const plUInt16* pUtf16, plAllocator* pAllocator)
16 : m_Data(pAllocator)
17{
18 *this = pUtf16;
19}
20
21inline plStringWChar::plStringWChar(const plUInt32* pUtf32, plAllocator* pAllocator)
22 : m_Data(pAllocator)
23{
24 *this = pUtf32;
25}
26
27inline plStringWChar::plStringWChar(const wchar_t* pWChar, plAllocator* pAllocator)
28 : m_Data(pAllocator)
29{
30 *this = pWChar;
31}
32
33inline plStringWChar::plStringWChar(plStringView sUtf8, plAllocator* pAllocator /*= plFoundation::GetDefaultAllocator()*/)
34{
35 *this = sUtf8;
36}
37
38
39// **************** plStringUtf8 ****************
40
41inline plStringUtf8::plStringUtf8(plAllocator* pAllocator)
42 : m_Data(pAllocator)
43{
44 m_Data.PushBack('\0');
45}
46
47inline plStringUtf8::plStringUtf8(const char* szUtf8, plAllocator* pAllocator)
48 : m_Data(pAllocator)
49{
50 *this = szUtf8;
51}
52
53inline plStringUtf8::plStringUtf8(const plUInt16* pUtf16, plAllocator* pAllocator)
54 : m_Data(pAllocator)
55{
56 *this = pUtf16;
57}
58
59inline plStringUtf8::plStringUtf8(const plUInt32* pUtf32, plAllocator* pAllocator)
60 : m_Data(pAllocator)
61{
62 *this = pUtf32;
63}
64
65inline plStringUtf8::plStringUtf8(const wchar_t* pWChar, plAllocator* pAllocator)
66 : m_Data(pAllocator)
67{
68 *this = pWChar;
69}
70
71#if PL_ENABLED(PL_PLATFORM_WINDOWS_UWP)
72
73inline plStringUtf8::plStringUtf8(
74 const Microsoft::WRL::Wrappers::HString& hstring, plAllocator* pAllocator /*= plFoundation::GetDefaultAllocator()*/)
75 : m_Data(pAllocator)
76{
77 *this = hstring;
78}
79
80inline plStringUtf8::plStringUtf8(const HSTRING& hstring, plAllocator* pAllocator /*= plFoundation::GetDefaultAllocator()*/)
81{
82 *this = hstring;
83}
84
85#endif
86
87// **************** plStringUtf16 ****************
88
89inline plStringUtf16::plStringUtf16(plAllocator* pAllocator)
90 : m_Data(pAllocator)
91{
92 m_Data.PushBack('\0');
93}
94
95inline plStringUtf16::plStringUtf16(const char* szUtf8, plAllocator* pAllocator)
96 : m_Data(pAllocator)
97{
98 *this = szUtf8;
99}
100
101inline plStringUtf16::plStringUtf16(const plUInt16* pUtf16, plAllocator* pAllocator)
102 : m_Data(pAllocator)
103{
104 *this = pUtf16;
105}
106
107inline plStringUtf16::plStringUtf16(const plUInt32* pUtf32, plAllocator* pAllocator)
108 : m_Data(pAllocator)
109{
110 *this = pUtf32;
111}
112
113inline plStringUtf16::plStringUtf16(const wchar_t* pWChar, plAllocator* pAllocator)
114 : m_Data(pAllocator)
115{
116 *this = pWChar;
117}
118
119
120
121// **************** plStringUtf32 ****************
122
123inline plStringUtf32::plStringUtf32(plAllocator* pAllocator)
124 : m_Data(pAllocator)
125{
126 m_Data.PushBack('\0');
127}
128
129inline plStringUtf32::plStringUtf32(const char* szUtf8, plAllocator* pAllocator)
130 : m_Data(pAllocator)
131{
132 *this = szUtf8;
133}
134
135inline plStringUtf32::plStringUtf32(const plUInt16* pUtf16, plAllocator* pAllocator)
136 : m_Data(pAllocator)
137{
138 *this = pUtf16;
139}
140
141inline plStringUtf32::plStringUtf32(const plUInt32* pUtf32, plAllocator* pAllocator)
142 : m_Data(pAllocator)
143{
144 *this = pUtf32;
145}
146
147inline plStringUtf32::plStringUtf32(const wchar_t* pWChar, plAllocator* pAllocator)
148 : m_Data(pAllocator)
149{
150 *this = pWChar;
151}
Base class for all memory allocators.
Definition Allocator.h:23
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34