summaryrefslogtreecommitdiffstats
path: root/ahl-binding/jsonc_utils.hpp
diff options
context:
space:
mode:
authorLoïc Collignon <loic.collignon@iot.bzh>2018-12-18 10:37:24 +0100
committerLoïc Collignon <loic.collignon@iot.bzh>2018-12-20 18:13:14 +0100
commitf30e1a348f35e5ba9ff2d00d8f71edf095926d17 (patch)
treec5c6b4f87c5fa1d50dae878127abb3070d60311b /ahl-binding/jsonc_utils.hpp
parentcc1b67bfc67fb5c7a9e1b8c9ba287dd48d2ccf36 (diff)
Fix indentation and trailing whitespaces
Convert every indentation to tab instead of spaces and get rid of mixed tab/spaces indentations. Also remove few trailing whitespaces. Change-Id: Ic4a8f2adcacb99789a403aefe6a16daaffee5cd6 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
Diffstat (limited to 'ahl-binding/jsonc_utils.hpp')
-rw-r--r--ahl-binding/jsonc_utils.hpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/ahl-binding/jsonc_utils.hpp b/ahl-binding/jsonc_utils.hpp
index 097eda4..4657611 100644
--- a/ahl-binding/jsonc_utils.hpp
+++ b/ahl-binding/jsonc_utils.hpp
@@ -24,58 +24,58 @@
template<class T>
inline T& jcast(T& v, json_object* o)
{
- v << o;
- return v;
+ v << o;
+ return v;
}
template<class T>
inline T& jcast_array(T& v, json_object* o)
{
- if (o == nullptr) return v;
- auto sz = json_object_array_length(o);
- for(auto i = 0; i < sz ; ++i)
- {
- typename T::value_type item;
- jcast(item, json_object_array_get_idx(o, i));
- v.push_back(item);
- }
- return v;
+ if (o == nullptr) return v;
+ auto sz = json_object_array_length(o);
+ for(auto i = 0; i < sz ; ++i)
+ {
+ typename T::value_type item;
+ jcast(item, json_object_array_get_idx(o, i));
+ v.push_back(item);
+ }
+ return v;
}
template<>
inline bool& jcast<bool>(bool& v, json_object* o)
{
- v = (json_object_get_boolean(o) == TRUE);
- return v;
+ v = (json_object_get_boolean(o) == TRUE);
+ return v;
}
template<>
inline double& jcast<double>(double& v, json_object* o)
{
- v = json_object_get_double(o);
- return v;
+ v = json_object_get_double(o);
+ return v;
}
template<>
inline int32_t& jcast<int32_t>(int32_t& v, json_object* o)
{
- v = json_object_get_int(o);
- return v;
+ v = json_object_get_int(o);
+ return v;
}
template<>
inline int64_t& jcast<int64_t>(int64_t& v, json_object* o)
{
- v = json_object_get_int(o);
- return v;
+ v = json_object_get_int(o);
+ return v;
}
template<>
inline std::string& jcast<std::string>(std::string& v, json_object* o)
{
- const char* tmp = json_object_get_string(o);
- v = tmp ? tmp : "";
- return v;
+ const char* tmp = json_object_get_string(o);
+ v = tmp ? tmp : "";
+ return v;
}
template<class T>
@@ -83,7 +83,7 @@ inline T& jcast(T& v, json_object* o, std::string field)
{
json_object * value;
json_object_object_get_ex(o, field.c_str(), &value);
- return jcast<T>(v, value);
+ return jcast<T>(v, value);
}
template<class T>
@@ -91,5 +91,5 @@ inline T& jcast_array(T& v, json_object* o, std::string field)
{
json_object * value;
json_object_object_get_ex(o, field.c_str(), &value);
- return jcast_array<T>(v, value);
+ return jcast_array<T>(v, value);
}