diff --git a/src/json/FirebaseJson.cpp b/src/json/FirebaseJson.cpp index 95e1a49..11d319b 100644 --- a/src/json/FirebaseJson.cpp +++ b/src/json/FirebaseJson.cpp @@ -1,9 +1,9 @@ /* - * FirebaseJson, version 3.0.8 + * FirebaseJson, version 3.0.10 * * The Easiest Arduino library to parse, create and edit JSON object using a relative path. * - * Created June 14, 2023 + * Created March 25, 2024 * * Features * - Using path to access node element in search style e.g. json.get(result,"a/b/c") diff --git a/src/json/FirebaseJson.h b/src/json/FirebaseJson.h index 8c846dd..5ccd2f0 100644 --- a/src/json/FirebaseJson.h +++ b/src/json/FirebaseJson.h @@ -1,9 +1,9 @@ /* - * FirebaseJson, version 3.0.9 + * FirebaseJson, version 3.0.10 * * The Easiest Arduino library to parse, create and edit JSON object using a relative path. * - * Created November 17, 2023 + * Created March 25, 2024 * * Features * - Using path to access node element in search style e.g. json.get(result,"a/b/c") @@ -385,7 +385,7 @@ class FirebaseJsonData * This should call after parse or get function. */ template - auto to() -> typename MB_ENABLE_IF::value || is_num_float::value || is_bool::value, T>::type + auto to() -> typename std::enable_if::value || is_num_float::value || is_bool::value, T>::type { if (is_bool::value) return iVal.uint32 > 0; @@ -405,28 +405,28 @@ class FirebaseJsonData return iVal.int64; else if (is_num_uint64::value) return iVal.uint64; - else if (MB_IS_SAME::value) + else if (std::is_same::value) return fVal.f; - else if (MB_IS_SAME::value) + else if (std::is_same::value) return fVal.d; else return 0; } template - auto to() -> typename MB_ENABLE_IF::value || is_std_string::value || is_arduino_string::value || is_mb_string::value, T>::type + auto to() -> typename std::enable_if::value || is_std_string::value || is_arduino_string::value || is_mb_string::value, T>::type { return stringValue.c_str(); } template - auto get(T &json) -> typename MB_ENABLE_IF::value>::type + auto get(T &json) -> typename std::enable_if::value>::type { getJSON(json); } template - auto get(T &arr) -> typename MB_ENABLE_IF::value>::type + auto get(T &arr) -> typename std::enable_if::value>::type { getArray(arr); } @@ -517,20 +517,20 @@ class FirebaseJsonData void *newP(size_t len); template - auto getStr(const T &val, uint32_t &addr) -> typename MB_ENABLE_IF::value || is_arduino_string::value || is_mb_string::value || MB_IS_SAME::value, const char *>::type + auto getStr(const T &val, uint32_t &addr) -> typename std::enable_if::value || is_arduino_string::value || is_mb_string::value || std::is_same::value, const char *>::type { addr = 0; return val.c_str(); } template - auto getStr(T val, uint32_t &addr) -> typename MB_ENABLE_IF::value, const char *>::type + auto getStr(T val, uint32_t &addr) -> typename std::enable_if::value, const char *>::type { return getStr(reinterpret_cast(val), addr); } template - auto getStr(T val, uint32_t &addr) -> typename MB_ENABLE_IF::value, const char *>::type + auto getStr(T val, uint32_t &addr) -> typename std::enable_if::value, const char *>::type { int len = strlen_P((PGM_P)val) + 1; char *out = (char *)newP(len); @@ -705,7 +705,7 @@ class FirebaseJsonBase MB_String buf; template - auto getStr(T val, uint32_t &addr) -> typename MB_ENABLE_IF::value || is_num_int::value || MB_IS_SAME::value || MB_IS_SAME::value || MB_IS_SAME::value, const char *>::type + auto getStr(T val, uint32_t &addr) -> typename std::enable_if::value || is_num_int::value || std::is_same::value || std::is_same::value || std::is_same::value, const char *>::type { MB_String t; @@ -713,9 +713,9 @@ class FirebaseJsonBase t.appendNum(val, 0); else if (is_num_int::value) t.appendNum(val, -1); - else if (MB_IS_SAME::value) + else if (std::is_same::value) t.appendNum(val, floatDigits); - else if (MB_IS_SAME::value || MB_IS_SAME::value) + else if (std::is_same::value || std::is_same::value) t.appendNum(val, doubleDigits); char *out = (char *)newP(t.length() + 1); @@ -726,20 +726,20 @@ class FirebaseJsonBase } template - auto getStr(const T &val, uint32_t &addr) -> typename MB_ENABLE_IF::value || is_arduino_string::value || is_mb_string::value || MB_IS_SAME::value, const char *>::type + auto getStr(const T &val, uint32_t &addr) -> typename std::enable_if::value || is_arduino_string::value || is_mb_string::value || std::is_same::value, const char *>::type { addr = 0; return val.c_str(); } template - auto getStr(T val, uint32_t &addr) -> typename MB_ENABLE_IF::value, const char *>::type + auto getStr(T val, uint32_t &addr) -> typename std::enable_if::value, const char *>::type { return getStr(reinterpret_cast(val), addr); } template - auto getStr(T val, uint32_t &addr) -> typename MB_ENABLE_IF::value, const char *>::type + auto getStr(T val, uint32_t &addr) -> typename std::enable_if::value, const char *>::type { int len = strlen_P((PGM_P)val) + 1; char *out = (char *)newP(len); @@ -756,7 +756,7 @@ class FirebaseJsonBase if (!root || !ptr) return false; - if (MB_IS_SAME::value) + if (std::is_same::value) { char *p = prettify ? MB_JSON_Print(root) : MB_JSON_PrintUnformatted(root); if (p) @@ -770,7 +770,7 @@ class FirebaseJsonBase } template - auto toStringHandler(T &out, bool prettify) -> typename MB_ENABLE_IF::value, bool>::type + auto toStringHandler(T &out, bool prettify) -> typename std::enable_if::value, bool>::type { if (!root) return false; @@ -786,7 +786,7 @@ class FirebaseJsonBase } template - auto toStringHandler(T &out, bool prettify) -> typename MB_ENABLE_IF::value, bool>::type + auto toStringHandler(T &out, bool prettify) -> typename std::enable_if::value, bool>::type { char *p = prettify ? MB_JSON_Print(root) : MB_JSON_PrintUnformatted(root); if (p) @@ -799,7 +799,7 @@ class FirebaseJsonBase } template - auto toStringHandler(T &out, bool prettify) -> typename MB_ENABLE_IF::value, bool>::type + auto toStringHandler(T &out, bool prettify) -> typename std::enable_if::value, bool>::type { return writeStream(out, prettify); } @@ -807,13 +807,13 @@ class FirebaseJsonBase #if defined(MB_JSON_FS_H) #if defined(MB_ARDUINO_PICO) template - auto toStringHandler(T &out, bool prettify) -> typename MB_ENABLE_IF::value, bool>::type + auto toStringHandler(T &out, bool prettify) -> typename std::enable_if::value, bool>::type { return writeStream(out, prettify); } #else template - auto toStringHandler(T &out, bool prettify) -> typename MB_ENABLE_IF::value, bool>::type + auto toStringHandler(T &out, bool prettify) -> typename std::enable_if::value, bool>::type { return writeStream(out, prettify); } @@ -2014,7 +2014,7 @@ class FirebaseJsonArray : public FirebaseJsonBase bool mRemoveIdx(int index); template - auto dataGetHandler(T arg, FirebaseJsonData &result, bool prettify) -> typename MB_ENABLE_IF::value, bool>::type + auto dataGetHandler(T arg, FirebaseJsonData &result, bool prettify) -> typename std::enable_if::value, bool>::type { uint32_t addr = 0; bool ret = mGet(root, &result, getStr(arg, addr), prettify); @@ -2023,13 +2023,13 @@ class FirebaseJsonArray : public FirebaseJsonBase } template - auto dataGetHandler(T arg, FirebaseJsonData &result, bool prettify) -> typename MB_ENABLE_IF::value, bool>::type + auto dataGetHandler(T arg, FirebaseJsonData &result, bool prettify) -> typename std::enable_if::value, bool>::type { return mGetIdx(&result, arg, prettify); } template - auto dataRemoveHandler(T arg) -> typename MB_ENABLE_IF::value, bool>::type + auto dataRemoveHandler(T arg) -> typename std::enable_if::value, bool>::type { uint32_t addr = 0; bool ret = mRemove(getStr(arg, addr)); @@ -2038,13 +2038,13 @@ class FirebaseJsonArray : public FirebaseJsonBase } template - auto dataRemoveHandler(T arg) -> typename MB_ENABLE_IF::value, bool>::type + auto dataRemoveHandler(T arg) -> typename std::enable_if::value, bool>::type { return mRemoveIdx(arg); } template - auto dataAddHandler(T arg) -> typename MB_ENABLE_IF::value, FirebaseJsonArray &>::type + auto dataAddHandler(T arg) -> typename std::enable_if::value, FirebaseJsonArray &>::type { if (root_type != Root_Type_JSONArray) mClear(); @@ -2056,7 +2056,7 @@ class FirebaseJsonArray : public FirebaseJsonBase } template - auto dataAddHandler(T arg) -> typename MB_ENABLE_IF::value, FirebaseJsonArray &>::type + auto dataAddHandler(T arg) -> typename std::enable_if::value, FirebaseJsonArray &>::type { if (root_type != Root_Type_JSONArray) mClear(); @@ -2068,7 +2068,7 @@ class FirebaseJsonArray : public FirebaseJsonBase } template - auto dataAddHandler(T arg) -> typename MB_ENABLE_IF::value, FirebaseJsonArray &>::type + auto dataAddHandler(T arg) -> typename std::enable_if::value, FirebaseJsonArray &>::type { if (root_type != Root_Type_JSONArray) mClear(); @@ -2080,7 +2080,7 @@ class FirebaseJsonArray : public FirebaseJsonBase } template - auto dataAddHandler(T arg) -> typename MB_ENABLE_IF::value || MB_IS_SAME::value, FirebaseJsonArray &>::type + auto dataAddHandler(T arg) -> typename std::enable_if::value || std::is_same::value, FirebaseJsonArray &>::type { if (root_type != Root_Type_JSONArray) mClear(); @@ -2092,7 +2092,7 @@ class FirebaseJsonArray : public FirebaseJsonBase } template - auto dataAddHandler(T arg) -> typename MB_ENABLE_IF::value, FirebaseJsonArray &>::type + auto dataAddHandler(T arg) -> typename std::enable_if::value, FirebaseJsonArray &>::type { if (root_type != Root_Type_JSONArray) mClear(); @@ -2107,7 +2107,7 @@ class FirebaseJsonArray : public FirebaseJsonBase #if !defined(__AVR__) template - auto dataSetHandler(T1 arg1, T2 arg2) -> typename MB_ENABLE_IF::value && MB_IS_SAME::value>::type + auto dataSetHandler(T1 arg1, T2 arg2) -> typename std::enable_if::value && std::is_same::value>::type { if (root_type != Root_Type_JSONArray) mClear(); @@ -2120,14 +2120,14 @@ class FirebaseJsonArray : public FirebaseJsonBase } template - auto dataSetHandler(T1 arg1, T2 arg2) -> typename MB_ENABLE_IF<(is_num_int::value || is_num_float::value || is_bool::value) && MB_IS_SAME::value>::type + auto dataSetHandler(T1 arg1, T2 arg2) -> typename std::enable_if<(is_num_int::value || is_num_float::value || is_bool::value) && std::is_same::value>::type { mSetIdx(arg1, MB_JSON_CreateNull); } #endif template - auto dataSetHandler(T1 arg1, T2 arg2) -> typename MB_ENABLE_IF::value && is_bool::value>::type + auto dataSetHandler(T1 arg1, T2 arg2) -> typename std::enable_if::value && is_bool::value>::type { if (root_type != Root_Type_JSONArray) mClear(); @@ -2140,13 +2140,13 @@ class FirebaseJsonArray : public FirebaseJsonBase } template - auto dataSetHandler(T1 arg1, T2 arg2) -> typename MB_ENABLE_IF<(is_num_int::value || is_num_float::value || is_bool::value) && is_bool::value>::type + auto dataSetHandler(T1 arg1, T2 arg2) -> typename std::enable_if<(is_num_int::value || is_num_float::value || is_bool::value) && is_bool::value>::type { mSetIdx(arg1, MB_JSON_CreateBool(arg2)); } template - auto dataSetHandler(T1 arg1, T2 arg2) -> typename MB_ENABLE_IF::value && is_num_int::value>::type + auto dataSetHandler(T1 arg1, T2 arg2) -> typename std::enable_if::value && is_num_int::value>::type { if (root_type != Root_Type_JSONArray) mClear(); @@ -2159,13 +2159,13 @@ class FirebaseJsonArray : public FirebaseJsonBase } template - auto dataSetHandler(T1 arg1, T2 arg2) -> typename MB_ENABLE_IF<(is_num_int::value || is_num_float::value || is_bool::value) && is_num_int::value>::type + auto dataSetHandler(T1 arg1, T2 arg2) -> typename std::enable_if<(is_num_int::value || is_num_float::value || is_bool::value) && is_num_int::value>::type { mSetIdx(arg1, MB_JSON_CreateRaw(num2Str(arg2, -1))); } template - auto dataSetHandler(T1 arg1, T2 arg2) -> typename MB_ENABLE_IF::value && MB_IS_SAME::value>::type + auto dataSetHandler(T1 arg1, T2 arg2) -> typename std::enable_if::value && std::is_same::value>::type { if (root_type != Root_Type_JSONArray) mClear(); @@ -2178,13 +2178,13 @@ class FirebaseJsonArray : public FirebaseJsonBase } template - auto dataSetHandler(T1 arg1, T2 arg2) -> typename MB_ENABLE_IF<(is_num_int::value || is_num_float::value || is_bool::value) && MB_IS_SAME::value>::type + auto dataSetHandler(T1 arg1, T2 arg2) -> typename std::enable_if<(is_num_int::value || is_num_float::value || is_bool::value) && std::is_same::value>::type { mSetIdx(arg1, MB_JSON_CreateRaw(num2Str(arg2, floatDigits))); } template - auto dataSetHandler(T1 arg1, T2 arg2) -> typename MB_ENABLE_IF::value && (MB_IS_SAME::value || MB_IS_SAME::value)>::type + auto dataSetHandler(T1 arg1, T2 arg2) -> typename std::enable_if::value && (std::is_same::value || std::is_same::value)>::type { if (root_type != Root_Type_JSONArray) mClear(); @@ -2197,13 +2197,13 @@ class FirebaseJsonArray : public FirebaseJsonBase } template - auto dataSetHandler(T1 arg1, T2 arg2) -> typename MB_ENABLE_IF<(is_num_int::value || is_num_float::value || is_bool::value) && (MB_IS_SAME::value || MB_IS_SAME::value)>::type + auto dataSetHandler(T1 arg1, T2 arg2) -> typename std::enable_if<(is_num_int::value || is_num_float::value || is_bool::value) && (std::is_same::value || std::is_same::value)>::type { mSetIdx(arg1, MB_JSON_CreateRaw(num2Str(arg2, doubleDigits))); } template - auto dataSetHandler(T1 arg1, T2 arg2) -> typename MB_ENABLE_IF::value && is_string::value>::type + auto dataSetHandler(T1 arg1, T2 arg2) -> typename std::enable_if::value && is_string::value>::type { if (root_type != Root_Type_JSONArray) mClear(); @@ -2218,7 +2218,7 @@ class FirebaseJsonArray : public FirebaseJsonBase } template - auto dataSetHandler(T1 arg1, T2 arg2) -> typename MB_ENABLE_IF<(is_num_int::value || is_num_float::value || is_bool::value) && is_string::value>::type + auto dataSetHandler(T1 arg1, T2 arg2) -> typename std::enable_if<(is_num_int::value || is_num_float::value || is_bool::value) && is_string::value>::type { uint32_t addr = 0; mSetIdx(arg1, MB_JSON_CreateString(getStr(arg2, addr))); @@ -2226,7 +2226,7 @@ class FirebaseJsonArray : public FirebaseJsonBase } template - auto dataSetHandler(T1 arg1, T2 &arg2) -> typename MB_ENABLE_IF::value && MB_IS_SAME::value>::type + auto dataSetHandler(T1 arg1, T2 &arg2) -> typename std::enable_if::value && std::is_same::value>::type { if (root_type != Root_Type_JSONArray) mClear(); @@ -2240,14 +2240,14 @@ class FirebaseJsonArray : public FirebaseJsonBase } template - auto dataSetHandler(T1 arg1, T2 &arg2) -> typename MB_ENABLE_IF<(is_num_int::value || is_num_float::value || is_bool::value) && MB_IS_SAME::value>::type + auto dataSetHandler(T1 arg1, T2 &arg2) -> typename std::enable_if<(is_num_int::value || is_num_float::value || is_bool::value) && std::is_same::value>::type { MB_JSON *e = MB_JSON_Duplicate(arg2.root, true); mSetIdx(arg1, e); } template - auto dataSetHandler(T1 arg1, T2 &arg2) -> typename MB_ENABLE_IF::value && MB_IS_SAME::value>::type + auto dataSetHandler(T1 arg1, T2 &arg2) -> typename std::enable_if::value && std::is_same::value>::type { if (root_type != Root_Type_JSONArray) mClear(); @@ -2261,7 +2261,7 @@ class FirebaseJsonArray : public FirebaseJsonBase } template - auto dataSetHandler(T1 arg1, T2 &arg2) -> typename MB_ENABLE_IF<(is_num_int::value || is_num_float::value || is_bool::value) && MB_IS_SAME::value>::type + auto dataSetHandler(T1 arg1, T2 &arg2) -> typename std::enable_if<(is_num_int::value || is_num_float::value || is_bool::value) && std::is_same::value>::type { MB_JSON *e = MB_JSON_Duplicate(arg2.root, true); mSetIdx(arg1, e); @@ -2636,7 +2636,7 @@ class FirebaseJson : public FirebaseJsonBase FirebaseJson &nAdd(const char *key, MB_JSON *value); template - auto dataHandler(T1 arg1, T2 arg2, fb_json_func_type_t type) -> typename MB_ENABLE_IF::value && is_bool::value, FirebaseJson &>::type + auto dataHandler(T1 arg1, T2 arg2, fb_json_func_type_t type) -> typename std::enable_if::value && is_bool::value, FirebaseJson &>::type { if (root_type != Root_Type_JSON) mClear(); @@ -2653,7 +2653,7 @@ class FirebaseJson : public FirebaseJsonBase } template - auto dataHandler(T1 arg1, T2 arg2, fb_json_func_type_t type) -> typename MB_ENABLE_IF::value && is_num_int::value, FirebaseJson &>::type + auto dataHandler(T1 arg1, T2 arg2, fb_json_func_type_t type) -> typename std::enable_if::value && is_num_int::value, FirebaseJson &>::type { if (root_type != Root_Type_JSON) mClear(); @@ -2670,7 +2670,7 @@ class FirebaseJson : public FirebaseJsonBase } template - auto dataHandler(T1 arg1, T2 arg2, fb_json_func_type_t type) -> typename MB_ENABLE_IF::value && MB_IS_SAME::value, FirebaseJson &>::type + auto dataHandler(T1 arg1, T2 arg2, fb_json_func_type_t type) -> typename std::enable_if::value && std::is_same::value, FirebaseJson &>::type { if (root_type != Root_Type_JSON) mClear(); @@ -2687,7 +2687,7 @@ class FirebaseJson : public FirebaseJsonBase } template - auto dataHandler(T1 arg1, T2 arg2, fb_json_func_type_t type) -> typename MB_ENABLE_IF::value && (MB_IS_SAME::value || MB_IS_SAME::value), FirebaseJson &>::type + auto dataHandler(T1 arg1, T2 arg2, fb_json_func_type_t type) -> typename std::enable_if::value && (std::is_same::value || std::is_same::value), FirebaseJson &>::type { if (root_type != Root_Type_JSON) mClear(); @@ -2704,7 +2704,7 @@ class FirebaseJson : public FirebaseJsonBase } template - auto dataHandler(T1 arg1, T2 arg2, fb_json_func_type_t type) -> typename MB_ENABLE_IF::value && is_string::value, FirebaseJson &>::type + auto dataHandler(T1 arg1, T2 arg2, fb_json_func_type_t type) -> typename std::enable_if::value && is_string::value, FirebaseJson &>::type { if (root_type != Root_Type_JSON) mClear(); @@ -2723,7 +2723,7 @@ class FirebaseJson : public FirebaseJsonBase } template - auto dataHandler(T arg, FirebaseJson &json, fb_json_func_type_t type) -> typename MB_ENABLE_IF::value, FirebaseJson &>::type + auto dataHandler(T arg, FirebaseJson &json, fb_json_func_type_t type) -> typename std::enable_if::value, FirebaseJson &>::type { if (root_type != Root_Type_JSON) mClear(); @@ -2741,7 +2741,7 @@ class FirebaseJson : public FirebaseJsonBase } template - auto dataHandler(T arg, FirebaseJsonArray &arr, fb_json_func_type_t type) -> typename MB_ENABLE_IF::value, FirebaseJson &>::type + auto dataHandler(T arg, FirebaseJsonArray &arr, fb_json_func_type_t type) -> typename std::enable_if::value, FirebaseJson &>::type { if (root_type != Root_Type_JSON) mClear(); diff --git a/src/json/MB_String.h b/src/json/MB_String.h index 0ac5b00..53a1fec 100644 --- a/src/json/MB_String.h +++ b/src/json/MB_String.h @@ -1,11 +1,14 @@ /** - * Mobizt's SRAM/PSRAM supported String, version 1.2.11 + * Mobizt's SRAM/PSRAM supported String, version 1.2.12 * - * Created March 23, 2024 + * Created March 25, 2024 * * Changes Log * + * v1.2.12 + * - using std namespace + * * v1.2.11 * - fix float to string conversion * @@ -113,13 +116,6 @@ class MB_String; #define pgm2Str(p) (MB_String().appendP(p).c_str()) #define num2Str(v, p) (MB_String().appendNum(v, p).c_str()) -#if defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F4) -#define MB_IS_SAME std::is_same -#define MB_ENABLE_IF std::enable_if -#else -#define MB_IS_SAME is_same -#define MB_ENABLE_IF enable_if -#endif namespace mb_string { @@ -194,52 +190,52 @@ namespace mb_string template struct is_num_int8 { - static bool const value = MB_IS_SAME::value || MB_IS_SAME::value; + static bool const value = std::is_same::value || std::is_same::value; }; template struct is_num_uint8 { - static bool const value = MB_IS_SAME::value || MB_IS_SAME::value; + static bool const value = std::is_same::value || std::is_same::value; }; template struct is_num_int16 { - static bool const value = MB_IS_SAME::value || MB_IS_SAME::value; + static bool const value = std::is_same::value || std::is_same::value; }; template struct is_num_uint16 { - static bool const value = MB_IS_SAME::value || MB_IS_SAME::value; + static bool const value = std::is_same::value || std::is_same::value; }; template struct is_num_int32 { - static bool const value = MB_IS_SAME::value || MB_IS_SAME::value || - MB_IS_SAME::value || MB_IS_SAME::value || - MB_IS_SAME::value; + static bool const value = std::is_same::value || std::is_same::value || + std::is_same::value || std::is_same::value || + std::is_same::value; }; template struct is_num_uint32 { - static bool const value = MB_IS_SAME::value || MB_IS_SAME::value || - MB_IS_SAME::value; + static bool const value = std::is_same::value || std::is_same::value || + std::is_same::value; }; template struct is_num_int64 { - static bool const value = MB_IS_SAME::value || MB_IS_SAME::value; + static bool const value = std::is_same::value || std::is_same::value; }; template struct is_num_uint64 { - static bool const value = MB_IS_SAME::value || MB_IS_SAME::value; + static bool const value = std::is_same::value || std::is_same::value; }; template @@ -265,44 +261,44 @@ namespace mb_string template struct is_num_float { - static bool const value = MB_IS_SAME::value || MB_IS_SAME::value || MB_IS_SAME::value; + static bool const value = std::is_same::value || std::is_same::value || std::is_same::value; }; template struct is_bool { - static bool const value = MB_IS_SAME::value; + static bool const value = std::is_same::value; }; template struct cs_t { - static bool const value = MB_IS_SAME::value; + static bool const value = std::is_same::value; }; template struct ccs_t { - static bool const value = MB_IS_SAME::value; + static bool const value = std::is_same::value; }; template struct as_t { - static bool const value = MB_IS_SAME::value; + static bool const value = std::is_same::value; }; template struct cas_t { - static bool const value = MB_IS_SAME::value; + static bool const value = std::is_same::value; }; template struct ss_t { #if !defined(__AVR__) - static bool const value = MB_IS_SAME::value; + static bool const value = std::is_same::value; #else static bool const value = false; #endif @@ -312,7 +308,7 @@ namespace mb_string struct css_t { #if !defined(__AVR__) - static bool const value = MB_IS_SAME::value; + static bool const value = std::is_same::value; #else static bool const value = false; #endif @@ -321,31 +317,31 @@ namespace mb_string template struct ssh_t { - static bool const value = MB_IS_SAME::value; + static bool const value = std::is_same::value; }; template struct fs_t { - static bool const value = MB_IS_SAME::value; + static bool const value = std::is_same::value; }; template struct mbs_t { - static bool const value = MB_IS_SAME::value; + static bool const value = std::is_same::value; }; template struct cmbs_t { - static bool const value = MB_IS_SAME::value; + static bool const value = std::is_same::value; }; template struct pgm_t { - static bool const value = MB_IS_SAME::value; + static bool const value = std::is_same::value; }; template @@ -403,14 +399,14 @@ namespace mb_string } #else template - auto addrTo(int address) -> typename MB_ENABLE_IF::value, T>::type + auto addrTo(int address) -> typename std::enable_if::value, T>::type { return reinterpret_cast(address); } #endif template - auto getSubType(T val) -> typename MB_ENABLE_IF::value || is_num_float::value || MB_IS_SAME::value || is_const_chars::value || is_arduino_flash_string_helper::value || is_arduino_string::value || is_std_string::value || is_mb_string::value || MB_IS_SAME::value, mb_string_sub_type>::type + auto getSubType(T val) -> typename std::enable_if::value || is_num_float::value || std::is_same::value || is_const_chars::value || is_arduino_flash_string_helper::value || is_arduino_string::value || is_std_string::value || is_mb_string::value || std::is_same::value, mb_string_sub_type>::type { if (is_num_uint64::value) return mb_string_sub_type_uint64; @@ -428,11 +424,11 @@ namespace mb_string return mb_string_sub_type_uint8; else if (is_num_int8::value) return mb_string_sub_type_int8; - else if (MB_IS_SAME::value) + else if (std::is_same::value) return mb_string_sub_type_bool; - else if (MB_IS_SAME::value) + else if (std::is_same::value) return mb_string_sub_type_float; - else if (MB_IS_SAME::value) + else if (std::is_same::value) return mb_string_sub_type_double; else if (is_arduino_string::value) return mb_string_sub_type_arduino_string; @@ -442,7 +438,7 @@ namespace mb_string return mb_string_sub_type_mb_string; else if (is_arduino_flash_string_helper::value) return mb_string_sub_type_fptr; - else if (MB_IS_SAME::value) + else if (std::is_same::value) return mb_string_sub_type_string_sum_helper; else if (ccs_t::value) return mb_string_sub_type_cstring; @@ -453,19 +449,19 @@ namespace mb_string } template - auto getSubType(T *val) -> typename MB_ENABLE_IF::value || is_num_float::value || MB_IS_SAME::value || is_const_chars::value || is_arduino_flash_string_helper::value || is_arduino_string::value || is_std_string::value || is_mb_string::value || MB_IS_SAME::value, mb_string_sub_type>::type + auto getSubType(T *val) -> typename std::enable_if::value || is_num_float::value || std::is_same::value || is_const_chars::value || is_arduino_flash_string_helper::value || is_arduino_string::value || is_std_string::value || is_mb_string::value || std::is_same::value, mb_string_sub_type>::type { return getSubType(*val); } template - auto toStringPtr(const T &val) -> typename MB_ENABLE_IF::value || is_arduino_string::value || is_mb_string::value, MB_StringPtr>::type + auto toStringPtr(const T &val) -> typename std::enable_if::value || is_arduino_string::value || is_mb_string::value, MB_StringPtr>::type { return MB_StringPtr(reinterpret_cast(&val), getSubType(val)); } template - auto toStringPtr(const T &val) -> typename MB_ENABLE_IF::value, MB_StringPtr>::type + auto toStringPtr(const T &val) -> typename std::enable_if::value, MB_StringPtr>::type { #if defined(ESP8266) return MB_StringPtr(reinterpret_cast(&val), getSubType(val), -1); @@ -476,27 +472,27 @@ namespace mb_string } template - auto toStringPtr(T val) -> typename MB_ENABLE_IF::value, MB_StringPtr>::type { return MB_StringPtr(reinterpret_cast(val), getSubType(val)); } + auto toStringPtr(T val) -> typename std::enable_if::value, MB_StringPtr>::type { return MB_StringPtr(reinterpret_cast(val), getSubType(val)); } template - auto toStringPtr(T &val) -> typename MB_ENABLE_IF::value, MB_StringPtr>::type { return MB_StringPtr(reinterpret_cast(val), getSubType(val)); } + auto toStringPtr(T &val) -> typename std::enable_if::value, MB_StringPtr>::type { return MB_StringPtr(reinterpret_cast(val), getSubType(val)); } #if !defined(__AVR__) template - auto toStringPtr(T val) -> typename MB_ENABLE_IF::value, MB_StringPtr>::type + auto toStringPtr(T val) -> typename std::enable_if::value, MB_StringPtr>::type { return MB_StringPtr(); } #endif template - auto toStringPtr(T val) -> typename MB_ENABLE_IF::value, MB_StringPtr>::type + auto toStringPtr(T val) -> typename std::enable_if::value, MB_StringPtr>::type { return val; } template - auto toStringPtr(T &val, int precision = -1) -> typename MB_ENABLE_IF::value || is_num_float::value || MB_IS_SAME::value, MB_StringPtr>::type { return MB_StringPtr(reinterpret_cast(&val), getSubType(val), precision); } + auto toStringPtr(T &val, int precision = -1) -> typename std::enable_if::value || is_num_float::value || std::is_same::value, MB_StringPtr>::type { return MB_StringPtr(reinterpret_cast(&val), getSubType(val), precision); } } using namespace mb_string; @@ -797,7 +793,7 @@ class MB_String } template - auto operator=(T value) -> typename MB_ENABLE_IF::value || is_num_float::value || is_bool::value, MB_String &>::type + auto operator=(T value) -> typename std::enable_if::value || is_num_float::value || is_bool::value, MB_String &>::type { clear(); appendNum(value); @@ -805,7 +801,7 @@ class MB_String } template - auto operator+=(T value) -> typename MB_ENABLE_IF::value || is_num_float::value || is_bool::value, MB_String &>::type + auto operator+=(T value) -> typename std::enable_if::value || is_num_float::value || is_bool::value, MB_String &>::type { appendNum(value); return (*this); @@ -898,7 +894,7 @@ class MB_String }; template - auto appendNum(T value, int precision = 0) -> typename MB_ENABLE_IF::value || is_bool::value, MB_String &>::type + auto appendNum(T value, int precision = 0) -> typename std::enable_if::value || is_bool::value, MB_String &>::type { char *s = NULL;