AuroraRuntime/Include/Aurora/Locale/Locale.hpp
Jamie Reece Wilson 83f34b0c47 [*] I was right. String views are [mostly] pointless (*)
03:28:55:638  17>2 of 53388 functions (<0.1%) were compiled, the rest were copied from previous compilation.
03:28:55:638  17>  0 functions were new in current compilation
03:28:55:638  17>  65 functions had inline decision re-evaluated but remain unchanged
03:28:56:749  17>Finished generating code

the header of const AuString & is the same as std::string_view therefore nothing changes. in fact, we still need to alloc strings a bunch of times for a zero terminated string. worse, <c++20 always allocs each time we want to access a hashmap with o(1) lookup, making small hashmaps kinda pointless when we always have to alloc+copy (thx std)

perhaps this will help some language binders
2024-04-19 05:58:08 +01:00

41 lines
1.5 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: Locale.hpp
Date: 2021-6-9
Author: Reece
***/
#pragma once
#include "ECodePage.hpp"
#include "Encoding/Encoding.hpp"
#include "LocaleStrings.hpp"
namespace Aurora::Locale
{
struct LocalizationInfo
{
inline LocalizationInfo() {};
inline LocalizationInfo(const LocalizationInfo &) = default;
inline LocalizationInfo(LocalizationInfo &&) = default;
inline LocalizationInfo(const AuString &language, const AuString &country, const AuString &codeset, const ECodePage codePage) : language(&language), country(&country), codeset(&codeset), codepage(codePage) {}
const AuString *language {}; /// ISO 639
const AuString *country {}; /// ISO 3166
const AuString *codeset {}; ///
const ECodePage codepage {}; /// Potentially eSysUnk. Note that eSysUnk is valid and handlable by iconv and nsl. On windows and unix, this is your codepage.
};
/*
Retrieves information about the current system <br>
This function will never fail <br>
This function will never release memory
*/
AUKN_SYM LocalizationInfo GetLocale();
#if defined(AURORA_PLATFORM_WIN32) || defined(I_REALLY_NEED_WIDECHAR_PUBAPI)
AUKN_SYM std::wstring ConvertFromUTF8(const AuROString &in);
AUKN_SYM AuString ConvertFromWChar(const wchar_t *in, AuMach length);
AUKN_SYM AuString ConvertFromWChar(const wchar_t *in);
#endif
}