xtd 0.2.0
Loading...
Searching...
No Matches
culture_info.hpp
Go to the documentation of this file.
1
4#pragma once
5
7#include "culture_types.hpp"
8#include "../core_export.hpp"
9#include "../iequatable.hpp"
10#include "../object.hpp"
11#include "../optional.hpp"
12#include "../string.hpp"
13#include <locale>
14
16namespace xtd {
18 namespace globalization {
37 class culture_info : public xtd::object, public xtd::iequatable<xtd::globalization::culture_info> {
38 public:
40
46 culture_info(culture_info&& culture) = default;
49 culture_info(const culture_info& culture) = default;
52 culture_info(const std::locale& locale);
65 explicit culture_info(xtd::size culture);
77 explicit culture_info(const xtd::string& name);
79
81
89 const xtd::string& display_name() const noexcept;
90 const xtd::string& english_name() const noexcept;
91 bool is_locale_available() const noexcept;
92 xtd::size keyboard_layout_id() const noexcept;
93 xtd::size lcid() const noexcept;
94 const std::locale& locale() const noexcept;
95 const xtd::string& name() const noexcept;
96 const xtd::string& native_name() const noexcept;
98
100
102 static culture_info current_culture() noexcept;
103 static void current_culture(const culture_info& value);
104 static culture_info invariant_culture() noexcept;
106
108
116 bool equals(const object& obj) const noexcept override;
120 bool equals(const culture_info& obj) const noexcept override;
126 xtd::string to_string() const noexcept override;
128
130
132 static xtd::array<culture_info> get_cultures(xtd::globalization::culture_types types) noexcept;
134
136
138 culture_info& operator =(culture_info&& culture) = default;
139 culture_info& operator =(const culture_info& culture) = default;
140 culture_info& operator =(std::locale&& locale);
141 culture_info& operator =(const std::locale& locale);
142
143 operator const std::locale& () const noexcept;
145
146 private:
147 culture_info(xtd::globalization::culture_types culture_types, string&& display_name, string&& english_name, xtd::size keyboard_layout_id, xtd::size lcid, string&& name, string&& native_name);
148
149 void fill_from_name(const xtd::string& name);
150 static bool is_system_locale_available(const xtd::string& name) noexcept;
151
152 static xtd::string to_cldr_name(const xtd::string& name);
153 static xtd::string to_locale_name(const xtd::string& name);
154
155 struct data {
157 xtd::string display_name = "Invariant Language (Invariant Country)";
158 xtd::string english_name = "Invariant Language (Invariant Country)";
159 xtd::size keyboard_layout_id = 127;
160 xtd::size lcid = 127;
161 std::locale locale = std::locale {""};
162 xtd::string name;
163 xtd::string native_name = "Invariant Language (Invariant Country)";
164 };
165 ptr<data> data_ = new_ptr<data>();
166 static xtd::array<culture_info> cultures_;
167 static xtd::optional<culture_info> current_culture_;
168 };
169 }
170}
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:63
culture_info(const std::locale &locale)
Initializes a new instance of the xtd::globalization::culture_info class with specified locale.
culture_info(const culture_info &culture)=default
Initializes a new instance of the xtd::globalization::culture_info class with specified culture.
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::globalization::culture_types culture_types() const noexcept
Gets the culture types that pertain to the current xtd::globalization::culture_info object.
xtd::string to_string() const noexcept override
Returns a xtd::string that represents the current object.
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...
culture_info(culture_info &&culture)=default
Initializes a new instance of the xtd::globalization::culture_info class with specified culture.
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::culture_type enum class.
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
culture_types
Defines the types of culture lists that can be retrieved using the xtd::globalization::culture_info::...
Definition culture_types.hpp:21
ptr< type_t > new_ptr(args_t &&... args)
The xtd::new_ptr operator creates a xtd::ptr object.
Definition new_ptr.hpp:24
@ specific_cultures
Cultures that are specific to a country/region.
Definition culture_types.hpp:25
Contains xtd::iequatable interface.
Contains classes that define culture-related information, including language, country/region,...
Definition culture_info.hpp:18
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::object class.
Contains xtd::optional type.
Contains xtd::string alias.