Skip to content

Commit 87a0a58

Browse files
author
Julian LALU
committed
Rename ansichar by char8
1 parent 86f1586 commit 87a0a58

Some content is hidden

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

50 files changed

+1003
-1244
lines changed

interface/core/character/character.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ namespace hud
66
struct character
77
{
88

9-
static constexpr ansichar ANSI_NULL_CHARACTER = '\0';
9+
static constexpr char8 ANSI_NULL_CHARACTER = '\0';
1010
static constexpr wchar WIDE_NULL_CHARACTER = L'\0';
1111

1212
/** Check whether the character is a pure ansi character. */
13-
static HD_FORCEINLINE constexpr bool is_pure_ascii(const ansichar character) noexcept
13+
static HD_FORCEINLINE constexpr bool is_pure_ascii(const char8 character) noexcept
1414
{
1515
return (character & 0x80) == 0;
1616
}
@@ -22,7 +22,7 @@ namespace hud
2222
}
2323

2424
/** Check whether the character is a null character '\0'. */
25-
static HD_FORCEINLINE constexpr bool is_null(const ansichar character) noexcept
25+
static HD_FORCEINLINE constexpr bool is_null(const char8 character) noexcept
2626
{
2727
return character == '\0';
2828
}
@@ -42,7 +42,7 @@ namespace hud
4242
* @param character The character
4343
* @return true if the character is an alphanumeric character, false otherwise
4444
*/
45-
static HD_FORCEINLINE bool is_alphanumeric(const ansichar character) noexcept
45+
static HD_FORCEINLINE bool is_alphanumeric(const char8 character) noexcept
4646
{
4747
return isalnum(character) != 0;
4848
}
@@ -69,7 +69,7 @@ namespace hud
6969
* @param character The character
7070
* @return true if the character is an alphabetic character, false otherwise
7171
*/
72-
static HD_FORCEINLINE bool is_alphabetic(const ansichar character) noexcept
72+
static HD_FORCEINLINE bool is_alphabetic(const char8 character) noexcept
7373
{
7474
return isalpha(character) != 0;
7575
}
@@ -93,7 +93,7 @@ namespace hud
9393
* @param character The character
9494
* @return true if the character is an lowercase character, false otherwise
9595
*/
96-
static HD_FORCEINLINE bool is_lowercase(const ansichar character) noexcept
96+
static HD_FORCEINLINE bool is_lowercase(const char8 character) noexcept
9797
{
9898
return islower(character) != 0;
9999
}
@@ -115,7 +115,7 @@ namespace hud
115115
* @param character The character
116116
* @return true if the character is an uppercase character, false otherwise
117117
*/
118-
static HD_FORCEINLINE bool is_uppercase(const ansichar character) noexcept
118+
static HD_FORCEINLINE bool is_uppercase(const char8 character) noexcept
119119
{
120120
return isupper(character) != 0;
121121
}
@@ -132,7 +132,7 @@ namespace hud
132132
}
133133

134134
/** Check if the given character is a digit (0123456789). */
135-
static HD_FORCEINLINE bool is_digit(const ansichar character) noexcept
135+
static HD_FORCEINLINE bool is_digit(const char8 character) noexcept
136136
{
137137
return isdigit(character) != 0;
138138
}
@@ -144,7 +144,7 @@ namespace hud
144144
}
145145

146146
/** Check if the given character is a hexadecimal (0123456789abcdefABCDEF). */
147-
static HD_FORCEINLINE bool is_hexa(const ansichar character) noexcept
147+
static HD_FORCEINLINE bool is_hexa(const char8 character) noexcept
148148
{
149149
return isxdigit(character) != 0;
150150
}
@@ -156,7 +156,7 @@ namespace hud
156156
}
157157

158158
/** Check if the given character is a space or a horizontal tab according to the current C locale. */
159-
static HD_FORCEINLINE bool is_space_or_tab(const ansichar character) noexcept
159+
static HD_FORCEINLINE bool is_space_or_tab(const char8 character) noexcept
160160
{
161161
return isblank(character) != 0;
162162
}
@@ -168,7 +168,7 @@ namespace hud
168168
}
169169

170170
/** Check if the given character is a control character according to the current C locale. */
171-
static HD_FORCEINLINE bool is_control(const ansichar character) noexcept
171+
static HD_FORCEINLINE bool is_control(const char8 character) noexcept
172172
{
173173
return iscntrl(character) != 0;
174174
}
@@ -180,7 +180,7 @@ namespace hud
180180
}
181181

