4#include "Stroika/Foundation/StroikaPreComp.h"
11#include "Stroika/Foundation/Containers/Collection.h"
15#include "MessageUtilities.h"
29bool Impl_en::AppliesToThisLocale (
const locale& l)
const
31 return String::FromNarrowSDKString (locale{}.name ()).StartsWith (String::FromNarrowSDKString (l.name ()), eCaseInsensitive);
35pair<String, optional<String>> Impl_en::RemoveTrailingSentencePunctuation (
const String& msg)
const
47 return {msg, nullopt};
50String Impl_en::PluralizeNoun (
const String& s,
const optional<String>& sPlural,
int count)
const
75 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') {
86 if (s[s.
length () - 3] ==
'i' and s[s.
length () - 2] ==
'e' and s[s.
length () - 1] ==
's') {
91 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') {
94 else if (s[s.
length () - 3] ==
's' and s[s.
length () - 2] ==
'e' and s[s.
length () - 1] ==
's') {
98 else if (s[s.
length () - 1] ==
's' and s[s.
length () - 2].IsASCII () and s[s.
length () - 2].IsAlphabetic () and
99 (s[s.
length () - 2] !=
's' and s[s.
length () - 2] !=
'u')) {
112 : fMessageHandlers_{utilObjs}
116shared_ptr<const IRep> Manager::LookupHandler (
const locale& l)
const
118 optional<Common::KeyValuePair<locale, shared_ptr<const IRep>>> cachedVal = fLocaleCache_.load ();
119 if (cachedVal && cachedVal->fKey == l) {
120 return cachedVal->fValue;
122 cachedVal = [&] () ->
KeyValuePair<locale, shared_ptr<const IRep>> {
124 for (
const shared_ptr<const IRep>& h : fMessageHandlers_.load ()) {
125 if (h->AppliesToThisLocale (l)) {
130 return {l, make_shared<Impl_en> ()};
132 fLocaleCache_.store (cachedVal);
133 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.