+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab ft=cpp
+
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2025 International Business Machines Corp.
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+*/
+
#include "common/ceph_json.h"
#include "include/utime.h"
void JSONObj::handle_value(boost::json::value v)
{
if (auto op = v.if_object()) {
- for (const auto& kvp : *op) {
- auto child = std::make_unique<JSONObj>(this, kvp.key(), kvp.value());
- children.emplace(std::pair { kvp.key(), std::move(child) });
- }
+ for (const auto& kvp : *op) {
+ auto child = std::make_unique<JSONObj>(this, kvp.key(), kvp.value());
+ children.emplace(std::pair { kvp.key(), std::move(child) });
+ }
- return;
+ return;
}
if (auto ap = v.if_array()) {
- for (const auto& kvp : *ap) {
- auto child = std::make_unique<JSONObj>(this, "", kvp);
- children.emplace(std::pair { child->get_name(), std::move(child) });
- }
+ for (const auto& kvp : *ap) {
+ auto child = std::make_unique<JSONObj>(this, "", kvp);
+ children.emplace(std::pair { child->get_name(), std::move(child) });
+ }
}
// unknown type is not-an-error
return elements;
std::ranges::for_each(data.as_array(), [&elements](const auto& i) {
- elements.emplace_back(boost::json::serialize(i));
+ elements.emplace_back(boost::json::serialize(i));
});
return elements;
return true;
if (data.is_string()) {
- val.set(data.as_string(), true);
- return true;
+ val.set(data.as_string(), true);
+ return true;
}
// For any other kind of value:
if (s.size() == static_cast<uint64_t>(json_string_view.length())) {
val.set(s, false);
return true;
- }
+ }
// Could not parse and convert:
return false;
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab ft=cpp
+
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2025 International Business Machines Corp.
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+*/
+
#ifndef CEPH_JSON_H
#define CEPH_JSON_H