/usr/include/x86_64-linux-gnu/unicode/enumset.h is in libicu-dev 52.1-3ubuntu0.8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /*
******************************************************************************
*
* Copyright (C) 2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
*/
/**
* \file
* \brief C++: internal template EnumSet<>
*/
#ifndef ENUMSET_H
#define ENUMSET_H
#include "unicode/utypes.h"
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* enum bitset for boolean fields. Similar to Java EnumSet<>.
* Needs to range check.
* @internal
*/
template<typename T, uint32_t minValue, uint32_t limitValue>
class EnumSet {
public:
inline EnumSet() : fBools(0) {}
inline EnumSet(const EnumSet<T,minValue,limitValue>& other) : fBools(other.fBools) {}
inline ~EnumSet() {}
inline void clear() { fBools=0; }
inline void add(T toAdd) { set(toAdd, 1); }
inline void remove(T toRemove) { set(toRemove, 0); }
inline int32_t contains(T toCheck) const { return get(toCheck); }
inline void set(T toSet, int32_t v) { fBools=(fBools&(~flag(toSet)))|(v?(flag(toSet)):0); }
inline int32_t get(T toCheck) const { return (fBools & flag(toCheck))?1:0; }
inline UBool isValidEnum(T toCheck) const { return (toCheck>=minValue&&toCheck<limitValue); }
inline UBool isValidValue(int32_t v) const { return (v==0||v==1); }
inline const EnumSet<T,minValue,limitValue>& operator=(const EnumSet<T,minValue,limitValue>& other) {
fBools = other.fBools;
return *this;
}
inline uint32_t getAll() const {
return fBools;
}
private:
inline uint32_t flag(T toCheck) const { return (1<<(toCheck-minValue)); }
private:
uint32_t fBools;
};
U_NAMESPACE_END
#endif /* U_SHOW_CPLUSPLUS_API */
#endif /* ENUMSET_H */
|