Skip to content

Commit 9eaa875

Browse files
committed
Initial refactor of String types.
1 parent 0457bf0 commit 9eaa875

File tree

198 files changed

+3377
-3386
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+3377
-3386
lines changed

source/code/core/collections/natvis/string.natvis

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
33

4+
<Type Name="ice::ncount">
5+
<DisplayString Condition="width == 0">0 &lt;invalid&gt;</DisplayString>
6+
<DisplayString>{value}</DisplayString>
7+
<Expand>
8+
<Item Name="[value]">value</Item>
9+
<Item Name="[width]">width</Item>
10+
<Item Name="[bytes]">value * width</Item>
11+
</Expand>
12+
</Type>
13+
14+
<Type Name="ice::nindex">
15+
<DisplayString Condition="width == 0">0 &lt;invalid&gt;</DisplayString>
16+
<DisplayString>{value} </DisplayString>
17+
<Expand>
18+
<Item Name="[value]">value</Item>
19+
<Item Name="[width]">width</Item>
20+
<Item Name="[bytes]">value * width</Item>
21+
</Expand>
22+
</Type>
23+
424
<!-- Native Visualization for the core::String<> type -->
525
<Type Name="ice::HeapString&lt;*&gt;">
626
<DisplayString>HeapString {{ { _data,s8 } }}</DisplayString>

source/code/core/collections/public/ice/container/array.hxx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// Copyright 2022 - 2025, Dandielo <[email protected]>
1+
/// Copyright 2022 - 2026, Dandielo <[email protected]>
22
/// SPDX-License-Identifier: MIT
33

