summaryrefslogtreecommitdiffstats
path: root/intl/icu_capi/cpp/docs/source/locale_ffi.rst
blob: f65b658972466a7e57255d07d23ff2f9804838c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
``locale::ffi``
===============

.. cpp:class:: ICU4XLocale

    An ICU4X Locale, capable of representing strings like ``"en-US"``.

    See the `Rust documentation for Locale <https://docs.rs/icu/latest/icu/locid/struct.Locale.html>`__ for more information.


    .. cpp:function:: static diplomat::result<ICU4XLocale, ICU4XError> create_from_string(const std::string_view name)

        Construct an :cpp:class:`ICU4XLocale` from an locale identifier.

        This will run the complete locale parsing algorithm. If code size and performance are critical and the locale is of a known shape (such as ``aa-BB``) use ``create_und``, ``set_language``, ``set_script``, and ``set_region``.

        See the `Rust documentation for try_from_bytes <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.try_from_bytes>`__ for more information.


    .. cpp:function:: static ICU4XLocale create_und()

        Construct a default undefined :cpp:class:`ICU4XLocale` "und".

        See the `Rust documentation for UND <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#associatedconstant.UND>`__ for more information.


    .. cpp:function:: ICU4XLocale clone() const

        Clones the :cpp:class:`ICU4XLocale`.

        See the `Rust documentation for Locale <https://docs.rs/icu/latest/icu/locid/struct.Locale.html>`__ for more information.


    .. cpp:function:: template<typename W> diplomat::result<std::monostate, ICU4XError> basename_to_writeable(W& write) const

        Write a string representation of the ``LanguageIdentifier`` part of :cpp:class:`ICU4XLocale` to ``write``.

        See the `Rust documentation for id <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id>`__ for more information.


    .. cpp:function:: diplomat::result<std::string, ICU4XError> basename() const

        Write a string representation of the ``LanguageIdentifier`` part of :cpp:class:`ICU4XLocale` to ``write``.

        See the `Rust documentation for id <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id>`__ for more information.


    .. cpp:function:: template<typename W> diplomat::result<std::monostate, ICU4XError> get_unicode_extension_to_writeable(const std::string_view bytes, W& write) const

        Write a string representation of the unicode extension to ``write``

        See the `Rust documentation for extensions <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.extensions>`__ for more information.


    .. cpp:function:: diplomat::result<std::string, ICU4XError> get_unicode_extension(const std::string_view bytes) const

        Write a string representation of the unicode extension to ``write``

        See the `Rust documentation for extensions <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.extensions>`__ for more information.


    .. cpp:function:: template<typename W> diplomat::result<std::monostate, ICU4XError> language_to_writeable(W& write) const

        Write a string representation of :cpp:class:`ICU4XLocale` language to ``write``

        See the `Rust documentation for id <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id>`__ for more information.


    .. cpp:function:: diplomat::result<std::string, ICU4XError> language() const

        Write a string representation of :cpp:class:`ICU4XLocale` language to ``write``

        See the `Rust documentation for id <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id>`__ for more information.


    .. cpp:function:: diplomat::result<std::monostate, ICU4XError> set_language(const std::string_view bytes)

        Set the language part of the :cpp:class:`ICU4XLocale`.

        See the `Rust documentation for try_from_bytes <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.try_from_bytes>`__ for more information.


    .. cpp:function:: template<typename W> diplomat::result<std::monostate, ICU4XError> region_to_writeable(W& write) const

        Write a string representation of :cpp:class:`ICU4XLocale` region to ``write``

        See the `Rust documentation for id <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id>`__ for more information.


    .. cpp:function:: diplomat::result<std::string, ICU4XError> region() const

        Write a string representation of :cpp:class:`ICU4XLocale` region to ``write``

        See the `Rust documentation for id <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id>`__ for more information.


    .. cpp:function:: diplomat::result<std::monostate, ICU4XError> set_region(const std::string_view bytes)

        Set the region part of the :cpp:class:`ICU4XLocale`.

        See the `Rust documentation for try_from_bytes <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.try_from_bytes>`__ for more information.


    .. cpp:function:: template<typename W> diplomat::result<std::monostate, ICU4XError> script_to_writeable(W& write) const

        Write a string representation of :cpp:class:`ICU4XLocale` script to ``write``

        See the `Rust documentation for id <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id>`__ for more information.


    .. cpp:function:: diplomat::result<std::string, ICU4XError> script() const

        Write a string representation of :cpp:class:`ICU4XLocale` script to ``write``

        See the `Rust documentation for id <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id>`__ for more information.


    .. cpp:function:: diplomat::result<std::monostate, ICU4XError> set_script(const std::string_view bytes)

        Set the script part of the :cpp:class:`ICU4XLocale`. Pass an empty string to remove the script.

        See the `Rust documentation for try_from_bytes <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.try_from_bytes>`__ for more information.


    .. cpp:function:: template<typename W> static diplomat::result<std::monostate, ICU4XError> canonicalize_to_writeable(const std::string_view bytes, W& write)

        Best effort locale canonicalizer that doesn't need any data

        Use ICU4XLocaleCanonicalizer for better control and functionality

        See the `Rust documentation for canonicalize <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.canonicalize>`__ for more information.


    .. cpp:function:: static diplomat::result<std::string, ICU4XError> canonicalize(const std::string_view bytes)

        Best effort locale canonicalizer that doesn't need any data

        Use ICU4XLocaleCanonicalizer for better control and functionality

        See the `Rust documentation for canonicalize <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.canonicalize>`__ for more information.


    .. cpp:function:: template<typename W> diplomat::result<std::monostate, ICU4XError> to_string_to_writeable(W& write) const

        Write a string representation of :cpp:class:`ICU4XLocale` to ``write``

        See the `Rust documentation for write_to <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.write_to>`__ for more information.


    .. cpp:function:: diplomat::result<std::string, ICU4XError> to_string() const

        Write a string representation of :cpp:class:`ICU4XLocale` to ``write``

        See the `Rust documentation for write_to <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.write_to>`__ for more information.


    .. cpp:function:: bool normalizing_eq(const std::string_view other) const

        See the `Rust documentation for normalizing_eq <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.normalizing_eq>`__ for more information.


    .. cpp:function:: ICU4XOrdering strict_cmp(const std::string_view other) const

        See the `Rust documentation for strict_cmp <https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.strict_cmp>`__ for more information.


    .. cpp:function:: static ICU4XLocale create_en()

        Deprecated

        Use `create_from_string("en").


    .. cpp:function:: static ICU4XLocale create_bn()

        Deprecated

        Use `create_from_string("bn").