acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
aaa_scoped_string_base.h
1
// Created by camilo on 2012-12-18 18:44 <3ThomasBorregaardSorensen!!
2
#pragma once
3
//
4
//
5
//
6
//template < typename ITERATOR_TYPE >
7
//class scoped_string_base :
8
// public string_range < ITERATOR_TYPE >
9
//{
10
//public:
11
//
20
//
21
// using PRIMITIVE_SCOPED_STRING_TAG = PRIMITIVE_SCOPED_STRING_TAG_TYPE;
22
//
23
// using RANGE = string_range < ITERATOR_TYPE >;
24
// using ITEM_POINTER = get_type_item_pointer< ITERATOR_TYPE>;
25
// using ITEM = dereference < ITEM_POINTER >;
26
// using CHARACTER = ITEM;
27
// using this_iterator = typename RANGE::this_iterator;
28
// using iterator = typename RANGE::iterator;
29
// using const_iterator = typename RANGE::const_iterator;
30
// using STRING = ::string_base < ITERATOR_TYPE >;
31
//
32
//
33
// scoped_string_base(no_initialize_t) :RANGE(no_initialize_t{}) {}
34
// scoped_string_base():RANGE(nullptr) {}
35
// scoped_string_base(nullptr_t) :RANGE(nullptr) {}
36
// scoped_string_base(const scoped_ansi_string & scopedstr) : RANGE(nullptr) { construct_range(scopedstr); }
37
// scoped_string_base(const scoped_wd16_string & scopedstr) : RANGE(nullptr) { construct_range(scopedstr); }
38
// scoped_string_base(const scoped_wd32_string & scopedstr) : RANGE(nullptr) { construct_range(scopedstr); }
39
//
40
// template < prototype_string STRING2 >
41
// scoped_string_base(const STRING2& str) : RANGE(no_initialize_t{}) { construct_range(str); }
42
//
43
// template < typename ITERATOR_TYPE2, ::i32 t_size >
44
// scoped_string_base(const const_string_range_static_array<ITERATOR_TYPE2, t_size >& a) : RANGE((const STRING &) a ) { }
45
//
46
// template < has_as_string HAS_AS_STRING >
47
// scoped_string_base(const HAS_AS_STRING & has_as_string) : RANGE(nullptr) { this->str(has_as_string.as_string()); }
48
//
49
// template < has_get_string HAS_GET_STRING >
50
// scoped_string_base(const HAS_GET_STRING & has_get_string) : RANGE(nullptr) { this->str(has_get_string.get_string()); }
51
//
68
//
69
// template < character_range_not_string_neither_scoped_string CHARACTER_RANGE >
70
// scoped_string_base(const CHARACTER_RANGE & range) : RANGE(nullptr) { construct_range(range); }
71
//
72
// // scoped_string_base(const ::block & block) :m_str(e_zero_initialize), RANGE((const_iterator)block.begin(), (const_iterator)block.end()) {}
76
// //scoped_string_base(const ::ansi_character * psz) :m_str(e_zero_initialize), RANGE(e_zero_initialize) { _construct1(scopedstr); }
77
// //scoped_string_base(const ::wd16_character * psz) :m_str(e_zero_initialize), RANGE(e_zero_initialize) { _construct1(scopedstr); }
78
// //scoped_string_base(const ::wd32_character * psz) :m_str(e_zero_initialize), RANGE(e_zero_initialize) { _construct1(scopedstr); }
85
//
86
//
87
// scoped_string_base(const ::inline_number_string & inlinenumberstring) : RANGE(nullptr)
88
// {
89
//
90
// this->str(inlinenumberstring);
91
//
92
// }
93
//
94
// //template < prototype_character CHARACTER2, character_count n >
95
// //scoped_string_base(const CHARACTER2(&s)[n]) : scoped_string_base(::as_string_literal<CHARACTER2, n>(s)) {}
96
// //scoped_string_base(const CHARACTER2(&s)[n]) : RANGE(::range<const CHARACTER2 *>(s)) {}
97
//
98
//
99
// template < character_count n >
100
// scoped_string_base(const CHARACTER(&s)[n]) : RANGE(::range<const CHARACTER*>(s)) {}
101
//
102
//
103
// template < other_primitive_character < CHARACTER > OTHER_CHARACTER, character_count n >
104
// scoped_string_base(const OTHER_CHARACTER(&s)[n]) :
105
// RANGE(no_initialize_t{})
106
// {
107
//
108
// this->m_begin = nullptr;
109
// this->m_end = nullptr;
110
// this->m_erange = e_range_none;
111
//
112
// this->str({ s, string_literal_length(s) });
113
//
114
// }
115
//
116
//
117
// template < character_pointer CHARACTER_POINTER >
118
// scoped_string_base(CHARACTER_POINTER start) : scoped_string_base(start, start + string_safe_length(start)) {}
119
// template < prototype_character CHARACTER2 >
120
// scoped_string_base(const CHARACTER2 * start, character_count len) : scoped_string_base(start, start + len) {}
121
// template < prototype_character CHARACTER2 >
122
// scoped_string_base(const CHARACTER2 * start, const CHARACTER2 * end) :
123
// RANGE(no_initialize_t{})
124
// {
125
//
126
// if constexpr (sizeof(CHARACTER2) == sizeof(CHARACTER))
127
// {
128
//
129
// this->m_begin = start;
130
// this->m_end = end;
131
// this->m_erange = e_range_none;
132
//
133
// }
134
// else
135
// {
136
//
137
// this->m_begin = nullptr;
138
// this->m_end = nullptr;
139
// this->m_erange = e_range_none;
140
//
141
// this->str({ start, end - start });
142
//
143
// }
144
//
145
// }
146
//
147
//
148
// ~scoped_string_base()
149
// {
150
//
151
// //if (::is_set(this) && (this->m_erange & e_range_scoped_string_allocation))
152
// if (::is_set(this) && (this->m_erange & e_range_string))
153
// {
154
//
155
// ((STRING *)this)->~string_base<ITERATOR_TYPE>();
156
//
157
// }
158
//
159
// }
160
//
161
// //template < character_count n >
162
// //scoped_string_base(const ::i8 (&cha)[n]) :m_str(e_zero_initialize), RANGE(e_zero_initialize) { _construct1(cha); }
163
//
164
//
165
// //STRING & str() { return (STRING &)*this; }
166
// STRING & str(const STRING & str)
167
// {
168
//
170
//
171
// return ((STRING *)this)->operator = (str);
172
//
173
// }
174
//
175
//
176
// STRING & fork()
177
// {
178
//
179
// return this->str({this->m_begin, this->m_end});
180
//
181
// }
182
//
183
//
184
// //template < prototype_character CHARACTER2 >
185
// //void _construct1(const CHARACTER2 * psz)
186
// //{
187
// //
188
// // if constexpr (sizeof(CHARACTER2) == sizeof(CHARACTER))
189
// // {
190
//
191
// // this->m_begin = psz;
192
// // this->m_end = psz + string_safe_length(scopedstr);
193
//
194
// // }
195
// // else
196
// // {
197
//
198
// // this->str(scopedstr);
199
//
200
// // }
201
//
202
// //}
203
//
204
//
205
// /// Returns:
208
//
209
//
210
// template < typename GENERIC_RANGE >
211
// void construct_range(const GENERIC_RANGE & range)
212
// {
213
//
214
// if constexpr(sizeof(typename GENERIC_RANGE::ITEM) == sizeof(CHARACTER))
215
// {
216
//
217
// this->m_begin = (ITERATOR_TYPE) range.m_begin;
218
// this->m_end = (ITERATOR_TYPE) range.m_end;
219
// this->m_erange = (!this->m_end || *this->m_end) ? e_range_none : e_range_null_terminated;
220
//
221
// }
222
// else
223
// {
224
//
225
// this->str(range);
226
//
227
// }
228
//
229
// }
230
//
231
//
232
// inline bool operator ==(const ::ansi_string & str) const { return this->equals((const scoped_string_base&)str); }
233
// inline bool operator ==(const ::wd16_string & str) const { return this->equals((const scoped_string_base&)str); }
234
// inline bool operator ==(const ::wd32_string & str) const { return this->equals((const scoped_string_base&)str); }
235
// inline bool operator ==(const ::ansi_character * psz) const { return this->equals(scopedstr); }
236
// inline bool operator ==(const ::wd16_character * psz) const { return this->equals(scopedstr); }
237
// inline bool operator ==(const ::wd32_character * psz) const { return this->equals(scopedstr); }
238
// inline bool operator ==(const ::scoped_ansi_string & str) const { return this->equals((const scoped_string_base&)str); }
239
// inline bool operator ==(const ::scoped_wd16_string & str) const { return this->equals((const scoped_string_base&)str); }
240
// inline bool operator ==(const ::scoped_wd32_string & str) const { return this->equals((const scoped_string_base&)str); }
241
//
242
// const CHARACTER * null_terminated() const
243
// {
244
//
245
// if (!(this->m_erange & e_range_string) && (this->m_erange & e_range_null_terminated))
246
// {
247
//
248
// ((scoped_string_base *)this)->fork();
249
//
250
// }
251
//
252
// return this->m_begin;
253
//
254
// }
255
//
256
//
257
// operator const CHARACTER * () const { return this->null_terminated(); }
258
//
259
// const CHARACTER * c_str() const { return this->null_terminated(); }
260
//
261
//
262
// ::block as_block() const { return { (::u8 *)this->begin(), this->size() * sizeof(CHARACTER) }; }
263
//
264
//
265
//};
266
//
267
//
274
//
275
//
297
//
298
//
306
//
307
//
317
//
318
//
339
//
340
//
348
//
356
//
357
//
369
//
370
//
393
//
394
//
395
//
396
//template<prototype_character CHARACTER>
397
//inline ::hash32 _string_u32_hash(const ::scoped_string_base<const CHARACTER *> & scopedstr)
398
//{
399
//
400
// if (scopedstr.is_empty())
401
// {
402
//
403
// return {0};
404
//
405
// }
406
//
407
// ::u32 uHash = 0;
408
//
409
// auto p = scopedstr.m_begin;
410
//
411
// while (p < scopedstr.m_end) uHash = (uHash << 5) + *(p++);
412
//
413
// return {uHash};
414
//
415
//}
416
//
417
//
418
//template < >
419
//inline ::hash32 as_hash32 < scoped_ansi_string >(const scoped_ansi_string & scopedstr);
420
//
421
//
422
//template < >
423
//inline ::hash32 as_hash32 < scoped_wd16_string >(const scoped_wd16_string & scopedstr);
424
//
425
//
426
//template < >
427
//inline ::hash32 as_hash32 < scoped_wd32_string >(const scoped_wd32_string & scopedstr);
428
//#include "acme/prototype/mathematics/_string.h"_ansi
429
//
430
//
431
//#ifdef __STD_FORMAT__
432
//
433
//
434
//template < >
435
//struct std::formatter<::scoped_string > :
436
// public ::std::formatter< ::std::string_view >
437
//{
438
// auto format(const ::scoped_string& scopedstr, std::format_context& ctx) const {
439
// return formatter<::std::string_view>::format({ scopedstr.begin(), scopedstr.end() }, ctx);
440
// }
441
//};
442
//
443
//
444
//#endif
445
//
prototype
string
aaa_scoped_string_base.h
Generated by
1.17.0