44
#pragma once
@@ -9,16 +9,16 @@ namespace ice::array
99
{
1010

1111
template<typename Type, ice::ContainerLogic Logic>
12-
inline void set_capacity(ice::Array<Type, Logic>& arr, ice::ucount new_capacity) noexcept;
12+
inline void set_capacity(ice::Array<Type, Logic>& arr, ice::u32 new_capacity) noexcept;
1313

1414
template<typename Type, ice::ContainerLogic Logic>
15-
inline void reserve(ice::Array<Type, Logic>& arr, ice::ucount min_capacity) noexcept;
15+
inline void reserve(ice::Array<Type, Logic>& arr, ice::u32 min_capacity) noexcept;
1616

1717
template<typename Type, ice::ContainerLogic Logic>
18-
inline void grow(ice::Array<Type, Logic>& arr, ice::ucount min_capacity = 0) noexcept;
18+
inline void grow(ice::Array<Type, Logic>& arr, ice::u32 min_capacity = 0) noexcept;
1919

2020
template<typename Type, ice::ContainerLogic Logic>
21-
inline void resize(ice::Array<Type, Logic>& arr, ice::ucount new_size) noexcept;
21+
inline void resize(ice::Array<Type, Logic>& arr, ice::u32 new_size) noexcept;
2222

2323
template<typename Type, ice::ContainerLogic Logic>
2424
inline void shrink(ice::Array<Type, Logic>& arr) noexcept;
@@ -29,8 +29,8 @@ namespace ice::array
2929
template<typename Type, ice::ContainerLogic Logic>
3030
inline auto slice(
3131
ice::Array<Type, Logic>& arr,
32-
ice::ucount from_idx = 0,
33-
ice::ucount count = ice::ucount_max
32+
ice::u32 from_idx = 0,
33+
ice::u32 count = ice::u32_max
3434
) noexcept -> ice::Span<Type>;
3535

3636
template<typename Type, ice::ContainerLogic Logic>
@@ -54,7 +54,7 @@ namespace ice::array
5454
inline void push_back(ice::Array<Type, Logic>& arr, ice::Span<Source const> items, Type(*fn)(Source const&) noexcept) noexcept;
5555

5656
template<typename Type, ice::ContainerLogic Logic>
57-
inline void pop_back(ice::Array<Type, Logic>& arr, ice::ucount count = 1) noexcept;
57+
inline void pop_back(ice::Array<Type, Logic>& arr, ice::u32 count = 1) noexcept;
5858

5959
template<typename Type, ice::ContainerLogic Logic>
6060
inline auto begin(ice::Array<Type, Logic>& arr) noexcept -> typename ice::Array<Type, Logic>::Iterator;
@@ -77,10 +77,10 @@ namespace ice::array
7777

7878

7979
template<typename Type, ice::ContainerLogic Logic>
80-
inline auto count(ice::Array<Type, Logic> const& arr) noexcept -> ice::ucount;
80+
inline auto count(ice::Array<Type, Logic> const& arr) noexcept -> ice::u32;
8181

8282
template<typename Type, ice::ContainerLogic Logic>
83-
inline auto capacity(ice::Array<Type, Logic> const& arr) noexcept -> ice::ucount;
83+
inline auto capacity(ice::Array<Type, Logic> const& arr) noexcept -> ice::u32;
8484

8585
template<typename Type, ice::ContainerLogic Logic>
8686
inline auto size_bytes(ice::Array<Type, Logic> const& arr) noexcept -> ice::usize;
@@ -94,8 +94,8 @@ namespace ice::array
9494
template<typename Type, ice::ContainerLogic Logic>
9595
inline auto slice(
9696
ice::Array<Type, Logic> const& arr,
97-
ice::ucount from_idx = 0,
98-
ice::ucount count = ice::ucount_max
97+
ice::u32 from_idx = 0,
98+
ice::u32 count = ice::u32_max
9999
)noexcept -> ice::Span<Type const>;
100100

101101
template<typename Type, ice::ContainerLogic Logic>

source/code/core/collections/public/ice/container/hashmap.hxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// Copyright 2022 - 2025, Dandielo <[email protected]>
1+
/// Copyright 2022 - 2026, Dandielo <[email protected]>
22
/// SPDX-License-Identifier: MIT
33

44
#pragma once
@@ -13,7 +13,7 @@ namespace ice
1313
{
1414

1515
template<typename Type, ice::ContainerLogic Logic>
16-
inline void reserve(ice::HashMap<Type, Logic>& map, ice::ucount new_capacity) noexcept;
16+
inline void reserve(ice::HashMap<Type, Logic>& map, ice::u32 new_capacity) noexcept;
1717

1818
template<typename Type, ice::ContainerLogic Logic>
1919
inline void clear(ice::HashMap<Type, Logic>& map) noexcept;
@@ -48,7 +48,7 @@ namespace ice
4848

4949

5050
template<typename HashMapType> requires HashMapReadAccess<HashMapType>
51-
inline auto count(HashMapType const& map) noexcept -> ice::ucount;
51+
inline auto count(HashMapType const& map) noexcept -> ice::u32;
5252

5353
template<typename HashMapType> requires HashMapReadAccess<HashMapType>
5454
inline bool full(HashMapType const& map) noexcept;
@@ -115,7 +115,7 @@ namespace ice
115115

116116

117117
template<typename Type, ice::ContainerLogic Logic>
118-
inline auto count(ice::HashMap<Type, Logic> const& map, ice::u64 key) noexcept -> ice::ucount;
118+
inline auto count(ice::HashMap<Type, Logic> const& map, ice::u64 key) noexcept -> ice::u32;
119119

120120
template<typename Type, ice::ContainerLogic Logic>
121121
inline void get(ice::HashMap<Type, Logic> const& map, ice::u64 key, ice::Array<Type, Logic>& items) noexcept;

source/code/core/collections/public/ice/container/impl/array_impl.inl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// Copyright 2022 - 2025, Dandielo <[email protected]>
1+
/// Copyright 2022 - 2026, Dandielo <[email protected]>
22
/// SPDX-License-Identifier: MIT
33

44
namespace ice
@@ -145,14 +145,14 @@ namespace ice
145145
}
146146

147147
template<typename Type, ice::ContainerLogic Logic>
148-
inline auto Array<Type, Logic>::operator[](ice::ucount idx) noexcept -> Type&
148+
inline auto Array<Type, Logic>::operator[](ice::u32 idx) noexcept -> Type&
149149
{
150150
// TODO: Assert
151151
return _data[idx];
152152
}
153153

154154
template<typename Type, ice::ContainerLogic Logic>
155-
inline auto Array<Type, Logic>::operator[](ice::ucount idx) const noexcept -> Type const&
155+
inline auto Array<Type, Logic>::operator[](ice::u32 idx) const noexcept -> Type const&
156156
{
157157
// TODO: Assert
158158
return _data[idx];
@@ -174,7 +174,7 @@ namespace ice
174174
{
175175

176176
template<typename Type, ice::ContainerLogic Logic>
177-
inline void set_capacity(ice::Array<Type, Logic>& arr, ice::ucount new_capacity) noexcept
177+
inline void set_capacity(ice::Array<Type, Logic>& arr, ice::u32 new_capacity) noexcept
178178
{
179179
if (new_capacity == arr._capacity)
180180
{
@@ -217,7 +217,7 @@ namespace ice
217217
}
218218

219219
template<typename Type, ice::ContainerLogic Logic>
220-
inline void reserve(ice::Array<Type, Logic>& arr, ice::ucount min_capacity) noexcept
220+
inline void reserve(ice::Array<Type, Logic>& arr, ice::u32 min_capacity) noexcept
221221
{
222222
if (arr._capacity < min_capacity)
223223
{
@@ -226,9 +226,9 @@ namespace ice
226226
}
227227

228228
template<typename Type, ice::ContainerLogic Logic>
229-
inline void grow(ice::Array<Type, Logic>& arr, ice::ucount min_capacity) noexcept
229+
inline void grow(ice::Array<Type, Logic>& arr, ice::u32 min_capacity) noexcept
230230
{
231-
ice::ucount new_capacity = arr._capacity * 2 + 4;
231+
ice::u32 new_capacity = arr._capacity * 2 + 4;
232232
if (new_capacity < min_capacity)
233233
{
234234
new_capacity = min_capacity;
@@ -237,7 +237,7 @@ namespace ice
237237
}
238238

239239
template<typename Type, ice::ContainerLogic Logic>
240-
inline void resize(ice::Array<Type, Logic>& arr, ice::ucount new_count) noexcept
240+
inline void resize(ice::Array<Type, Logic>& arr, ice::u32 new_count) noexcept
241241
{
242242
if (arr._capacity < new_count)
243243
{
@@ -246,7 +246,7 @@ namespace ice
246246

247247
if (new_count > arr._count)
248248
{
249-
ice::ucount const missing_items = new_count - arr._count;
249+
ice::u32 const missing_items = new_count - arr._count;
250250

251251
// Even for trivial logic we construct items so at least the default ctor is called.
252252
ice::mem_construct_n_at<Type>(
@@ -257,7 +257,7 @@ namespace ice
257257
else if constexpr (Logic == ContainerLogic::Complex)
258258
{
259259
static_assert(Logic != ContainerLogic::Trivial);
260-
ice::ucount const destroyed_items = arr._count - new_count;
260+
ice::u32 const destroyed_items = arr._count - new_count;
261261

262262
ice::mem_destruct_n_at(
263263
arr._data + new_count,
@@ -350,13 +350,13 @@ namespace ice
350350
requires std::copy_constructible<Type>
351351
inline void push_back(ice::Array<Type, Logic>& arr, ice::Span<Type const> items) noexcept
352352
{
353-
ice::ucount const required_capacity = arr._count + ice::span::count(items);
353+
ice::u32 const required_capacity = arr._count + ice::span::count(items);
354354
if (required_capacity > arr._capacity)
355355
{
356356
ice::array::grow(arr, required_capacity);
357357
}
358358

359-
ice::ucount const missing_items = required_capacity - arr._count;
359+
ice::u32 const missing_items = required_capacity - arr._count;
360360
if constexpr (Logic == ContainerLogic::Complex)
361361
{
362362
ice::mem_copy_construct_n_at<Type>(
@@ -380,21 +380,21 @@ namespace ice
380380
requires std::copy_constructible<Type> && (std::is_same_v<Type, Source> == false)
381381
inline void push_back(ice::Array<Type, Logic>& arr, ice::Span<Source const> items, Type(*fn)(Source const&) noexcept) noexcept
382382
{
383-
ice::ucount const required_capacity = arr._count + ice::span::count(items);
383+
ice::u32 const required_capacity = arr._count + ice::span::count(items);
384384
if (required_capacity > arr._capacity)
385385
{
386386
ice::array::grow(arr, required_capacity);
387387
}
388388

389-
ice::ucount const missing_items = required_capacity - arr._count;
389+
ice::u32 const missing_items = required_capacity - arr._count;
390390
for (ice::u32 src_idx = 0; src_idx < missing_items; ++src_idx)
391391
{
392392
ice::array::push_back(arr, fn(items[src_idx]));
393393
}
394394
}
395395

396396
template<typename Type, ice::ContainerLogic Logic>
397-
inline void pop_back(ice::Array<Type, Logic>& arr, ice::ucount count /*= 1*/) noexcept
397+
inline void pop_back(ice::Array<Type, Logic>& arr, ice::u32 count /*= 1*/) noexcept
398398
{
399399
count = ice::min(count, arr._count);
400400
if constexpr (Logic == ContainerLogic::Complex)
@@ -453,13 +453,13 @@ namespace ice
453453

454454

455455
template<typename Type, ice::ContainerLogic Logic>
456-
inline auto count(ice::Array<Type, Logic> const& arr) noexcept -> ice::ucount
456+
inline auto count(ice::Array<Type, Logic> const& arr) noexcept -> ice::u32
457457
{
458458
return arr._count;
459459
}
460460

461461
template<typename Type, ice::ContainerLogic Logic>
462-
inline auto capacity(ice::Array<Type, Logic> const& arr) noexcept -> ice::ucount
462+
inline auto capacity(ice::Array<Type, Logic> const& arr) noexcept -> ice::u32
463463
{
464464
return arr._capacity;
465465
}
@@ -483,7 +483,7 @@ namespace ice
483483
}
484484

485485
template<typename Type, ice::ContainerLogic Logic>
486-
inline auto slice(ice::Array<Type, Logic> const& arr, ice::ucount from_idx, ice::ucount count) noexcept -> ice::Span<Type const>
486+
inline auto slice(ice::Array<Type, Logic> const& arr, ice::u32 from_idx, ice::u32 count) noexcept -> ice::Span<Type const>
487487
{
488488
return ice::span::subspan<Type const>(arr, from_idx, count);
489489
}

0 commit comments

Comments
 (0)