| 1 |
#ifndef ICU4XCodePointSetBuilder_HPP |
| 2 |
#define ICU4XCodePointSetBuilder_HPP |
| 3 |
#include <stdint.h> |
| 4 |
#include <stddef.h> |
| 5 |
#include <stdbool.h> |
| 6 |
#include <algorithm> |
| 7 |
#include <memory> |
| 8 |
#include <variant> |
| 9 |
#include <optional> |
| 10 |
#include "diplomat_runtime.hpp" |
| 11 |
|
| 12 |
#include "ICU4XCodePointSetBuilder.h" |
| 13 |
|
| 14 |
class ICU4XCodePointSetBuilder; |
| 15 |
class ICU4XCodePointSetData; |
| 16 |
|
| 17 |
/** |
| 18 |
* A destruction policy for using ICU4XCodePointSetBuilder with std::unique_ptr. |
| 19 |
*/ |
| 20 |
struct ICU4XCodePointSetBuilderDeleter { |
| 21 |
void operator()(capi::ICU4XCodePointSetBuilder* l) const noexcept { |
| 22 |
capi::ICU4XCodePointSetBuilder_destroy(l); |
| 23 |
} |
| 24 |
}; |
| 25 |
|
| 26 |
/** |
| 27 |
* See the [Rust documentation for `CodePointInversionListBuilder`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html) for more information. |
| 28 |
*/ |
| 29 |
class ICU4XCodePointSetBuilder { |
| 30 |
public: |
| 31 |
|
| 32 |
/** |
| 33 |
* Make a new set builder containing nothing |
| 34 |
* |
| 35 |
* See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.new) for more information. |
| 36 |
*/ |
| 37 |
static ICU4XCodePointSetBuilder create(); |
| 38 |
|
| 39 |
/** |
| 40 |
* Build this into a set |
| 41 |
* |
| 42 |
* This object is repopulated with an empty builder |
| 43 |
* |
| 44 |
* See the [Rust documentation for `build`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.build) for more information. |
| 45 |
*/ |
| 46 |
ICU4XCodePointSetData build(); |
| 47 |
|
| 48 |
/** |
| 49 |
* Complements this set |
| 50 |
* |
| 51 |
* (Elements in this set are removed and vice versa) |
| 52 |
* |
| 53 |
* See the [Rust documentation for `complement`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.complement) for more information. |
| 54 |
*/ |
| 55 |
void complement(); |
| 56 |
|
| 57 |
/** |
| 58 |
* Returns whether this set is empty |
| 59 |
* |
| 60 |
* See the [Rust documentation for `is_empty`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.is_empty) for more information. |
| 61 |
*/ |
| 62 |
bool is_empty() const; |
| 63 |
|
| 64 |
/** |
| 65 |
* Add a single character to the set |
| 66 |
* |
| 67 |
* See the [Rust documentation for `add_char`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.add_char) for more information. |
| 68 |
*/ |
| 69 |
void add_char(char32_t ch); |
| 70 |
|
| 71 |
/** |
| 72 |
* Deprecated, use `add_char`. |
| 73 |
* |
| 74 |
* See the [Rust documentation for `add_u32`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.add_u32) for more information. |
| 75 |
*/ |
| 76 |
void add_u32(uint32_t ch); |
| 77 |
|
| 78 |
/** |
| 79 |
* Add an inclusive range of characters to the set |
| 80 |
* |
| 81 |
* See the [Rust documentation for `add_range`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.add_range) for more information. |
| 82 |
*/ |
| 83 |
void add_inclusive_range(char32_t start, char32_t end); |
| 84 |
|
| 85 |
/** |
| 86 |
* Deprecated, use `add_inclusive_range`. |
| 87 |
* |
| 88 |
* See the [Rust documentation for `add_range_u32`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.add_range_u32) for more information. |
| 89 |
*/ |
| 90 |
void add_inclusive_range_u32(uint32_t start, uint32_t end); |
| 91 |
|
| 92 |
/** |
| 93 |
* Add all elements that belong to the provided set to the set |
| 94 |
* |
| 95 |
* See the [Rust documentation for `add_set`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.add_set) for more information. |
| 96 |
*/ |
| 97 |
void add_set(const ICU4XCodePointSetData& data); |
| 98 |
|
| 99 |
/** |
| 100 |
* Remove a single character to the set |
| 101 |
* |
| 102 |
* See the [Rust documentation for `remove_char`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.remove_char) for more information. |
| 103 |
*/ |
| 104 |
void remove_char(char32_t ch); |
| 105 |
|
| 106 |
/** |
| 107 |
* Remove an inclusive range of characters from the set |
| 108 |
* |
| 109 |
* See the [Rust documentation for `remove_range`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.remove_range) for more information. |
| 110 |
*/ |
| 111 |
void remove_inclusive_range(char32_t start, char32_t end); |
| 112 |
|
| 113 |
/** |
| 114 |
* Remove all elements that belong to the provided set from the set |
| 115 |
* |
| 116 |
* See the [Rust documentation for `remove_set`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.remove_set) for more information. |
| 117 |
*/ |
| 118 |
void remove_set(const ICU4XCodePointSetData& data); |
| 119 |
|
| 120 |
/** |
| 121 |
* Removes all elements from the set except a single character |
| 122 |
* |
| 123 |
* See the [Rust documentation for `retain_char`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.retain_char) for more information. |
| 124 |
*/ |
| 125 |
void retain_char(char32_t ch); |
| 126 |
|
| 127 |
/** |
| 128 |
* Removes all elements from the set except an inclusive range of characters f |
| 129 |
* |
| 130 |
* See the [Rust documentation for `retain_range`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.retain_range) for more information. |
| 131 |
*/ |
| 132 |
void retain_inclusive_range(char32_t start, char32_t end); |
| 133 |
|
| 134 |
/** |
| 135 |
* Removes all elements from the set except all elements in the provided set |
| 136 |
* |
| 137 |
* See the [Rust documentation for `retain_set`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.retain_set) for more information. |
| 138 |
*/ |
| 139 |
void retain_set(const ICU4XCodePointSetData& data); |
| 140 |
|
| 141 |
/** |
| 142 |
* Complement a single character to the set |
| 143 |
* |
| 144 |
* (Characters which are in this set are removed and vice versa) |
| 145 |
* |
| 146 |
* See the [Rust documentation for `complement_char`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.complement_char) for more information. |
| 147 |
*/ |
| 148 |
void complement_char(char32_t ch); |
| 149 |
|
| 150 |
/** |
| 151 |
* Complement an inclusive range of characters from the set |
| 152 |
* |
| 153 |
* (Characters which are in this set are removed and vice versa) |
| 154 |
* |
| 155 |
* See the [Rust documentation for `complement_range`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.complement_range) for more information. |
| 156 |
*/ |
| 157 |
void complement_inclusive_range(char32_t start, char32_t end); |
| 158 |
|
| 159 |
/** |
| 160 |
* Complement all elements that belong to the provided set from the set |
| 161 |
* |
| 162 |
* (Characters which are in this set are removed and vice versa) |
| 163 |
* |
| 164 |
* See the [Rust documentation for `complement_set`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html#method.complement_set) for more information. |
| 165 |
*/ |
| 166 |
void complement_set(const ICU4XCodePointSetData& data); |
| 167 |
inline const capi::ICU4XCodePointSetBuilder* AsFFI() const { return this->inner.get(); } |
| 168 |
inline capi::ICU4XCodePointSetBuilder* AsFFIMut() { return this->inner.get(); } |
| 169 |
inline explicit ICU4XCodePointSetBuilder(capi::ICU4XCodePointSetBuilder* i) : inner(i) {} |
| 170 |
ICU4XCodePointSetBuilder() = default; |
| 171 |
ICU4XCodePointSetBuilder(ICU4XCodePointSetBuilder&&) noexcept = default; |
| 172 |
ICU4XCodePointSetBuilder& operator=(ICU4XCodePointSetBuilder&& other) noexcept = default; |
| 173 |
private: |
| 174 |
std::unique_ptr<capi::ICU4XCodePointSetBuilder, ICU4XCodePointSetBuilderDeleter> inner; |
| 175 |
}; |
| 176 |
|
| 177 |
#include "ICU4XCodePointSetData.hpp" |
| 178 |
|
| 179 |
inline ICU4XCodePointSetBuilder ICU4XCodePointSetBuilder::create() { |
| 180 |
return ICU4XCodePointSetBuilder(capi::ICU4XCodePointSetBuilder_create()); |
| 181 |
} |
| 182 |
inline ICU4XCodePointSetData ICU4XCodePointSetBuilder::build() { |
| 183 |
return ICU4XCodePointSetData(capi::ICU4XCodePointSetBuilder_build(this->inner.get())); |
| 184 |
} |
| 185 |
inline void ICU4XCodePointSetBuilder::complement() { |
| 186 |
capi::ICU4XCodePointSetBuilder_complement(this->inner.get()); |
| 187 |
} |
| 188 |
inline bool ICU4XCodePointSetBuilder::is_empty() const { |
| 189 |
return capi::ICU4XCodePointSetBuilder_is_empty(this->inner.get()); |
| 190 |
} |
| 191 |
inline void ICU4XCodePointSetBuilder::add_char(char32_t ch) { |
| 192 |
capi::ICU4XCodePointSetBuilder_add_char(this->inner.get(), ch); |
| 193 |
} |
| 194 |
inline void ICU4XCodePointSetBuilder::add_u32(uint32_t ch) { |
| 195 |
capi::ICU4XCodePointSetBuilder_add_u32(this->inner.get(), ch); |
| 196 |
} |
| 197 |
inline void ICU4XCodePointSetBuilder::add_inclusive_range(char32_t start, char32_t end) { |
| 198 |
capi::ICU4XCodePointSetBuilder_add_inclusive_range(this->inner.get(), start, end); |
| 199 |
} |
| 200 |
inline void ICU4XCodePointSetBuilder::add_inclusive_range_u32(uint32_t start, uint32_t end) { |
| 201 |
capi::ICU4XCodePointSetBuilder_add_inclusive_range_u32(this->inner.get(), start, end); |
| 202 |
} |
| 203 |
inline void ICU4XCodePointSetBuilder::add_set(const ICU4XCodePointSetData& data) { |
| 204 |
capi::ICU4XCodePointSetBuilder_add_set(this->inner.get(), data.AsFFI()); |
| 205 |
} |
| 206 |
inline void ICU4XCodePointSetBuilder::remove_char(char32_t ch) { |
| 207 |
capi::ICU4XCodePointSetBuilder_remove_char(this->inner.get(), ch); |
| 208 |
} |
| 209 |
inline void ICU4XCodePointSetBuilder::remove_inclusive_range(char32_t start, char32_t end) { |
| 210 |
capi::ICU4XCodePointSetBuilder_remove_inclusive_range(this->inner.get(), start, end); |
| 211 |
} |
| 212 |
inline void ICU4XCodePointSetBuilder::remove_set(const ICU4XCodePointSetData& data) { |
| 213 |
capi::ICU4XCodePointSetBuilder_remove_set(this->inner.get(), data.AsFFI()); |
| 214 |
} |
| 215 |
inline void ICU4XCodePointSetBuilder::retain_char(char32_t ch) { |
| 216 |
capi::ICU4XCodePointSetBuilder_retain_char(this->inner.get(), ch); |
| 217 |
} |
| 218 |
inline void ICU4XCodePointSetBuilder::retain_inclusive_range(char32_t start, char32_t end) { |
| 219 |
capi::ICU4XCodePointSetBuilder_retain_inclusive_range(this->inner.get(), start, end); |
| 220 |
} |
| 221 |
inline void ICU4XCodePointSetBuilder::retain_set(const ICU4XCodePointSetData& data) { |
| 222 |
capi::ICU4XCodePointSetBuilder_retain_set(this->inner.get(), data.AsFFI()); |
| 223 |
} |
| 224 |
inline void ICU4XCodePointSetBuilder::complement_char(char32_t ch) { |
| 225 |
capi::ICU4XCodePointSetBuilder_complement_char(this->inner.get(), ch); |
| 226 |
} |
| 227 |
inline void ICU4XCodePointSetBuilder::complement_inclusive_range(char32_t start, char32_t end) { |
| 228 |
capi::ICU4XCodePointSetBuilder_complement_inclusive_range(this->inner.get(), start, end); |
| 229 |
} |
| 230 |
inline void ICU4XCodePointSetBuilder::complement_set(const ICU4XCodePointSetData& data) { |
| 231 |
capi::ICU4XCodePointSetBuilder_complement_set(this->inner.get(), data.AsFFI()); |
| 232 |
} |
| 233 |
#endif |