/usr/include/libpwiz/libraries/boost_aux/boost/enum/macros.hpp is in libpwiz-dev 3.0.9393-1+b2.
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 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 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | ///////////////////////////////////////////////////////////////////////////////
// enum_macros.hpp: macros to generate an enum model
//
// Copyright 2005 Frank Laub
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_ENUM_MACROS_HPP
#define BOOST_ENUM_MACROS_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#include <boost/preprocessor.hpp>
#include <cstring>
#define BOOST_ENUM_IS_COLUMN_2(i, k) \
BOOST_PP_EQUAL(BOOST_PP_MOD(i, 2), k)
#define BOOST_ENUM_GET_COLUMN_2(r, data, i, elem) \
BOOST_PP_IF(BOOST_ENUM_IS_COLUMN_2(i, data), BOOST_PP_IDENTITY((elem)), BOOST_PP_EMPTY)()
#define BOOST_ENUM_VISITOR1(_seq, _macro, _col) \
BOOST_PP_SEQ_FOR_EACH_I(_macro, _, _seq)
#define BOOST_ENUM_VISITOR2(_seq, _macro, _col) \
BOOST_PP_SEQ_FOR_EACH_I( \
_macro, \
_, \
BOOST_PP_SEQ_FOR_EACH_I(BOOST_ENUM_GET_COLUMN_2, _col, _seq) \
)
#define BOOST_ENUM_DOMAIN_ITEM(r, data, i, elem) \
BOOST_PP_COMMA_IF(i) elem
#define BOOST_ENUM_domain(_seq, _col, _colsize) \
enum domain \
{ \
BOOST_PP_CAT(BOOST_ENUM_VISITOR, _colsize) \
(_seq, BOOST_ENUM_DOMAIN_ITEM, _col) \
}; \
BOOST_STATIC_CONSTANT(index_type, size = BOOST_ENUM_size(_seq, _colsize));
#define BOOST_ENUM_size(_seq, _colsize) \
BOOST_PP_DIV(BOOST_PP_SEQ_SIZE(_seq), _colsize)
#define BOOST_ENUM_PARSE_ITEM(r, data, i, elem) \
if(strcmp(str, BOOST_PP_STRINGIZE(elem)) == 0) return optional(elem);
#define BOOST_ENUM_get_by_name(_name, _seq, _col, _colsize) \
static optional get_by_name(const char* str) \
{ \
BOOST_PP_CAT(BOOST_ENUM_VISITOR, _colsize) \
(_seq, BOOST_ENUM_PARSE_ITEM, _col) \
return optional(); \
}
#define BOOST_ENUM_CASE_STRING(r, data, i, elem) \
case elem: return BOOST_PP_STRINGIZE(elem);
#define BOOST_ENUM_names(_seq, _col, _colsize) \
static const char* names(domain index) \
{ \
BOOST_ASSERT(static_cast<index_type>(index) < size); \
switch(index) \
{ \
BOOST_PP_CAT(BOOST_ENUM_VISITOR, _colsize) \
(_seq, BOOST_ENUM_CASE_STRING, _col) \
default: return NULL; \
} \
}
#define BOOST_ENUM_CASE_PART(elem) \
case (elem):
#define BOOST_ENUM_VALUE_PART(elem) \
return optional_value(elem);
#define BOOST_ENUM_VALUE_LINE(r, data, i, elem) \
BOOST_PP_IF(BOOST_ENUM_IS_COLUMN_2(i, 0), \
BOOST_ENUM_CASE_PART(elem), \
BOOST_ENUM_VALUE_PART(elem) \
)
#define BOOST_ENUM_values_identity() \
typedef boost::optional<value_type> optional_value; \
static optional_value values(domain index) \
{ \
if(static_cast<index_type>(index) < size) return optional_value(index); \
return optional_value(); \
}
#define BOOST_ENUM_values(_seq, _name_col, _value_col, _colsize) \
typedef boost::optional<value_type> optional_value; \
static optional_value values(domain index) \
{ \
switch(index) \
{ \
BOOST_PP_SEQ_FOR_EACH_I(BOOST_ENUM_VALUE_LINE, _, _seq) \
default: return optional_value(); \
} \
}
#define BOOST_BITFIELD_names(_seq, _col, _colsize) \
static const char* names(domain index) \
{ \
BOOST_ASSERT(static_cast<index_type>(index) < size); \
switch(index) \
{ \
case all_mask: return "all_mask"; \
BOOST_PP_CAT(BOOST_ENUM_VISITOR, _colsize) \
(_seq, BOOST_ENUM_CASE_STRING, _col) \
default: return NULL; \
} \
}
#define BOOST_BITFIELD_OR_ITEM(r, data, i, elem) \
| (elem)
#define BOOST_BITFIELD_domain(_seq, _col, _colsize) \
enum domain \
{ \
BOOST_PP_CAT(BOOST_ENUM_VISITOR, _colsize) \
(_seq, BOOST_ENUM_DOMAIN_ITEM, _col), \
all_mask, \
not_mask \
}; \
BOOST_STATIC_CONSTANT(index_type, size = BOOST_ENUM_size(_seq, _colsize));
#define BOOST_BITFIELD_all_mask(_seq, _col, _colsize) \
0 BOOST_PP_CAT(BOOST_ENUM_VISITOR, _colsize) \
(_seq, BOOST_BITFIELD_OR_ITEM, _col)
#define BOOST_BITFIELD_get_by_name(_name, _seq, _col, _colsize) \
static optional get_by_name(const char* str) \
{ \
if(strcmp(str, "all_mask") == 0) return optional(all_mask); \
if(strcmp(str, "not_mask") == 0) return optional(not_mask); \
BOOST_PP_CAT(BOOST_ENUM_VISITOR, _colsize) \
(_seq, BOOST_ENUM_PARSE_ITEM, _col) \
return optional(); \
}
#define BOOST_BITFIELD_values(_seq, _name_col, _value_col, _colsize) \
typedef boost::optional<value_type> optional_value; \
static optional_value values(domain index) \
{ \
switch(index) \
{ \
BOOST_PP_SEQ_FOR_EACH_I(BOOST_ENUM_VALUE_LINE, _, _seq) \
case all_mask: return optional_value(BOOST_BITFIELD_all_mask(_seq, _value_col, _colsize)); \
case not_mask: return optional_value(~(BOOST_BITFIELD_all_mask(_seq, _value_col, _colsize))); \
default: return optional_value(); \
} \
}
#define BOOST_ENUM_EX(_name, _interface, _seq) \
class _interface _name : public boost::detail::enum_base<_name> \
{ \
public: \
BOOST_ENUM_domain(_seq, 0, 1) \
_name() {} \
_name(domain index) : boost::detail::enum_base<_name>(index) {} \
BOOST_ENUM_get_by_name(_name, _seq, 0, 1) \
private: \
friend class boost::detail::enum_base<_name>; \
BOOST_ENUM_names(_seq, 0, 1) \
BOOST_ENUM_values_identity() \
};
#define BOOST_ENUM(_name, _seq) BOOST_ENUM_EX(_name, , _seq)
#define BOOST_ENUM_VALUES_EX(_name, _interface, _type, _seq) \
class _interface _name : public boost::detail::enum_base<_name, _type> \
{ \
public: \
BOOST_ENUM_domain(_seq, 0, 2) \
_name() {} \
_name(domain index) : boost::detail::enum_base<_name, _type>(index) {} \
BOOST_ENUM_get_by_name(_name, _seq, 0, 2) \
private: \
friend class boost::detail::enum_base<_name, _type>; \
BOOST_ENUM_names(_seq, 0, 2) \
BOOST_ENUM_values(_seq, 0, 1, 2) \
};
#define BOOST_ENUM_VALUES(_name, _type, _seq) BOOST_ENUM_VALUES_EX(_name, , _type, _seq)
#define BOOST_BITFIELD_EX(_name, _interface, _seq) \
class _interface _name : public boost::detail::bitfield_base<_name> \
{ \
public: \
BOOST_BITFIELD_domain(_seq, 0, 2) \
_name() {} \
_name(domain index) : boost::detail::bitfield_base<_name>(index) {} \
BOOST_ENUM_get_by_name(_name, _seq, 0, 2) \
private: \
friend class boost::detail::bitfield_access; \
_name(value_type raw, int) : boost::detail::bitfield_base<_name>(raw, 0) {} \
BOOST_BITFIELD_names(_seq, 0, 2) \
BOOST_BITFIELD_values(_seq, 0, 1, 2) \
};
#define BOOST_BITFIELD(_name, _seq) BOOST_BITFIELD_EX(_name, , _seq)
#define BOOST_ENUM_DOMAIN_OPERATORS(_name) \
inline bool operator== (const _name::domain& lhs, const _name& rhs) {return rhs == lhs;} \
inline bool operator!= (const _name::domain& lhs, const _name& rhs) {return rhs != lhs;} \
inline bool operator< (const _name::domain& lhs, const _name& rhs) {return rhs < lhs;} \
inline bool operator> (const _name::domain& lhs, const _name& rhs) {return rhs > lhs;} \
inline bool operator<= (const _name::domain& lhs, const _name& rhs) {return rhs <= lhs;} \
inline bool operator>= (const _name::domain& lhs, const _name& rhs) {return rhs >= lhs;}
#define BOOST_BITFIELD_DOMAIN_OPERATORS(_name) \
BOOST_ENUM_DOMAIN_OPERATORS(_name) \
inline _name operator| (const _name::domain& lhs, const _name::domain& rhs) {return _name(lhs) | rhs;} \
inline _name operator& (const _name::domain& lhs, const _name::domain& rhs) {return _name(lhs) & rhs;}
#endif
|