xtd 0.2.0
Loading...
Searching...
No Matches
culture_info.hpp
Go to the documentation of this file.
1
4#pragma once
5
10#include "../core_export.hpp"
11#include "../iequatable.hpp"
12#include "../object.hpp"
13#include "../optional.hpp"
14#include "../string.hpp"
15#include <locale>
16
18namespace xtd {
20 namespace globalization {
22 enum class culture_types;
24
43 class core_export_ culture_info : public xtd::object, public xtd::iequatable<xtd::globalization::culture_info> {
44 public:
46
52 culture_info(culture_info&& culture) = default;
55 culture_info(const culture_info& culture) = default;
58 culture_info(const std::locale& locale);
71 explicit culture_info(xtd::size culture);
97 explicit culture_info(const xtd::string& name);
112
114
122
135
145 const xtd::string& display_name() const noexcept;
146
154 const xtd::string& english_name() const noexcept;
155
159 bool is_locale_available() const noexcept;
160
166 bool is_read_only() const noexcept;
167
173 bool is_neutral_culture() const noexcept;
174
178 xtd::size keyboard_layout_id() const noexcept;
179
185 xtd::size lcid() const noexcept;
186
193 const std::locale& locale() const noexcept;
194
200 const xtd::string& name() const noexcept;
201
205 const xtd::string& native_name() const noexcept;
206
207 const xtd::globalization::number_format_info& number_format() const;
208 xtd::globalization::number_format_info& number_format();
209
217 virtual xtd::globalization::culture_info parent() const noexcept;
218
225 const xtd::string& three_letter_iso_language_name() const noexcept;
226
232 const xtd::string& three_letter_windows_language_name() const noexcept;
233
242 const xtd::string& two_letter_iso_language_name() const noexcept;
243
246 bool use_user_override() const noexcept;
248
250
257 static culture_info current_culture() noexcept;
262 static void current_culture(const culture_info& value);
263
268
270
278 culture_info clone() const noexcept;
285 bool equals(const object& obj) const noexcept override;
289 bool equals(const culture_info& obj) const noexcept override;
290
293 xtd::size get_hash_code() const noexcept override;
294
300 xtd::string to_string() const noexcept override;
302
304
316 static culture_info get_culture_info(const xtd::string& name);
323 static culture_info get_culture_info(const xtd::string& name, bool predefined_only);
335 static culture_info get_culture_info(const xtd::string& name, const xtd::string& alt_name);
346
359
363 static xtd::array<std::locale> get_system_locales() noexcept;
364
369 static void initialize_all_cultures() noexcept;
371
373
381 operator const std::locale& () const noexcept;
383
385 culture_info& operator =(culture_info&& culture) = default;
386 culture_info& operator =(const culture_info& culture) = default;
387 culture_info& operator =(std::locale&& locale);
388 culture_info& operator =(const std::locale& locale);
390
391 private:
393
394 void fill_from_name(const xtd::string& name);
395 static xtd::collections::generic::dictionary<xtd::string, culture_info>& cultures();
396 static bool is_system_locale_available(const xtd::string& name) noexcept;
397
398 static xtd::string to_cldr_name(const xtd::string& name);
399 static xtd::string to_locale_name(const xtd::string& name);
400
401 struct data;
402 ptr<data> data_;
403 static xtd::optional<culture_info> current_culture_;
404 };
405 }
406}
407
408#include "culture_types.hpp"
409#define __XTD_BOX_INTERNAL__
410#include "../box_.hpp"
411#undef __XTD_BOX_INTERNAL__
412#define __XTD_ENUM_OBJECT_INTERNAL__
413#include "../enum_object_.hpp"
414#undef __XTD_ENUM_OBJECT_INTERNAL__
415#define __XTD_TO_STRING_INTERNAL__
416#include "../to_string_.hpp"
417#undef __XTD_TO_STRING_INTERNAL__
Contains xtd::box::to_string method.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:63
xtd::size keyboard_layout_id() const noexcept
Gets the active input locale identifier.
static xtd::array< culture_info > get_cultures(xtd::globalization::culture_types types)
Gets the list of supported cultures filtered by the specified xtd::globalization::culture_types param...
culture_info(xtd::size culture, bool use_user_override)
Initializes a new instance of the xtd::globalization::culture_info class based on the culture specifi...
const xtd::string & two_letter_iso_language_name() const noexcept
Gets the ISO 639-1 two-letter or ISO 639-3 three-letter code for the language of the current xtd::glo...
const std::locale & locale() const noexcept
Gets the std::locale associate for the current xtd::globalization::culture_info.
virtual xtd::globalization::culture_info parent() const noexcept
Gets the xtd::globalization::culture_info that represents the parent culture of the current xtd::glob...
culture_info(const std::locale &locale)
Initializes a new instance of the xtd::globalization::culture_info class with specified locale.
static culture_info current_culture() noexcept
Gets the xtd::globalization::culture_info object that represents the culture used by the current appl...
const xtd::globalization::date_time_format_info & date_time_format() const
Gets or sets a xtd::globalization::date_time_format_info that defines the culturally appropriate form...
const xtd::string & display_name() const noexcept
Gets the full localized culture name.
culture_info(const xtd::string &name, bool use_user_override)
Initializes a new instance of the xtd::globalization::culture_info class based on the culture specifi...
xtd::size get_hash_code() const noexcept override
Returns the hash code for this basic_string.
const xtd::string & three_letter_iso_language_name() const noexcept
Gets the ISO 639-2 three-letter code for the language of the current xtd::globalization::culture_info...
culture_info(const culture_info &culture)=default
Initializes a new instance of the xtd::globalization::culture_info class with specified culture.
const xtd::string & three_letter_windows_language_name() const noexcept
Gets the three-letter code for the language as defined in the Windows API.
bool equals(const object &obj) const noexcept override
Determines whether the specified object is equal to the current object.
culture_info(const xtd::string &name)
Initializes a new instance of the xtd::globalization::culture_info class based on the culture specifi...
xtd::size lcid() const noexcept
Gets the culture identifier for the current xtd::globalization::culture_info.
const xtd::string & native_name() const noexcept
Gets the culture name, consisting of the language, the country/region, and the optional script,...
xtd::globalization::culture_types culture_types() const noexcept
Gets the culture types that pertain to the current xtd::globalization::culture_info object.
static culture_info get_culture_info(const xtd::string &name)
Retrieves a cached, read-only instance of a culture using the specified culture name.
xtd::string to_string() const noexcept override
Returns a xtd::string that represents the current object.
bool is_neutral_culture() const noexcept
Gets a value indicating whether the current xtd::globalization::culture_info represents a neutral cul...
culture_info clone() const noexcept
Creates a copy of the current xtd::globalization::culture_info.
static void initialize_all_cultures() noexcept
Initializes all cultures available in xtd and prevents lazy-loading.
static xtd::array< std::locale > get_system_locales() noexcept
Gets the lists of system locales.
culture_info()
Initializes a new instance of the xtd::globalization::culture_info class.
culture_info(xtd::size culture)
Initializes a new instance of the xtd::globalization::culture_info class based on the culture specifi...
bool is_locale_available() const noexcept
Gets a value indicateing if the std::locale corresponding to this instance is available.
bool use_user_override() const noexcept
Gets a value indicating whether the current xtd::globalization::culture_info object uses the user-sel...
culture_info(culture_info &&culture)=default
Initializes a new instance of the xtd::globalization::culture_info class with specified culture.
bool is_read_only() const noexcept
Gets a value indicating whether the current xtd::globalization::culture_info is read-only.
static culture_info invariant_culture() noexcept
Gets the xtd::globalization::culture_info object that is culture-independent (invariant).
const xtd::string & name() const noexcept
Gets the culture name in the format languagecode2-country/regioncode2.
const xtd::string & english_name() const noexcept
Gets the culture name in the format languagefull [country/regionfull] in English.
Provides culture-specific information about the format of date and time values.
Definition date_time_format_info.hpp:42
Provides culture-specific information about the format of numbers, currency, and percentages.
Definition number_format_info.hpp:35
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:44
Contains core_export_ keyword.
Contains xtd::globalization::culture_not_found_exception exception.
Contains xtd::globalization::date_time_format_info class.
Contains xtd::collections::generic::dictionary <key_t, value_t> class.
Contains xtd::enum_object::to_string method.
culture_types
Defines the types of culture lists that can be retrieved using the xtd::globalization::culture_info::...
Definition culture_types.hpp:21
#define core_export_
Define shared library export.
Definition core_export.hpp:13
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
xtd::sptr< type_t > ptr
The xtd::ptr object is a shared pointer.
Definition ptr.hpp:27
std::optional< type_t > optional
Represents the optional alias on std::optional.
Definition optional.hpp:25
Contains xtd::iequatable interface.
The xtd::collections namespace contains interfaces and classes that define various collections of obj...
Definition any_pair.hpp:10
Contains classes that define culture-related information, including language, country/region,...
Definition culture_info.hpp:20
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
Contains xtd::globalization::number_format_info class.
Contains xtd::object class.
Contains xtd::optional type.
Contains xtd::string alias.
Contains xtd::to_string methods.