MCPcopy Create free account
hub / github.com/comaps/comaps / UniString

Class UniString

libs/base/string_utils.hpp:29–80  ·  view source on GitHub ↗

Make new type, not typedef. Need to specialize DebugPrint.

Source from the content-addressed store, hash-verified

27
28/// Make new type, not typedef. Need to specialize DebugPrint.
29class UniString : public buffer_vector<UniChar, 32>
30{
31 using BaseT = buffer_vector<UniChar, 32>;
32
33public:
34 static UniString kSpace;
35
36 using value_type = UniChar;
37
38 UniString() = default;
39 explicit UniString(size_t n) : BaseT(n) {}
40 UniString(size_t n, UniChar c) { resize(n, c); }
41
42 template <typename Iter>
43 UniString(Iter b, Iter e) : BaseT(b, e)
44 {}
45
46 bool IsEqualAscii(char const * s) const;
47
48 UniString & operator+=(UniString const & rhs)
49 {
50 append(rhs);
51 return *this;
52 }
53
54 UniString operator+(UniString const & rhs) const
55 {
56 UniString result(*this);
57 result += rhs;
58 return result;
59 }
60
61 template <class Iter>
62 void Replace(iterator first, iterator last, Iter first2, Iter last2)
63 {
64 auto it = first;
65 auto it2 = first2;
66 for (; it < last && it2 < last2; ++it, ++it2)
67 *it = *it2;
68
69 if (it == last && it2 == last2)
70 return;
71
72 if (it == last)
73 {
74 insert(it, it2, last2);
75 return;
76 }
77
78 erase(it, last);
79 }
80};
81
82/// Performs full case folding for string to make it search-compatible according
83/// to rules in ftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt

Callers 4

GetUniStringMethod · 0.70
DumpSearchTokensFunction · 0.50
AddDACHNamesMethod · 0.50
UNIT_TESTFunction · 0.50

Calls

no outgoing calls

Tested by 1

UNIT_TESTFunction · 0.40