File indexing completed on 2025-01-18 09:53:36
0001
0002
0003
0004
0005
0006
0007 #if !defined(BOOST_VMD_DETAIL_IDENTIFIER_HPP)
0008 #define BOOST_VMD_DETAIL_IDENTIFIER_HPP
0009
0010 #include <boost/preprocessor/arithmetic/dec.hpp>
0011 #include <boost/preprocessor/comparison/equal.hpp>
0012 #include <boost/preprocessor/control/expr_iif.hpp>
0013 #include <boost/preprocessor/control/iif.hpp>
0014 #include <boost/preprocessor/logical/bitand.hpp>
0015 #include <boost/preprocessor/logical/bitor.hpp>
0016 #include <boost/preprocessor/punctuation/is_begin_parens.hpp>
0017 #include <boost/preprocessor/tuple/elem.hpp>
0018 #include <boost/preprocessor/variadic/elem.hpp>
0019 #include <boost/vmd/identity.hpp>
0020 #include <boost/vmd/is_empty.hpp>
0021 #include <boost/vmd/detail/identifier_concat.hpp>
0022 #include <boost/vmd/detail/is_entire.hpp>
0023 #include <boost/vmd/detail/match_identifier.hpp>
0024 #include <boost/vmd/detail/mods.hpp>
0025 #include <boost/vmd/detail/not_empty.hpp>
0026 #include <boost/vmd/detail/parens.hpp>
0027
0028 #define BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS_SUCCESS(id,rest,keymatch,mods) \
0029 BOOST_VMD_DETAIL_IDENTIFIER_SUCCESS_MODS(id,rest,BOOST_PP_DEC(keymatch),mods) \
0030
0031
0032 #define BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS_FAILURE(id,rest,keymatch,mods) \
0033 BOOST_VMD_DETAIL_IDENTIFIER_FAILURE_MODS(mods) \
0034
0035
0036 #define BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS_TUPLE_RESULT(id,rest,keymatch,mods) \
0037 BOOST_PP_IIF \
0038 ( \
0039 BOOST_PP_EQUAL(keymatch,0), \
0040 BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS_FAILURE, \
0041 BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS_SUCCESS \
0042 ) \
0043 (id,rest,keymatch,mods) \
0044
0045
0046 #define BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS_TUPLE_RESULT_D(d,id,rest,keymatch,mods) \
0047 BOOST_PP_IIF \
0048 ( \
0049 BOOST_PP_EQUAL_D(d,keymatch,0), \
0050 BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS_FAILURE, \
0051 BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS_SUCCESS \
0052 ) \
0053 (id,rest,keymatch,mods) \
0054
0055
0056 #define BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS_TUPLE(id,rest,keytuple,mods) \
0057 BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS_TUPLE_RESULT \
0058 ( \
0059 id, \
0060 rest, \
0061 BOOST_VMD_DETAIL_MATCH_IDENTIFIER(id,keytuple), \
0062 mods \
0063 ) \
0064
0065
0066 #define BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS_TUPLE_D(d,id,rest,keytuple,mods) \
0067 BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS_TUPLE_RESULT_D \
0068 ( \
0069 d, \
0070 id, \
0071 rest, \
0072 BOOST_VMD_DETAIL_MATCH_IDENTIFIER_D(d,id,keytuple), \
0073 mods \
0074 ) \
0075
0076
0077 #define BOOST_VMD_DETAIL_IDENTIFIER_MAKE_SPLIT(tuple) \
0078 ( \
0079 BOOST_PP_TUPLE_ELEM \
0080 ( \
0081 0, \
0082 BOOST_PP_TUPLE_ELEM(0,tuple) \
0083 ), \
0084 BOOST_PP_TUPLE_ELEM(1,tuple) \
0085 ) \
0086
0087
0088 #define BOOST_VMD_DETAIL_IDENTIFIER_SPLIT_SEQUENCE_CONCAT_DATA(tuple) \
0089 BOOST_VMD_IDENTITY_RESULT \
0090 ( \
0091 BOOST_PP_IIF \
0092 ( \
0093 BOOST_VMD_IS_EMPTY \
0094 ( \
0095 BOOST_PP_TUPLE_ELEM(0,tuple) \
0096 ), \
0097 BOOST_VMD_IDENTITY(tuple), \
0098 BOOST_VMD_DETAIL_IDENTIFIER_MAKE_SPLIT \
0099 ) \
0100 (tuple) \
0101 ) \
0102
0103
0104 #define BOOST_VMD_DETAIL_IDENTIFIER_SPLIT_SEQUENCE_CONCAT(vcseq) \
0105 BOOST_VMD_DETAIL_IDENTIFIER_SPLIT_SEQUENCE_CONCAT_DATA \
0106 ( \
0107 BOOST_VMD_DETAIL_PARENS(vcseq,BOOST_VMD_RETURN_AFTER) \
0108 ) \
0109
0110
0111 #define BOOST_VMD_DETAIL_IDENTIFIER_GETID_TID(tid) \
0112 BOOST_VMD_IDENTITY_RESULT \
0113 ( \
0114 BOOST_PP_IIF \
0115 ( \
0116 BOOST_VMD_IS_EMPTY(tid), \
0117 BOOST_VMD_IDENTITY(tid), \
0118 BOOST_PP_TUPLE_ELEM \
0119 ) \
0120 (0,tid) \
0121 ) \
0122
0123
0124 #define BOOST_VMD_DETAIL_IDENTIFIER_GETID_SEQUENCE(vseq) \
0125 BOOST_VMD_DETAIL_IDENTIFIER_GETID_TID \
0126 ( \
0127 BOOST_VMD_DETAIL_PARENS(BOOST_VMD_DETAIL_IDENTIFIER_CONCATENATE(vseq)) \
0128 ) \
0129
0130
0131 #define BOOST_VMD_DETAIL_IDENTIFIER_SPLIT_SEQUENCE(vseq) \
0132 BOOST_VMD_DETAIL_IDENTIFIER_SPLIT_SEQUENCE_CONCAT \
0133 ( \
0134 BOOST_VMD_DETAIL_IDENTIFIER_CONCATENATE(vseq) \
0135 ) \
0136
0137
0138 #define BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS(id,rest,mods) \
0139 BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS_TUPLE \
0140 ( \
0141 id, \
0142 rest, \
0143 BOOST_VMD_DETAIL_MODS_RESULT_OTHER(mods), \
0144 mods \
0145 ) \
0146
0147
0148 #define BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS_D(d,id,rest,mods) \
0149 BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS_TUPLE_D \
0150 ( \
0151 d, \
0152 id, \
0153 rest, \
0154 BOOST_VMD_DETAIL_MODS_RESULT_OTHER(mods), \
0155 mods \
0156 ) \
0157
0158
0159 #define BOOST_VMD_DETAIL_IDENTIFIER_JUST(id,rest,mods) \
0160 BOOST_VMD_DETAIL_IDENTIFIER_SUCCESS_MODS(id,rest,0,mods) \
0161
0162
0163 #define BOOST_VMD_DETAIL_IDENTIFIER_JUST_D(d,id,rest,mods) \
0164 BOOST_VMD_DETAIL_IDENTIFIER_SUCCESS_MODS(id,rest,0,mods) \
0165
0166
0167 #define BOOST_VMD_DETAIL_IDENTIFIER_CHECK_KEYS(id,rest,mods) \
0168 BOOST_PP_IIF \
0169 ( \
0170 BOOST_VMD_IS_EMPTY \
0171 ( \
0172 BOOST_VMD_DETAIL_MODS_RESULT_OTHER(mods) \
0173 ), \
0174 BOOST_VMD_DETAIL_IDENTIFIER_JUST, \
0175 BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS \
0176 ) \
0177 (id,rest,mods) \
0178
0179
0180 #define BOOST_VMD_DETAIL_IDENTIFIER_CHECK_KEYS_D(d,id,rest,mods) \
0181 BOOST_PP_IIF \
0182 ( \
0183 BOOST_VMD_IS_EMPTY \
0184 ( \
0185 BOOST_VMD_DETAIL_MODS_RESULT_OTHER(mods) \
0186 ), \
0187 BOOST_VMD_DETAIL_IDENTIFIER_JUST_D, \
0188 BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_KEYS_D \
0189 ) \
0190 (d,id,rest,mods) \
0191
0192
0193 #define BOOST_VMD_DETAIL_IDENTIFIER_MKEYS(mods) \
0194 BOOST_PP_BITAND \
0195 ( \
0196 BOOST_VMD_DETAIL_MODS_IS_RESULT_INDEX(mods), \
0197 BOOST_VMD_DETAIL_NOT_EMPTY \
0198 ( \
0199 BOOST_VMD_DETAIL_MODS_RESULT_OTHER(mods) \
0200 ) \
0201 ) \
0202
0203
0204 #define BOOST_VMD_DETAIL_IDENTIFIER_SUCCESS_MODS(id,rest,keymatch,mods) \
0205 BOOST_PP_IIF \
0206 ( \
0207 BOOST_VMD_DETAIL_IDENTIFIER_MKEYS(mods), \
0208 BOOST_PP_IIF \
0209 ( \
0210 BOOST_VMD_DETAIL_MODS_IS_RESULT_AFTER(mods), \
0211 (id,rest,keymatch), \
0212 (id,keymatch) \
0213 ), \
0214 BOOST_PP_IIF \
0215 ( \
0216 BOOST_VMD_DETAIL_MODS_IS_RESULT_AFTER(mods), \
0217 (id,rest), \
0218 id \
0219 ) \
0220 ) \
0221
0222
0223 #define BOOST_VMD_DETAIL_IDENTIFIER_FAILURE_MODS(mods) \
0224 BOOST_PP_IIF \
0225 ( \
0226 BOOST_VMD_DETAIL_IDENTIFIER_MKEYS(mods), \
0227 BOOST_PP_IIF \
0228 ( \
0229 BOOST_VMD_DETAIL_MODS_IS_RESULT_AFTER(mods), \
0230 (,,), \
0231 (,) \
0232 ), \
0233 BOOST_PP_EXPR_IIF \
0234 ( \
0235 BOOST_VMD_DETAIL_MODS_IS_RESULT_AFTER(mods), \
0236 (,) \
0237 ) \
0238 ) \
0239
0240
0241 #define BOOST_VMD_DETAIL_IDENTIFIER_FAILURE_REST(id,rest,mods) \
0242 BOOST_VMD_DETAIL_IDENTIFIER_FAILURE_MODS(mods) \
0243
0244
0245 #define BOOST_VMD_DETAIL_IDENTIFIER_FAILURE_REST_D(d,id,rest,mods) \
0246 BOOST_VMD_DETAIL_IDENTIFIER_FAILURE_MODS(mods) \
0247
0248
0249 #define BOOST_VMD_DETAIL_IDENTIFIER_ID_REST(id,rest,mods) \
0250 BOOST_PP_IIF \
0251 ( \
0252 BOOST_VMD_IS_EMPTY(id), \
0253 BOOST_VMD_DETAIL_IDENTIFIER_FAILURE_REST, \
0254 BOOST_VMD_DETAIL_IDENTIFIER_CHECK_KEYS \
0255 ) \
0256 (id,rest,mods) \
0257
0258
0259 #define BOOST_VMD_DETAIL_IDENTIFIER_ID_REST_D(d,id,rest,mods) \
0260 BOOST_PP_IIF \
0261 ( \
0262 BOOST_VMD_IS_EMPTY(id), \
0263 BOOST_VMD_DETAIL_IDENTIFIER_FAILURE_REST_D, \
0264 BOOST_VMD_DETAIL_IDENTIFIER_CHECK_KEYS_D \
0265 ) \
0266 (d,id,rest,mods) \
0267
0268
0269 #define BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_DATA(tuple,mods) \
0270 BOOST_VMD_DETAIL_IDENTIFIER_ID_REST \
0271 ( \
0272 BOOST_PP_TUPLE_ELEM(0,tuple), \
0273 BOOST_PP_TUPLE_ELEM(1,tuple), \
0274 mods \
0275 ) \
0276
0277
0278 #define BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_ID(id,mods) \
0279 BOOST_PP_IIF \
0280 ( \
0281 BOOST_VMD_IS_EMPTY(id), \
0282 BOOST_VMD_DETAIL_IDENTIFIER_FAILURE_REST, \
0283 BOOST_VMD_DETAIL_IDENTIFIER_CHECK_KEYS \
0284 ) \
0285 (id,,mods) \
0286
0287
0288 #define BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_ID_D(d,id,mods) \
0289 BOOST_PP_IIF \
0290 ( \
0291 BOOST_VMD_IS_EMPTY(id), \
0292 BOOST_VMD_DETAIL_IDENTIFIER_FAILURE_REST_D, \
0293 BOOST_VMD_DETAIL_IDENTIFIER_CHECK_KEYS_D \
0294 ) \
0295 (d,id,,mods) \
0296
0297
0298 #define BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_DATA_D(d,tuple,mods) \
0299 BOOST_VMD_DETAIL_IDENTIFIER_ID_REST_D \
0300 ( \
0301 d, \
0302 BOOST_PP_TUPLE_ELEM(0,tuple), \
0303 BOOST_PP_TUPLE_ELEM(1,tuple), \
0304 mods \
0305 ) \
0306
0307
0308 #define BOOST_VMD_DETAIL_IDENTIFIER_SEQUENCE_AFTER(vseq,mods) \
0309 BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_DATA \
0310 ( \
0311 BOOST_VMD_DETAIL_IDENTIFIER_SPLIT_SEQUENCE(vseq), \
0312 mods \
0313 ) \
0314
0315
0316 #define BOOST_VMD_DETAIL_IDENTIFIER_SEQUENCE_AFTER_D(d,vseq,mods) \
0317 BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_DATA_D \
0318 ( \
0319 d, \
0320 BOOST_VMD_DETAIL_IDENTIFIER_SPLIT_SEQUENCE(vseq), \
0321 mods \
0322 ) \
0323
0324
0325 #define BOOST_VMD_DETAIL_IDENTIFIER_SEQUENCE_ID(vseq,mods) \
0326 BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_ID \
0327 ( \
0328 BOOST_VMD_DETAIL_IDENTIFIER_GETID_SEQUENCE(vseq), \
0329 mods \
0330 ) \
0331
0332
0333 #define BOOST_VMD_DETAIL_IDENTIFIER_SEQUENCE_ID_D(d,vseq,mods) \
0334 BOOST_VMD_DETAIL_IDENTIFIER_PROCESS_ID_D \
0335 ( \
0336 d, \
0337 BOOST_VMD_DETAIL_IDENTIFIER_GETID_SEQUENCE(vseq), \
0338 mods \
0339 ) \
0340
0341
0342 #define BOOST_VMD_DETAIL_IDENTIFIER_SEQUENCE(vseq,mods) \
0343 BOOST_PP_IIF \
0344 ( \
0345 BOOST_VMD_DETAIL_MODS_IS_RESULT_AFTER(mods), \
0346 BOOST_VMD_DETAIL_IDENTIFIER_SEQUENCE_AFTER, \
0347 BOOST_VMD_DETAIL_IDENTIFIER_SEQUENCE_ID \
0348 ) \
0349 (vseq,mods) \
0350
0351
0352 #define BOOST_VMD_DETAIL_IDENTIFIER_SEQUENCE_D(d,vseq,mods) \
0353 BOOST_PP_IIF \
0354 ( \
0355 BOOST_VMD_DETAIL_MODS_IS_RESULT_AFTER(mods), \
0356 BOOST_VMD_DETAIL_IDENTIFIER_SEQUENCE_AFTER_D, \
0357 BOOST_VMD_DETAIL_IDENTIFIER_SEQUENCE_ID_D \
0358 ) \
0359 (d,vseq,mods) \
0360
0361
0362 #define BOOST_VMD_DETAIL_IDENTIFIER_EX_FAILURE(vseq,mods) \
0363 BOOST_VMD_DETAIL_IDENTIFIER_FAILURE_MODS(mods) \
0364
0365
0366 #define BOOST_VMD_DETAIL_IDENTIFIER_EX_FAILURE_D(d,vseq,mods) \
0367 BOOST_VMD_DETAIL_IDENTIFIER_FAILURE_MODS(mods) \
0368
0369
0370 #define BOOST_VMD_DETAIL_IDENTIFIER_EX(vseq,mods) \
0371 BOOST_PP_IIF \
0372 ( \
0373 BOOST_PP_BITOR \
0374 ( \
0375 BOOST_VMD_IS_EMPTY(vseq), \
0376 BOOST_PP_IS_BEGIN_PARENS(vseq) \
0377 ), \
0378 BOOST_VMD_DETAIL_IDENTIFIER_EX_FAILURE, \
0379 BOOST_VMD_DETAIL_IDENTIFIER_SEQUENCE \
0380 ) \
0381 (vseq,mods) \
0382
0383
0384 #define BOOST_VMD_DETAIL_IDENTIFIER_EX_D(d,vseq,mods) \
0385 BOOST_PP_IIF \
0386 ( \
0387 BOOST_PP_BITOR \
0388 ( \
0389 BOOST_VMD_IS_EMPTY(vseq), \
0390 BOOST_PP_IS_BEGIN_PARENS(vseq) \
0391 ), \
0392 BOOST_VMD_DETAIL_IDENTIFIER_EX_FAILURE_D, \
0393 BOOST_VMD_DETAIL_IDENTIFIER_SEQUENCE_D \
0394 ) \
0395 (d,vseq,mods) \
0396
0397
0398 #define BOOST_VMD_DETAIL_IDENTIFIER(...) \
0399 BOOST_VMD_DETAIL_IDENTIFIER_EX \
0400 ( \
0401 BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__), \
0402 BOOST_VMD_DETAIL_NEW_MODS(BOOST_VMD_ALLOW_INDEX,__VA_ARGS__) \
0403 ) \
0404
0405
0406 #define BOOST_VMD_DETAIL_IDENTIFIER_D(d,...) \
0407 BOOST_VMD_DETAIL_IDENTIFIER_EX_D \
0408 ( \
0409 d, \
0410 BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__), \
0411 BOOST_VMD_DETAIL_NEW_MODS_D(d,BOOST_VMD_ALLOW_INDEX,__VA_ARGS__) \
0412 ) \
0413
0414
0415 #define BOOST_VMD_DETAIL_IS_IDENTIFIER_MULTIPLE(...) \
0416 BOOST_VMD_DETAIL_IS_ENTIRE \
0417 ( \
0418 BOOST_VMD_DETAIL_IDENTIFIER(__VA_ARGS__,BOOST_VMD_RETURN_AFTER) \
0419 ) \
0420
0421
0422 #define BOOST_VMD_DETAIL_IS_IDENTIFIER_MULTIPLE_D(d,...) \
0423 BOOST_VMD_DETAIL_IS_ENTIRE \
0424 ( \
0425 BOOST_VMD_DETAIL_IDENTIFIER_D(d,__VA_ARGS__,BOOST_VMD_RETURN_AFTER) \
0426 ) \
0427
0428
0429 #endif