qxLib
include
qx
containers
string
locale.h
Go to the documentation of this file.
1
/**
2
3
@file locale.h
4
@author Khrapov
5
@date 06.11.2026
6
@copyright (c) Nick Khrapov, 2026. All right reserved.
7
8
**/
9
#pragma once
10
11
#include <locale>
12
13
/**
14
@brief Enables the explicit CRT locale conversion path for Windows libc++.
15
**/
16
#ifndef QX_STRING_USE_CRT_LOCALE
17
#if defined(_WIN32) && defined(_LIBCPP_VERSION)
18
#define QX_STRING_USE_CRT_LOCALE 1
19
#else
20
#define QX_STRING_USE_CRT_LOCALE 0
21
#endif
22
#endif
23
24
#if QX_STRING_USE_CRT_LOCALE
25
#include <climits>
26
#include <cstdio>
27
#include <cstdlib>
28
#include <cwchar>
29
#include <memory>
30
#include <type_traits>
31
#include <utility>
32
#endif
33
34
namespace
qx
35
{
36
37
/**
38
@brief Set the locale used by string converters by default.
39
@details Call only when no other thread is accessing the locale or its facet.
40
@param locale - locale whose character facet is used for conversion
41
**/
42
void
set_locale(
const
std::locale& locale);
43
44
/**
45
@brief Get the default locale used by string converters.
46
@return - locale retained until the next call to set_locale
47
**/
48
const
std::locale& get_locale();
49
50
/**
51
@brief Get the cached character conversion facet for the default locale.
52
@return - facet retained until the next call to set_locale
53
**/
54
const
std::ctype<wchar_t>& get_locale_facet();
55
56
}
// namespace qx
57
58
59
#include <
qx/containers/string/locale.inl
>
locale.inl
Generated by
1.9.1