182182
/** Check if the given character is a space. */
183-
static HD_FORCEINLINE bool is_space(const ansichar character) noexcept
183+
static HD_FORCEINLINE bool is_space(const char8 character) noexcept
184184
{
185185
return isspace(character) != 0;
186186
}
@@ -192,7 +192,7 @@ namespace hud
192192
}
193193

194194
/** Check if the given character is a punctuation (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~) according to the current C locale. */
195-
static HD_FORCEINLINE bool is_punctuation(const ansichar character) noexcept
195+
static HD_FORCEINLINE bool is_punctuation(const char8 character) noexcept
196196
{
197197
return ispunct(character) != 0;
198198
}
@@ -204,9 +204,9 @@ namespace hud
204204
}
205205

206206
/** Converts the given character to lowercase according to the character conversion rules defined by the currently installed C locale. */
207-
static HD_FORCEINLINE ansichar to_lowercase(const ansichar character) noexcept
207+
static HD_FORCEINLINE char8 to_lowercase(const char8 character) noexcept
208208
{
209-
return static_cast<ansichar>(tolower(character));
209+
return static_cast<char8>(tolower(character));
210210
}
211211

212212
/** Converts the given wide character to lowercase according to the wide character conversion rules defined by the currently installed C locale. */
@@ -216,9 +216,9 @@ namespace hud
216216
}
217217

218218
/** Converts the given character to uppercase according to the character conversion rules defined by the currently installed C locale. */
219-
static HD_FORCEINLINE ansichar to_uppercase(const ansichar character) noexcept
219+
static HD_FORCEINLINE char8 to_uppercase(const char8 character) noexcept
220220
{
221-
return static_cast<ansichar>(toupper(character));
221+
return static_cast<char8>(toupper(character));
222222
}
223223

224224
/** Converts the given wide character to uppercase according to the wide character conversion rules defined by the currently installed C locale. */

interface/core/hash.h

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -147,27 +147,27 @@ namespace hud
147147
}
148148
};
149149

150-
/** Retrieves the 32 bits hash of a ansichar null-terminated string. */
150+
/** Retrieves the 32 bits hash of a char8 null-terminated string. */
151151
template<>
152-
struct hash_32<ansichar *, usize>
152+
struct hash_32<char8 *, usize>
153153
{
154-
[[nodiscard]] constexpr u32 operator()(const ansichar *value, usize length) const
154+
[[nodiscard]] constexpr u32 operator()(const char8 *value, usize length) const
155155
{
156156
return hud::hash_algorithm::city_hash::hash_32(value, length);
157157
}
158158
};
159159

160160
template<>
161-
struct hash_32<ansichar *>
161+
struct hash_32<char8 *>
162162
{
163-
[[nodiscard]] constexpr u32 operator()(const ansichar *value, usize length) const
163+
[[nodiscard]] constexpr u32 operator()(const char8 *value, usize length) const
164164
{
165-
return hud::hash_32<ansichar *, usize> {}(value, length);
165+
return hud::hash_32<char8 *, usize> {}(value, length);
166166
}
167167

168-
[[nodiscard]] constexpr u32 operator()(const ansichar *value) const
168+
[[nodiscard]] constexpr u32 operator()(const char8 *value) const
169169
{
170-
return hud::hash_32<ansichar *, usize> {}(value, cstring::length(value));
170+
return hud::hash_32<char8 *, usize> {}(value, cstring::length(value));
171171
}
172172
};
173173

@@ -177,7 +177,7 @@ namespace hud
177177
{
178178
[[nodiscard]] inline u32 operator()(const wchar *value, usize length) const
179179
{
180-
return hud::hash_algorithm::city_hash::hash_32(reinterpret_cast<const ansichar *>(value), length * sizeof(wchar));
180+
return hud::hash_algorithm::city_hash::hash_32(reinterpret_cast<const char8 *>(value), length * sizeof(wchar));
181181
}
182182
};
183183

@@ -197,12 +197,10 @@ namespace hud
197197
[[nodiscard]] inline u32 operator()(const void *const pointer) const
198198
{
199199
const uptr ptr = reinterpret_cast<uptr>(pointer);
200-
if constexpr (sizeof(uptr) == 4)
201-
{
200+
if constexpr (sizeof(uptr) == 4) {
202201
return hash_32<u32> {}(static_cast<u32>(ptr));
203202
}
204-
else if constexpr (sizeof(uptr) == 8)
205-
{
203+
else if constexpr (sizeof(uptr) == 8) {
206204
return hash_32<u64> {}(static_cast<u32>(ptr >> 4)); // 4 lowest bits in 64 bits are likely zero, ignore them
207205
}
208206
}
@@ -349,27 +347,27 @@ namespace hud
349347
}
350348
};
351349

