8#include <ArduinoJson.h>
9#if THINGSBOARD_ENABLE_STL
31 template<
typename... Args>
33 const int result = snprintf(
nullptr, 0U, format, args...) + 1U;
35 return static_cast<size_t>(result);
72 template <
typename TSource>
74 return measureJson(source) + 1U;
84 template<
typename InputIterator>
85 static size_t distance(InputIterator
const & first, InputIterator
const & last) {
86#if THINGSBOARD_ENABLE_STL
87 return std::distance(first, last);
93 for (
auto it = first; it != last; ++it, ++size) {}
Static helper class that includes some functionalities used in multiple places throughout the library...
Definition: Helper.h:19
static size_t Calculate_Print_Size(char const *format, Args const &... args)
Returns the total amount of bytes needed to store the formatted string with null termination,...
Definition: Helper.h:32
static size_t distance(InputIterator const &first, InputIterator const &last)
Calculates the distance between two iterators.
Definition: Helper.h:85
static bool String_IsNull_Or_Empty(char const *str)
Returns wheter the given string is either a nullptr or is an empty string, meaning it only contains a...
Definition: Helper.cpp:27
static size_t Measure_Json(TSource const &source)
Calculates the total size of the string the serializeJson method would produce including the null end...
Definition: Helper.h:73
static size_t Split_Topic_Into_Request_ID(char const *received_topic, size_t const &end_position)
Splits the topic at the given position and extracts the request id parameter from the remaining strin...
Definition: Helper.cpp:31
static size_t Calculate_Symbol_Occurences(uint8_t const *bytes, char symbol, uint32_t length)
Returns the amount of occurences of the given smybol in the given byte payload.
Definition: Helper.cpp:10