ezEngine  Milestone 7
StringBase.h
1 #pragma once
2 
3 #include <Foundation/Strings/Implementation/StringIterator.h>
4 
5 namespace ezInternal
6 {
7  template <typename T, bool isString>
8  struct HashHelperImpl;
9 }
10 
13 {
14 };
15 
17 template <typename Derived>
19 {
20 public:
25 
27  bool IsEmpty() const; // [tested]
28 
30  bool StartsWith(const char* szStartsWith) const; // [tested]
31 
33  bool StartsWith_NoCase(const char* szStartsWith) const; // [tested]
34 
36  bool EndsWith(const char* szEndsWith) const; // [tested]
37 
39  bool EndsWith_NoCase(const char* szEndsWith) const; // [tested]
40 
43  const char* FindSubString(const char* szStringToFind, const char* szStartSearchAt = nullptr) const; // [tested]
44 
47  const char* FindSubString_NoCase(const char* szStringToFind, const char* szStartSearchAt = nullptr) const; // [tested]
48 
51  const char* FindLastSubString(const char* szStringToFind, const char* szStartSearchAt = nullptr) const; // [tested]
52 
55  const char* FindLastSubString_NoCase(const char* szStringToFind, const char* szStartSearchAt = nullptr) const; // [tested]
56 
58  const char* FindWholeWord(const char* szSearchFor, ezStringUtils::EZ_CHARACTER_FILTER IsDelimiterCB, const char* szStartSearchAt = nullptr) const; // [tested]
59 
61  const char* FindWholeWord_NoCase(const char* szSearchFor, ezStringUtils::EZ_CHARACTER_FILTER IsDelimiterCB, const char* szStartSearchAt = nullptr) const; // [tested]
62 
64  ezInt32 Compare(const char* pString2) const; // [tested]
65 
67  ezInt32 CompareN(const char* pString2, ezUInt32 uiCharsToCompare) const; // [tested]
68 
70  ezInt32 Compare_NoCase(const char* pString2) const; // [tested]
71 
73  ezInt32 CompareN_NoCase(const char* pString2, ezUInt32 uiCharsToCompare) const; // [tested]
74 
76  bool IsEqual(const char* pString2) const; // [tested]
77 
79  bool IsEqualN(const char* pString2, ezUInt32 uiCharsToCompare) const; // [tested]
80 
82  bool IsEqual_NoCase(const char* pString2) const; // [tested]
83 
85  bool IsEqualN_NoCase(const char* pString2, ezUInt32 uiCharsToCompare) const; // [tested]
86 
88  const char* ComputeCharacterPosition(ezUInt32 uiCharacterIndex) const;
89 
94  iterator GetIteratorFront() const;
95 
101 
102 private:
103  const char* InternalGetData() const;
104  const char* InternalGetDataEnd() const;
105  ezUInt32 InternalGetElementCount() const;
106 
107 private: // friends
108 
109  template <typename DerivedLhs, typename DerivedRhs>
110  friend bool operator== (const ezStringBase<DerivedLhs>& lhs, const ezStringBase<DerivedRhs>& rhs);
111 
112  template <typename DerivedLhs, typename DerivedRhs>
113  friend bool operator!= (const ezStringBase<DerivedLhs>& lhs, const ezStringBase<DerivedRhs>& rhs);
114 
115  template <typename DerivedLhs, typename DerivedRhs>
116  friend bool operator< (const ezStringBase<DerivedLhs>& lhs, const ezStringBase<DerivedRhs>& rhs);
117 
118  template <typename DerivedLhs, typename DerivedRhs>
119  friend bool operator> (const ezStringBase<DerivedLhs>& lhs, const ezStringBase<DerivedRhs>& rhs);
120 
121  template <typename DerivedLhs, typename DerivedRhs>
122  friend bool operator<= (const ezStringBase<DerivedLhs>& lhs, const ezStringBase<DerivedRhs>& rhs);
123 
124  template <typename DerivedLhs, typename DerivedRhs>
125  friend bool operator>= (const ezStringBase<DerivedLhs>& lhs, const ezStringBase<DerivedRhs>& rhs);
126 
127  template <typename T, bool isString>
128  friend struct ezInternal::HashHelperImpl;
129 
130  friend struct ezStringIterator<Derived>;
131 
132  friend struct ezStringReverseIterator<Derived>;
133 };
134 
135 
136 template <typename Derived>
137 typename ezStringBase<Derived>::iterator begin(const ezStringBase<Derived>& container) { return typename ezStringBase<Derived>::iterator(container, false); }
138 
139 template <typename Derived>
140 typename ezStringBase<Derived>::const_iterator cbegin(const ezStringBase<Derived>& container) { return typename ezStringBase<Derived>::const_iterator(container, false); }
141 
142 template <typename Derived>
143 typename ezStringBase<Derived>::iterator end(const ezStringBase<Derived>& container) { return typename ezStringBase<Derived>::iterator(container, true); }
144 
145 template <typename Derived>
146 typename ezStringBase<Derived>::const_iterator cend(const ezStringBase<Derived>& container) { return typename ezStringBase<Derived>::const_iterator(container, true); }
147 
148 
149 template <typename Derived>
150 typename ezStringBase<Derived>::reverse_iterator rbegin(const ezStringBase<Derived>& container) { return typename ezStringBase<Derived>::reverse_iterator(container, false); }
151 
152 template <typename Derived>
153 typename ezStringBase<Derived>::const_reverse_iterator crbegin(const ezStringBase<Derived>& container) { return typename ezStringBase<Derived>::const_reverse_iterator(container, false); }
154 
155 template <typename Derived>
156 typename ezStringBase<Derived>::reverse_iterator rend(const ezStringBase<Derived>& container) { return typename ezStringBase<Derived>::reverse_iterator(container, true); }
157 
158 template <typename Derived>
159 typename ezStringBase<Derived>::const_reverse_iterator crend(const ezStringBase<Derived>& container) { return typename ezStringBase<Derived>::const_reverse_iterator(container, true); }
160 
161 #include <Foundation/Strings/Implementation/StringBase_inl.h>
162