1 2 3 4 5 6 7 8
|
#define SELECTCASE(sMainStr) { AnsiString sTmpStr = sMainStr; if (0) {
#define CASEANY(N, ...) } else if (SelectCase(sTmpStr, N, __VA_ARGS__)) {
#define ELSE } else {
#define ENDSELECT }}
#define GET_NUM_ARGS_IMPL(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, N, ...) N
#define GET_NUM_ARGS(...) GET_NUM_ARGS_IMPL(__VA_ARGS__, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
#define CASE(...) CASEANY(GET_NUM_ARGS(__VA_ARGS__), __VA_ARGS__)
|