4#include "Stroika/Foundation/StroikaPreComp.h"
11#include "Stroika/Foundation/Containers/Collection.h"
16#include "MessageUtilities.h"
30bool Impl_en::AppliesToThisLocale (
const locale& l)
const
32 return String::FromNarrowSDKString (locale{}.name ()).StartsWith (String::FromNarrowSDKString (l.name ()), eCaseInsensitive);
36pair<String, optional<String>> Impl_en::RemoveTrailingSentencePunctuation (
const String& msg)
const
48 return {msg, nullopt};
51String Impl_en::PluralizeNoun (
const String& s,
const optional<String>& sPlural,
int count)
const
76 if (s[l - 5] ==
'w' and s[l - 4] ==
'i' and s[l - 3] ==
'v' and s[l - 2] ==
'e' and s[l - 1] ==
's') {
87 if (s[s.
length () - 3] ==
'i' and s[s.
length () - 2] ==
'e' and s[s.
length () - 1] ==
's') {
92 else if (s.
length () > 4 and s[s.
length () - 4] ==
's' and s[s.
length () - 3] ==
's' and s[s.
length () - 2] ==
'e' and s[s.
length () - 1] ==
's') {
95 else if (s[s.
length () - 3] ==
's' and s[s.
length () - 2] ==
'e' and s[s.
length () - 1] ==
's') {
99 else if (s[s.
length () - 1] ==
's' and s[s.
length () - 2].IsASCII () and s[s.
length () - 2].IsAlphabetic () and
100 (s[s.
length () - 2] !=
's' and s[s.
length () - 2] !=
'u')) {
113 : fMessageHandlers_{utilObjs}
117shared_ptr<const IRep> Manager::LookupHandler (
const locale& l)
const
119 optional<Common::KeyValuePair<locale, shared_ptr<const IRep>>> cachedVal = fLocaleCache_.load ();
120 if (cachedVal && cachedVal->fKey == l) {
121 return cachedVal->fValue;
123 cachedVal = [&] () ->
KeyValuePair<locale, shared_ptr<const IRep>> {
125 for (
const shared_ptr<const IRep>& h : fMessageHandlers_.load ()) {
126 if (h->AppliesToThisLocale (l)) {
131 return {l, Memory::MakeSharedPtr<Impl_en> ()};
133 fLocaleCache_.store (cachedVal);
134 return cachedVal->fValue;
Similar to String, but intended to more efficiently construct a String. Mutable type (String is large...
nonvirtual size_t length() const noexcept
number of characters, not bytes or code-points
String is like std::u32string, except it is much easier to use, often much more space efficient,...
nonvirtual size_t length() const noexcept
nonvirtual bool EndsWith(const Character &c, CompareOptions co=eWithCase) const
nonvirtual String SubString(SZ from) const
nonvirtual String substr(size_t from, size_t count=npos) const
A generalization of a vector: a container whose elements are keyed by the natural numbers.