352-
/** Retrieves the 64 bits hash of a ansichar null-terminated string. */
350+
/** Retrieves the 64 bits hash of a char8 null-terminated string. */
353351
template<>
354-
struct hash_64<ansichar *, usize>
352+
struct hash_64<char8 *, usize>
355353
{
356-
[[nodiscard]] constexpr u64 operator()(const ansichar *value, usize length) const
354+
[[nodiscard]] constexpr u64 operator()(const char8 *value, usize length) const
357355
{
358356
return hud::hash_algorithm::city_hash::hash_64(value, length);
359357
}
360358
};
361359

362360
template<>
363-
struct hash_64<ansichar *>
361+
struct hash_64<char8 *>
364362
{
365-
[[nodiscard]] constexpr u64 operator()(const ansichar *value, usize length) const
363+
[[nodiscard]] constexpr u64 operator()(const char8 *value, usize length) const
366364
{
367-
return hud::hash_64<ansichar *, usize> {}(value, length);
365+
return hud::hash_64<char8 *, usize> {}(value, length);
368366
}
369367

370-
[[nodiscard]] constexpr u64 operator()(const ansichar *value) const
368+
[[nodiscard]] constexpr u64 operator()(const char8 *value) const
371369
{
372-
return hud::hash_64<ansichar *, usize> {}(value, cstring::length(value));
370+
return hud::hash_64<char8 *, usize> {}(value, cstring::length(value));
373371
}
374372
};
375373

@@ -379,7 +377,7 @@ namespace hud
379377
{
380378
[[nodiscard]] inline u64 operator()(const wchar *value, usize length) const
381379
{
382-
return hud::hash_64<ansichar *, usize> {}(reinterpret_cast<const ansichar *>(value), length * sizeof(wchar));
380+
return hud::hash_64<char8 *, usize> {}(reinterpret_cast<const char8 *>(value), length * sizeof(wchar));
383381
}
384382
};
385383

@@ -399,12 +397,10 @@ namespace hud
399397
[[nodiscard]] inline u64 operator()(const void *const pointer) const
400398
{
401399
const uptr ptr = reinterpret_cast<uptr>(pointer);
402-
if constexpr (sizeof(uptr) == 4)
403-
{
400+
if constexpr (sizeof(uptr) == 4) {
404401
return hud::hash_64<u32> {}(static_cast<u32>(ptr));
405402
}
406-
else if constexpr (sizeof(uptr) == 8)
407-
{
403+
else if constexpr (sizeof(uptr) == 8) {
408404
return hud::hash_64<u64> {}(static_cast<u64>(ptr >> 4)); // 4 lowest bits in 64 bits are likely zero, ignore them
409405
}
410406
}
@@ -426,7 +422,7 @@ namespace hud
426422
* A 32 bit hasher class used for hashing an arbitrary stream of bytes
427423
* Instances of `hasher_32` usually represent state that is changed while hashing data.
428424
* `hasher_32` provides a fairly basic interface for retrieving the generated hash.
429-
* `hasher_32` used all functions in `hud` namespace like `hud::hash_32(const u32 value)`, `hud::hash_32(const ansichar *const value)` or `hud::combine_32(u64 a, u64 b)`.
425+
* `hasher_32` used all functions in `hud` namespace like `hud::hash_32(const u32 value)`, `hud::hash_32(const char8 *const value)` or `hud::combine_32(u64 a, u64 b)`.
430426
* If you want to hash a user defined type, add your `hud::hash_my_type(my_type& t)` function and just call `hasher_32::operator()`
431427
*/
432428
class hasher_32
@@ -467,7 +463,7 @@ namespace hud
467463
* A 64 bit hasher class used for hashing an arbitrary stream of bytes
468464
* Instances of `hasher_64` usually represent state that is changed while hashing data.
469465
* `hasher_64` provides a fairly basic interface for retrieving the generated hash.
470-
* `hasher_64` used all functions in `hud` namespace like `hud::hash_64(const u32 value)`, `hud::hash_64(const ansichar *const value)` or `hud::combine_64(u64 a, u64 b)`.
466+
* `hasher_64` used all functions in `hud` namespace like `hud::hash_64(const u32 value)`, `hud::hash_64(const char8 *const value)` or `hud::combine_64(u64 a, u64 b)`.
471467
* If you want to hash a user defined type, add your `hud::hash_my_type(my_type& t)` function and just call `hasher_64::operator()`
472468
*/
473469
struct hasher_64

0 commit comments

Comments
 (0)