Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Locale.inl
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#include "Stroika/Foundation/Execution/Throw.h"
5
7
8 /*
9 ********************************************************************************
10 *********************** Common::GetPlatformDefaultLocale ***********************
11 ********************************************************************************
12 */
13 inline std::locale GetPlatformDefaultLocale ()
14 {
15 // From https://en.cppreference.com/w/cpp/locale/setlocale
16 // Can be "" for the user-preferred locale or "C" for the minimal locale
17 // But https://en.cppreference.com/w/cpp/locale/locale/locale doesn't have similar language. So not clear
18 // this is guaranteed to work. But it seems to ...
19 // -- LGP 2018-10-15
20 return std::locale{""};
21 }
22
23 /*
24 ********************************************************************************
25 ***************************** Common::ScopedUseLocale **************************
26 ********************************************************************************
27 */
28 inline ScopedUseLocale::ScopedUseLocale (const optional<locale>& l)
29 {
30 if (l) {
31 fPrev_ = locale::global (*l);
32 }
33 }
34 inline ScopedUseLocale::~ScopedUseLocale ()
35 {
36 if (fPrev_) {
37 IgnoreExceptionsForCall (locale::global (*fPrev_));
38 }
39 }
40
41}
locale GetPlatformDefaultLocale()
Definition Locale.inl:13