22#if U_SHOW_CPLUSPLUS_API
33template<
typename T, u
int32_t minValue, u
int32_t limitValue>
36 inline EnumSet() : fBools(0) {}
37 inline EnumSet(
const EnumSet<T,minValue,limitValue>& other) : fBools(other.fBools) {}
39#ifndef U_HIDE_INTERNAL_API
40 inline void clear() { fBools=0; }
41 inline void add(T toAdd) { set(toAdd, 1); }
42 inline void remove(T toRemove) { set(toRemove, 0); }
43 inline int32_t contains(T toCheck)
const {
return get(toCheck); }
44 inline void set(T toSet, int32_t v) { fBools=(fBools&(~flag(toSet)))|(v?(flag(toSet)):0); }
45 inline int32_t get(T toCheck)
const {
return (fBools & flag(toCheck))?1:0; }
46 inline UBool isValidEnum(T toCheck)
const {
return (toCheck>=minValue&&toCheck<limitValue); }
47 inline UBool isValidValue(int32_t v)
const {
return (v==0||v==1); }
48 inline const EnumSet<T,minValue,limitValue>& operator=(
const EnumSet<T,minValue,limitValue>& other) {
49 fBools = other.fBools;
53 inline uint32_t getAll()
const {
59 inline uint32_t flag(T toCheck)
const {
return (1<<(toCheck-minValue)); }
int8_t UBool
The ICU boolean type, a signed-byte integer.
Basic definitions for ICU, for both C and C++ APIs.