| 1 | #pragma once |
|---|
| 2 | |
|---|
| 3 | #include <string> |
|---|
| 4 | #include <strEx.h> |
|---|
| 5 | |
|---|
| 6 | void generate_crc32_table(void); |
|---|
| 7 | unsigned long calculate_crc32(const char *buffer, int buffer_size); |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | #define MAP_OPTIONS_BEGIN(args) \ |
|---|
| 11 | for (std::list<std::string>::const_iterator cit__=args.begin();cit__!=args.end();++cit__) { \ |
|---|
| 12 | std::pair<std::string,std::string> p__ = strEx::split(*cit__,"="); if (false) {} |
|---|
| 13 | |
|---|
| 14 | #define MAP_OPTIONS_SHOWALL(obj) \ |
|---|
| 15 | else if (p__.first == SHOW_ALL) { if (p__.second == "long") obj.show = checkHolders::showLong; else obj.show = checkHolders::showShort; } \ |
|---|
| 16 | else if (p__.first == SHOW_FAIL) { obj.show = checkHolders::showProblems; } |
|---|
| 17 | |
|---|
| 18 | #define MAP_OPTIONS_DISK_ALL(obj, postfix, pfUpper, pfLower) \ |
|---|
| 19 | else if (p__.first == "MaxWarn" pfUpper) { obj.warn.max.upper = p__.second; } \ |
|---|
| 20 | else if (p__.first == "MaxCrit" pfUpper) { obj.crit.max.upper = p__.second; } \ |
|---|
| 21 | else if (p__.first == "MinWarn" pfUpper) { obj.warn.min.upper = p__.second; } \ |
|---|
| 22 | else if (p__.first == "MinCrit" pfUpper) { obj.crit.min.upper = p__.second; } \ |
|---|
| 23 | else if (p__.first == "MaxWarn" pfLower) { obj.warn.max.lower = p__.second; } \ |
|---|
| 24 | else if (p__.first == "MaxCrit" pfLower) { obj.crit.max.lower = p__.second; } \ |
|---|
| 25 | else if (p__.first == "MinWarn" pfLower) { obj.warn.min.lower = p__.second; } \ |
|---|
| 26 | else if (p__.first == "MinCrit" pfLower) { obj.crit.min.lower = p__.second; } \ |
|---|
| 27 | else if (p__.first == "MaxWarn" postfix) { obj.warn.max.lower = p__.second; } \ |
|---|
| 28 | else if (p__.first == "MaxCrit" postfix) { obj.crit.max.lower = p__.second; } \ |
|---|
| 29 | else if (p__.first == "MinWarn" postfix) { obj.warn.min.upper = p__.second; } \ |
|---|
| 30 | else if (p__.first == "MinCrit" postfix) { obj.crit.min.upper = p__.second; } |
|---|
| 31 | |
|---|
| 32 | #define MAP_OPTIONS_NUMERIC_ALL(obj, postfix) \ |
|---|
| 33 | else if (p__.first == ("MaxWarn" postfix)) { obj.warn.max = p__.second; } \ |
|---|
| 34 | else if (p__.first == ("MaxCrit" postfix)) { obj.crit.max = p__.second; } \ |
|---|
| 35 | else if (p__.first == ("MinWarn" postfix)) { obj.warn.min = p__.second; } \ |
|---|
| 36 | else if (p__.first == ("MinCrit" postfix)) { obj.crit.min = p__.second; } |
|---|
| 37 | |
|---|
| 38 | #define MAP_OPTIONS_PUSH_WTYPE(type, value, obj, list) \ |
|---|
| 39 | else if (p__.first == value) { type o; o.obj = p__.second; list.push_back(o); } |
|---|
| 40 | #define MAP_OPTIONS_PUSH(value, list) \ |
|---|
| 41 | else if (p__.first == value) { list.push_back(p__.second); } |
|---|
| 42 | #define MAP_OPTIONS_INSERT(value, list) \ |
|---|
| 43 | else if (p__.first == value) { list.insert(p__.second); } |
|---|
| 44 | #define MAP_OPTIONS_DO(action) \ |
|---|
| 45 | else if (p__.first == value) { action; } |
|---|
| 46 | #define MAP_OPTIONS_STR(value, obj) \ |
|---|
| 47 | else if (p__.first == value) { obj = p__.second; } |
|---|
| 48 | #define MAP_OPTIONS_STR2INT(value, obj) \ |
|---|
| 49 | else if (p__.first == value) { obj = atoi(p__.second.c_str()); } |
|---|
| 50 | #define MAP_OPTIONS_STR_AND(value, obj, extra) \ |
|---|
| 51 | else if (p__.first == value) { obj = p__.second; extra;} |
|---|
| 52 | #define MAP_OPTIONS_BOOL_TRUE(value, obj) \ |
|---|
| 53 | else if (p__.first == value) { obj = true; } |
|---|
| 54 | #define MAP_OPTIONS_BOOL_FALSE(value, obj) \ |
|---|
| 55 | else if (p__.first == value) { obj = false; } |
|---|
| 56 | #define MAP_OPTIONS_BOOL_VALUE(value, obj, tStr) \ |
|---|
| 57 | else if ((p__.first == value)&&(p__.second == tStr)) { obj = true; } |
|---|
| 58 | #define MAP_OPTIONS_MODE(value, tStr, obj, oVal) \ |
|---|
| 59 | else if ((p__.first == value)&&(p__.second == tStr)) { obj = oVal; } |
|---|
| 60 | #define MAP_OPTIONS_BOOL_EX(value, obj, tStr, fStr) \ |
|---|
| 61 | else if ((p__.first == value)&&(p__.second == tStr)) { obj = true; } \ |
|---|
| 62 | else if ((p__.first == value)&&(p__.second == fStr)) { obj = false; } |
|---|
| 63 | #define MAP_OPTIONS_MISSING(arg, str) \ |
|---|
| 64 | else { arg = str + p__.first; return NSCAPI::returnUNKNOWN; } |
|---|
| 65 | #define MAP_OPTIONS_FALLBACK(obj) \ |
|---|
| 66 | else { obj = p__.first;} |
|---|
| 67 | #define MAP_OPTIONS_FALLBACK_AND(obj, extra) \ |
|---|
| 68 | else { obj = p__.first; extra;} |
|---|
| 69 | #define MAP_OPTIONS_END() } |
|---|
| 70 | |
|---|
| 71 | #define MAP_OPTIONS_MISSING_EX(opt, arg, str) \ |
|---|
| 72 | else { arg = str + opt.first; return NSCAPI::returnUNKNOWN; } |
|---|
| 73 | |
|---|
| 74 | #define MAP_OPTIONS_SECONDARY_BEGIN(splt, arg) \ |
|---|
| 75 | else if (p__.first.find(splt) != std::string::npos) { \ |
|---|
| 76 | std::pair<std::string,std::string> arg = strEx::split(p__.first,splt); if (false) {} |
|---|
| 77 | |
|---|
| 78 | #define MAP_OPTIONS_SECONDARY_END() } |
|---|