Inflection
Morphology Inflection
Loading...
Searching...
No Matches
ULocale.hpp
1/*
2 * Copyright 2016-2024 Apple Inc. All rights reserved.
3 */
4#pragma once
5
6#include <inflection/util/fwd.hpp>
7#include <inflection/Object.hpp>
8#include <string>
9
81class INFLECTION_CLASS_API inflection::util::ULocale
82 : public virtual ::inflection::Object
83{
84public:
86 typedef ::inflection::Object super;
88
89public:
110 ULocale(std::string_view language,
111 std::string_view country = std::string_view(),
112 std::string_view variant = std::string_view(),
113 std::string_view keywordsAndValues = std::string_view());
114
120 ULocale(const ::inflection::util::ULocale& other);
121
122
126 ~ULocale() override;
127
134 ::inflection::util::ULocale& operator=(const ::inflection::util::ULocale& other);
135
142 bool operator==(const ::inflection::util::ULocale& other) const;
143
149 std::strong_ordering operator<=>(const ::inflection::util::ULocale& other) const;
150
155 std::string_view getLanguage( ) const;
156
163 std::string_view getScript( ) const;
164
169 std::string_view getCountry( ) const;
170
175 std::string_view getVariant( ) const;
176
181
189 ::std::u16string toString() const override;
190
198 const ::std::string &getName() const;
199
203 std::size_t operator()(const inflection::util::ULocale& locale) const noexcept;
204
205private:
206 ::std::string language { };
207 ::std::string script { };
208 ::std::string country { };
209 ::std::string variant { };
210 ::std::string fullName { };
211};
212
213inline bool
214inflection::util::ULocale::operator==(const ::inflection::util::ULocale& other) const
215{
216 return other <=> *this == 0;
217}
218
219inline std::strong_ordering
220inflection::util::ULocale::operator<=>(const ::inflection::util::ULocale& other) const
221{
222 return fullName <=> other.fullName;
223}
224
225inline ::std::string_view
227{
228 return country;
229}
230
231inline ::std::string_view
233{
234 return language;
235}
236
237inline ::std::string_view
239{
240 return script;
241}
242
243inline ::std::string_view
245{
246 return variant;
247}
248
249inline const ::std::string &
251{
252 return fullName;
253}
Inflection's root object.
Definition Object.hpp:14
An object that represents a specific geographical, political, or cultural region.
Definition ULocale.hpp:83
ULocale(const ::inflection::util::ULocale &other)
const ::std::string & getName() const
Definition ULocale.hpp:250
std::string_view getScript() const
Definition ULocale.hpp:238
::inflection::util::ULocale & operator=(const ::inflection::util::ULocale &other)
std::string_view getVariant() const
Definition ULocale.hpp:244
std::string_view getCountry() const
Definition ULocale.hpp:226
std::string_view getLanguage() const
Definition ULocale.hpp:232
bool operator==(const ::inflection::util::ULocale &other) const
Definition ULocale.hpp:214
ULocale(std::string_view language, std::string_view country=std::string_view(), std::string_view variant=std::string_view(), std::string_view keywordsAndValues=std::string_view())
::std::u16string toString() const override
ULocale getFallback() const
std::strong_ordering operator<=>(const ::inflection::util::ULocale &other) const
Definition ULocale.hpp:220
std::size_t operator()(const inflection::util::ULocale &locale) const noexcept
The C++ namespace for Inflection.
Definition fwd.hpp:11