ezEngine  Milestone 7
AllStrings_inl.h
1 #pragma once
2 
3 #include <Foundation/Strings/String.h>
4 #include <Foundation/Strings/StringBuilder.h>
5 #include <Foundation/IO/Stream.h>
6 
7 template<ezUInt16 Size>
9  m_Data(pAllocator)
10 {
11  *this = rhs;
12 }
13 
14 template<ezUInt16 Size>
16  m_Data(pAllocator)
17 {
18  *this = std::move(rhs);
19 }
20 
21 template <ezUInt16 Size, typename A>
22 EZ_FORCE_INLINE ezHybridString<Size, A>::ezHybridString(const ezStringBuilder& rhs) :
23  ezHybridStringBase<Size>(rhs, A::GetAllocator())
24 {
25 }
26 
27 template <ezUInt16 Size, typename A>
29  ezHybridStringBase<Size>(std::move(rhs), A::GetAllocator())
30 {
31 }
32 
33 template<ezUInt16 Size>
35 {
36  m_uiCharacterCount= rhs.m_uiCharacterCount;
37  m_Data = rhs.m_Data;
38 }
39 
40 template<ezUInt16 Size>
42 {
43  m_uiCharacterCount = rhs.m_uiCharacterCount;
44  m_Data = std::move(rhs.m_Data);
45 }
46 
47 template <ezUInt16 Size, typename A>
48 EZ_FORCE_INLINE void ezHybridString<Size, A>::operator=(const ezStringBuilder& rhs)
49 {
51 }
52 
53 template <ezUInt16 Size, typename A>
54 EZ_FORCE_INLINE void ezHybridString<Size, A>::operator=(ezStringBuilder&& rhs)
55 {
57 }
58 
59 template<ezUInt16 Size>
61 {
62  Clear();
63 
64  ezHybridArray<ezUInt8, 1024 * 4> Bytes(m_Data.GetAllocator());
65  ezUInt8 Temp[1024];
66 
67  while (true)
68  {
69  const ezUInt32 uiRead = (ezUInt32) Stream.ReadBytes(Temp, 1024);
70 
71  if (uiRead == 0)
72  break;
73 
74  Bytes.PushBackRange(ezArrayPtr<ezUInt8>(Temp, uiRead));
75  }
76 
77  Bytes.PushBack('\0');
78 
79  *this = (const char*) &Bytes[0];
80 }
81 
82 template <ezUInt16 Size>
83 ezStringBuilder::ezStringBuilder(const ezHybridStringBase<Size>& rhs) : m_uiCharacterCount(rhs.m_uiCharacterCount), m_Data(rhs.m_Data)
84 {
85 }
86 
87 template <ezUInt16 Size, typename A>
88 ezStringBuilder::ezStringBuilder(const ezHybridString<Size, A>& rhs) : m_uiCharacterCount(rhs.m_uiCharacterCount), m_Data(rhs.m_Data)
89 {
90 }
91 
92 template <ezUInt16 Size>
94 {
95  m_uiCharacterCount = rhs.m_uiCharacterCount;
96  m_Data = rhs.m_Data;
97 }
98 
99 template <ezUInt16 Size, typename A>
101 {
102  m_uiCharacterCount = rhs.m_uiCharacterCount;
103  m_Data = rhs.m_Data;
104 }
105 
106 template <ezUInt16 Size>
107 ezStringBuilder::ezStringBuilder(ezHybridStringBase<Size>&& rhs) : m_uiCharacterCount(rhs.m_uiCharacterCount), m_Data(std::move(rhs.m_Data))
108 {
109 }
110 
111 template <ezUInt16 Size, typename A>
112 ezStringBuilder::ezStringBuilder(ezHybridString<Size, A>&& rhs) : m_uiCharacterCount(rhs.m_uiCharacterCount), m_Data(std::move(rhs.m_Data))
113 {
114 }
115 
116 template <ezUInt16 Size>
118 {
119  m_uiCharacterCount = rhs.m_uiCharacterCount;
120  m_Data = std::move(rhs.m_Data);
121 }
122 
123 template <ezUInt16 Size, typename A>
125 {
126  m_uiCharacterCount = rhs.m_uiCharacterCount;
127  m_Data = std::move(rhs.m_Data);
128 }
129 
130