From f229a28b5b076534486652485d35f3e8668fc87c Mon Sep 17 00:00:00 2001 From: "Jesse F. Williamson" Date: Thu, 6 Mar 2025 17:37:53 -0800 Subject: [PATCH] Add copyright notice, some whitespace adjustment. Signed-off-by: Jesse F. Williamson --- src/common/ceph_json.cc | 41 ++++++++++++++++++++++++++++------------- src/common/ceph_json.h | 15 +++++++++++++++ 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/src/common/ceph_json.cc b/src/common/ceph_json.cc index 422bef5f15f07..77aceb8b3ac82 100644 --- a/src/common/ceph_json.cc +++ b/src/common/ceph_json.cc @@ -1,3 +1,18 @@ +// -*- 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" @@ -43,19 +58,19 @@ ostream& operator<<(ostream &out, const JSONObj &obj) { void JSONObj::handle_value(boost::json::value v) { if (auto op = v.if_object()) { - for (const auto& kvp : *op) { - auto child = std::make_unique(this, kvp.key(), kvp.value()); - children.emplace(std::pair { kvp.key(), std::move(child) }); - } + for (const auto& kvp : *op) { + auto child = std::make_unique(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(this, "", kvp); - children.emplace(std::pair { child->get_name(), std::move(child) }); - } + for (const auto& kvp : *ap) { + auto child = std::make_unique(this, "", kvp); + children.emplace(std::pair { child->get_name(), std::move(child) }); + } } // unknown type is not-an-error @@ -69,7 +84,7 @@ vector JSONObj::get_array_elements() 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; @@ -114,8 +129,8 @@ bool JSONParser::parse(std::string_view json_string_view) 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: @@ -125,7 +140,7 @@ bool JSONParser::parse(std::string_view json_string_view) if (s.size() == static_cast(json_string_view.length())) { val.set(s, false); return true; - } + } // Could not parse and convert: return false; diff --git a/src/common/ceph_json.h b/src/common/ceph_json.h index b85b3a28368b9..58416401b3f47 100644 --- a/src/common/ceph_json.h +++ b/src/common/ceph_json.h @@ -1,3 +1,18 @@ +// -*- 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 -- 2.39.5