diff options
author | Chris Robinson <[email protected]> | 2019-09-16 13:45:14 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-09-16 13:45:14 -0700 |
commit | 2c5c5a5397883602ca2aec4f34f9bd2c085779b3 (patch) | |
tree | 3909a6774d375c128e17c7667132adfb91cd160f /common/alstring.h | |
parent | 650764775febeedd2834ce3a0838d6468f4b6b31 (diff) |
Add and use custom string types and functions
Diffstat (limited to 'common/alstring.h')
-rw-r--r-- | common/alstring.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/common/alstring.h b/common/alstring.h new file mode 100644 index 00000000..194e54a1 --- /dev/null +++ b/common/alstring.h @@ -0,0 +1,29 @@ +#ifndef AL_STRING_H +#define AL_STRING_H + +#include <cstddef> +#include <string> + +#include "almalloc.h" + + +namespace al { + +template<typename T, typename Tr=std::char_traits<T>> +using basic_string = std::basic_string<T, Tr, al::allocator<T>>; + +using string = basic_string<char>; +using wstring = basic_string<wchar_t>; +using u16string = basic_string<char16_t>; +using u32string = basic_string<char32_t>; + + +/* These would be better served by using a string_view-like span/view with + * case-insensitive char traits. + */ +int strcasecmp(const char *str0, const char *str1) noexcept; +int strncasecmp(const char *str0, const char *str1, std::size_t len) noexcept; + +} // namespace al + +#endif /* AL_STRING_H */ |