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
58 culture_info(const std::locale& locale);
71 explicit culture_info(xtd::size culture);
97 explicit culture_info(const xtd::string& name);
112
114
121 auto culture_types() const noexcept -> xtd::globalization::culture_types;
122
128 [[nodiscard]] auto date_time_format() const -> const xtd::globalization::date_time_format_info&;
135
145 [[nodiscard]] auto display_name() const noexcept -> const xtd::string&;
146
154 [[nodiscard]] auto english_name() const noexcept -> const xtd::string&;
155
159 [[nodiscard]] auto is_locale_available() const noexcept -> bool;
160
166 [[nodiscard]] auto is_read_only() const noexcept -> bool;
167
173 [[nodiscard]] auto is_neutral_culture() const noexcept -> bool;
174
178 [[nodiscard]] auto keyboard_layout_id() const noexcept -> xtd::size;
179
185 [[nodiscard]] auto lcid() const noexcept -> xtd::size;
186
193 [[nodiscard]] auto locale() const noexcept -> const std::locale&;
194
200 [[nodiscard]] auto name() const noexcept -> const xtd::string&;
201
205 [[nodiscard]] auto native_name() const noexcept -> const xtd::string&;
206
209 [[nodiscard]] auto number_format() const -> const xtd::globalization::number_format_info&;
213
221 [[nodiscard]] virtual auto parent() const noexcept -> xtd::globalization::culture_info;
222
229 [[nodiscard]] auto three_letter_iso_language_name() const noexcept -> const xtd::string&;
230
236 [[nodiscard]] auto three_letter_windows_language_name() const noexcept -> const xtd::string&;
237
246 [[nodiscard]] auto two_letter_iso_language_name() const noexcept -> const xtd::string&;
247
250 [[nodiscard]] auto use_user_override() const noexcept -> bool;
252
254
261 [[nodiscard]] static auto current_culture() noexcept -> xtd::globalization::culture_info;
266 static auto current_culture(const xtd::globalization::culture_info& value) -> void;
267
270 [[nodiscard]] static auto invariant_culture() noexcept -> xtd::globalization::culture_info;
272
274
282 [[nodiscard]] auto clone() const noexcept -> xtd::globalization::culture_info;
289 auto equals(const xtd::object& obj) const noexcept -> bool override;
290 [[nodiscard]]
293 [[nodiscard]] auto equals(const xtd::globalization::culture_info& obj) const noexcept -> bool override;
294
297 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::size override;
298
304 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
306
308
320 [[nodiscard]] static auto get_culture_info(const xtd::string& name) -> xtd::globalization::culture_info;
327 [[nodiscard]] static auto get_culture_info(const xtd::string& name, bool predefined_only) -> xtd::globalization::culture_info;
339 [[nodiscard]] static auto get_culture_info(const xtd::string& name, const xtd::string& alt_name) -> xtd::globalization::culture_info;
349 [[nodiscard]] static auto get_culture_info(xtd::size culture) -> xtd::globalization::culture_info;
350
363
367 [[nodiscard]] static auto get_system_locales() noexcept -> xtd::array<std::locale>;
368
373 static auto initialize_all_cultures() noexcept -> void;
375
377
385 operator const std::locale& () const noexcept;
387
389 auto operator =(xtd::globalization::culture_info&& culture) -> xtd::globalization::culture_info& = default;
390 auto operator =(const xtd::globalization::culture_info& culture) -> xtd::globalization::culture_info& = default;
391 auto operator =(std::locale&& locale) -> xtd::globalization::culture_info&;
392 auto operator =(const std::locale& locale) -> xtd::globalization::culture_info&;
394
395 private:
397
398 auto fill_from_name(const xtd::string& name) -> void;
399 static auto cultures() -> xtd::collections::generic::dictionary<xtd::string, culture_info>& ;
400 static auto is_system_locale_available(const xtd::string& name) noexcept -> bool;
401
402 static auto to_cldr_name(const xtd::string& name) -> xtd::string;
403 static auto to_locale_name(const xtd::string& name) -> xtd::string;
404
405 struct data;
406 xtd::ptr<data> data_;
407 static xtd::optional<xtd::globalization::culture_info> current_culture_;
408 };
409 }
410}
411
412#include "culture_types.hpp"
413#define __XTD_BOX_INTERNAL__
414#include "../box_.hpp"
415#undef __XTD_BOX_INTERNAL__
416#define __XTD_ENUM_OBJECT_INTERNAL__
417#include "../enum_object_.hpp"
418#undef __XTD_ENUM_OBJECT_INTERNAL__
419#define __XTD_TO_STRING_INTERNAL__
420#include "../to_string_.hpp"
421#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:64
Provides information about a specific culture (called a locale for unmanaged code development)....
Definition culture_info.hpp:43
auto clone() const noexcept -> xtd::globalization::culture_info
Creates a copy of the current xtd::globalization::culture_info.
auto two_letter_iso_language_name() const noexcept -> const xtd::string &
Gets the ISO 639-1 two-letter or ISO 639-3 three-letter code for the language of the current xtd::glo...
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...
auto is_neutral_culture() const noexcept -> bool
Gets a value indicating whether the current xtd::globalization::culture_info represents a neutral cul...
culture_info(const std::locale &locale)
Initializes a new instance of the xtd::globalization::culture_info class with specified locale.
static auto get_culture_info(const xtd::string &name) -> xtd::globalization::culture_info
Retrieves a cached, read-only instance of a culture using the specified culture name.
static auto current_culture() noexcept -> xtd::globalization::culture_info
Gets the xtd::globalization::culture_info object that represents the culture used by the current appl...
static auto get_system_locales() noexcept -> xtd::array< std::locale >
Gets the lists of system locales.
static auto invariant_culture() noexcept -> xtd::globalization::culture_info
Gets the xtd::globalization::culture_info object that is culture-independent (invariant).
static auto initialize_all_cultures() noexcept -> void
Initializes all cultures available in xtd and prevents lazy-loading.
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...
auto to_string() const noexcept -> xtd::string override
Returns a xtd::string that represents the current object.
auto name() const noexcept -> const xtd::string &
Gets the culture name in the format languagecode2-country/regioncode2.
auto is_read_only() const noexcept -> bool
Gets a value indicating whether the current xtd::globalization::culture_info is read-only.
auto native_name() const noexcept -> const xtd::string &
Gets the culture name, consisting of the language, the country/region, and the optional script,...
static auto get_cultures(xtd::globalization::culture_types types) -> xtd::array< xtd::globalization::culture_info >
Gets the list of supported cultures filtered by the specified xtd::globalization::culture_types param...
auto locale() const noexcept -> const std::locale &
Gets the std::locale associate for the current xtd::globalization::culture_info.
culture_info(const xtd::string &name)
Initializes a new instance of the xtd::globalization::culture_info class based on the culture specifi...
auto is_locale_available() const noexcept -> bool
Gets a value indicateing if the std::locale corresponding to this instance is available.
culture_info(xtd::globalization::culture_info &&culture)=default
Initializes a new instance of the xtd::globalization::culture_info class with specified culture.
culture_info(const xtd::globalization::culture_info &culture)=default
Initializes a new instance of the xtd::globalization::culture_info class with specified culture.
auto three_letter_iso_language_name() const noexcept -> const xtd::string &
Gets the ISO 639-2 three-letter code for the language of the current xtd::globalization::culture_info...
auto use_user_override() const noexcept -> bool
Gets a value indicating whether the current xtd::globalization::culture_info object uses the user-sel...
auto lcid() const noexcept -> xtd::size
Gets the culture identifier for the current xtd::globalization::culture_info.
auto culture_types() const noexcept -> xtd::globalization::culture_types
Gets the culture types that pertain to the current xtd::globalization::culture_info object.
culture_info()
Initializes a new instance of the xtd::globalization::culture_info class.
virtual auto parent() const noexcept -> xtd::globalization::culture_info
Gets the xtd::globalization::culture_info that represents the parent culture of the current xtd::glob...
culture_info(xtd::size culture)
Initializes a new instance of the xtd::globalization::culture_info class based on the culture specifi...
auto three_letter_windows_language_name() const noexcept -> const xtd::string &
Gets the three-letter code for the language as defined in the Windows API.
auto english_name() const noexcept -> const xtd::string &
Gets the culture name in the format languagefull [country/regionfull] in English.
auto number_format() const -> const xtd::globalization::number_format_info &
Gets a xtd::globalization::number_format_info that defines the culturally appropriate format of displ...
auto display_name() const noexcept -> const xtd::string &
Gets the full localized culture name.
auto date_time_format() const -> const xtd::globalization::date_time_format_info &
Gets or sets a xtd::globalization::date_time_format_info that defines the culturally appropriate form...
auto equals(const xtd::object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
auto keyboard_layout_id() const noexcept -> xtd::size
Gets the active input locale identifier.
auto get_hash_code() const noexcept -> xtd::size override
Returns the hash code for this basic_string.
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:23
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
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:26
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.