diff --git a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/model/StreamOffsets.h b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/model/StreamOffsets.h index c84691a8a..0a1548e13 100644 --- a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/model/StreamOffsets.h +++ b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/model/StreamOffsets.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ #pragma once +#include #include #include diff --git a/olp-cpp-sdk-dataservice-read/src/JsonResultParser.h b/olp-cpp-sdk-dataservice-read/src/JsonResultParser.h index a5dea90f8..de069190c 100644 --- a/olp-cpp-sdk-dataservice-read/src/JsonResultParser.h +++ b/olp-cpp-sdk-dataservice-read/src/JsonResultParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,8 @@ #include #include +#include #include -#include #include namespace olp { diff --git a/olp-cpp-sdk-dataservice-read/src/generated/api/MetadataApi.cpp b/olp-cpp-sdk-dataservice-read/src/generated/api/MetadataApi.cpp index 2e391725d..4e26b2c41 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/api/MetadataApi.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/api/MetadataApi.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2024 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include @@ -235,8 +237,6 @@ MetadataApi::CompatibleVersionsResponse MetadataApi::GetCompatibleVersions( std::multimap query_params; query_params.emplace("limit", std::to_string(limit)); - rapidjson::Value value; - const auto serialized_dependencies = serializer::serialize(dependencies); const auto data = std::make_shared>( diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/ApiParser.cpp b/olp-cpp-sdk-dataservice-read/src/generated/parser/ApiParser.cpp index 632c25d45..bc0913b12 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/ApiParser.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/ApiParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,13 @@ #include "ApiParser.h" -#include +#include + +#include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::Api& x) { x.SetApi(parse(value, "api")); x.SetVersion(parse(value, "version")); diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/ApiParser.h b/olp-cpp-sdk-dataservice-read/src/generated/parser/ApiParser.h index d7d79f42b..20020c45e 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/ApiParser.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/ApiParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,15 @@ #pragma once -#include +#include #include "generated/model/Api.h" #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, olp::dataservice::read::model::Api& x); +void from_json(const boost::json::value& value, + olp::dataservice::read::model::Api& x); } // namespace parser diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/CatalogParser.cpp b/olp-cpp-sdk-dataservice-read/src/generated/parser/CatalogParser.cpp index 33d39c1fa..03d05238f 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/CatalogParser.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/CatalogParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,48 +19,50 @@ #include "CatalogParser.h" -#include +#include + +#include namespace olp { namespace parser { -namespace model = dataservice::read::model; +namespace model = olp::dataservice::read::model; -void from_json(const rapidjson::Value& value, model::Coverage& x) { +void from_json(const boost::json::value& value, model::Coverage& x) { x.SetAdminAreas(parse>(value, "adminAreas")); } -void from_json(const rapidjson::Value& value, model::IndexDefinition& x) { +void from_json(const boost::json::value& value, model::IndexDefinition& x) { x.SetName(parse(value, "name")); x.SetType(parse(value, "type")); x.SetDuration(parse(value, "duration")); x.SetZoomLevel(parse(value, "zoomLevel")); } -void from_json(const rapidjson::Value& value, model::IndexProperties& x) { +void from_json(const boost::json::value& value, model::IndexProperties& x) { x.SetTtl(parse(value, "ttl")); x.SetIndexDefinitions( parse>(value, "indexDefinitions")); } -void from_json(const rapidjson::Value& value, model::Creator& x) { +void from_json(const boost::json::value& value, model::Creator& x) { x.SetId(parse(value, "id")); } -void from_json(const rapidjson::Value& value, model::Owner& x) { +void from_json(const boost::json::value& value, model::Owner& x) { x.SetCreator(parse(value, "creator")); x.SetOrganisation(parse(value, "organisation")); } -void from_json(const rapidjson::Value& value, model::Partitioning& x) { +void from_json(const boost::json::value& value, model::Partitioning& x) { x.SetScheme(parse(value, "scheme")); x.SetTileLevels(parse>(value, "tileLevels")); } -void from_json(const rapidjson::Value& value, model::Schema& x) { +void from_json(const boost::json::value& value, model::Schema& x) { x.SetHrn(parse(value, "hrn")); } -void from_json(const rapidjson::Value& value, model::StreamProperties& x) { +void from_json(const boost::json::value& value, model::StreamProperties& x) { // Parsing these as double even though OepnAPI sepcs says int64 because // Backend returns the value in decimal format (e.g. 1.0) and this triggers an // assert in RapidJSON when parsing. @@ -70,18 +72,18 @@ void from_json(const rapidjson::Value& value, model::StreamProperties& x) { static_cast(parse(value, "dataOutThroughputMbps"))); } -void from_json(const rapidjson::Value& value, model::Encryption& x) { +void from_json(const boost::json::value& value, model::Encryption& x) { x.SetAlgorithm(parse(value, "algorithm")); } -void from_json(const rapidjson::Value& value, model::Volume& x) { +void from_json(const boost::json::value& value, model::Volume& x) { x.SetVolumeType(parse(value, "volumeType")); x.SetMaxMemoryPolicy(parse(value, "maxMemoryPolicy")); x.SetPackageType(parse(value, "packageType")); x.SetEncryption(parse(value, "encryption")); } -void from_json(const rapidjson::Value& value, model::Layer& x) { +void from_json(const boost::json::value& value, model::Layer& x) { x.SetId(parse(value, "id")); x.SetName(parse(value, "name")); x.SetSummary(parse(value, "summary")); @@ -103,11 +105,11 @@ void from_json(const rapidjson::Value& value, model::Layer& x) { x.SetVolume(parse(value, "volume")); } -void from_json(const rapidjson::Value& value, model::Notifications& x) { +void from_json(const boost::json::value& value, model::Notifications& x) { x.SetEnabled(parse(value, "enabled")); } -void from_json(const rapidjson::Value& value, model::Catalog& x) { +void from_json(const boost::json::value& value, model::Catalog& x) { x.SetId(parse(value, "id")); x.SetHrn(parse(value, "hrn")); x.SetName(parse(value, "name")); diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/CatalogParser.h b/olp-cpp-sdk-dataservice-read/src/generated/parser/CatalogParser.h index fde7f7cb7..73ecd68d2 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/CatalogParser.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/CatalogParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,50 +19,50 @@ #pragma once -#include +#include #include "olp/dataservice/read/model/Catalog.h" #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::Coverage& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::IndexDefinition& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::IndexProperties& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::Creator& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::Owner& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::Partitioning& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::Schema& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::StreamProperties& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::Encryption& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::Volume& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::Layer& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::Notifications& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::Catalog& x); } // namespace parser } // namespace olp diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/IndexParser.cpp b/olp-cpp-sdk-dataservice-read/src/generated/parser/IndexParser.cpp index d9cfe81ab..2d07230a3 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/IndexParser.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/IndexParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,17 @@ #include "IndexParser.h" -#include +#include +#include + +#include namespace olp { namespace parser { -namespace model = dataservice::read::model; -void from_json(const rapidjson::Value& value, +namespace model = olp::dataservice::read::model; + +void from_json(const boost::json::value& value, std::shared_ptr& x) { auto quad = std::make_shared(); @@ -47,7 +51,7 @@ void from_json(const rapidjson::Value& value, x.swap(quad); } -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, std::shared_ptr& x) { auto quad = std::make_shared(); @@ -69,7 +73,7 @@ void from_json(const rapidjson::Value& value, x.swap(quad); } -void from_json(const rapidjson::Value& value, model::Index& x) { +void from_json(const boost::json::value& value, model::Index& x) { x.SetParentQuads(parse>>( value, "parentQuads")); x.SetSubQuads( diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/IndexParser.h b/olp-cpp-sdk-dataservice-read/src/generated/parser/IndexParser.h index 9cb7f0f4f..60fac610f 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/IndexParser.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/IndexParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,19 +19,20 @@ #pragma once -#include +#include #include "generated/model/Index.h" +#include #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, std::shared_ptr& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, std::shared_ptr& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::Index& x); } // namespace parser } // namespace olp diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/JsonParser.h b/olp-cpp-sdk-dataservice-read/src/generated/parser/JsonParser.h new file mode 100644 index 000000000..48f30401e --- /dev/null +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/JsonParser.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2019-2026 HERE Europe B.V. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * License-Filename: LICENSE + */ + +#pragma once + +#include +#include +#include +#include + +#include + +#include "ParserWrapper.h" + +namespace olp { +namespace parser { + +template +inline T parse(const std::string& json) { + boost::json::error_code ec; + auto value = boost::json::parse(json, ec); + T result{}; + if (value.is_object() || value.is_array()) { + from_json(value, result); + } + return result; +} + +template +inline T parse(std::stringstream& json_stream, bool& res) { + res = false; + boost::json::error_code ec; + auto value = boost::json::parse(json_stream, ec); + T result{}; + if (value.is_object() || value.is_array()) { + from_json(value, result); + res = true; + } + return result; +} + +template +inline T parse(std::stringstream& json_stream) { + bool res = true; + return parse(json_stream, res); +} + +template +inline T parse(const std::shared_ptr>& json_bytes) { + boost::json::string_view json(reinterpret_cast(json_bytes->data()), + json_bytes->size()); + boost::json::error_code ec; + auto value = boost::json::parse(json, ec); + T result{}; + if (value.is_object() || value.is_array()) { + from_json(value, result); + } + return result; +} + +} // namespace parser +} // namespace olp diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/LayerVersionsParser.cpp b/olp-cpp-sdk-dataservice-read/src/generated/parser/LayerVersionsParser.cpp index 6b6920418..6a650535d 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/LayerVersionsParser.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/LayerVersionsParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,19 +19,21 @@ #include "LayerVersionsParser.h" -#include +#include + +#include namespace olp { namespace parser { -using namespace olp::dataservice::read; +namespace model = olp::dataservice::read::model; -void from_json(const rapidjson::Value& value, model::LayerVersion& x) { +void from_json(const boost::json::value& value, model::LayerVersion& x) { x.SetLayer(parse(value, "layer")); x.SetVersion(parse(value, "version")); x.SetTimestamp(parse(value, "timestamp")); } -void from_json(const rapidjson::Value& value, model::LayerVersions& x) { +void from_json(const boost::json::value& value, model::LayerVersions& x) { x.SetLayerVersions( parse>(value, "layerVersions")); x.SetVersion(parse(value, "version")); diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/LayerVersionsParser.h b/olp-cpp-sdk-dataservice-read/src/generated/parser/LayerVersionsParser.h index ca5136176..ef725789b 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/LayerVersionsParser.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/LayerVersionsParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,17 +19,17 @@ #pragma once -#include +#include #include "generated/model/LayerVersions.h" #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::LayerVersion& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::LayerVersions& x); } // namespace parser diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/MessagesParser.cpp b/olp-cpp-sdk-dataservice-read/src/generated/parser/MessagesParser.cpp index 67ec4793a..8cd71add9 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/MessagesParser.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/MessagesParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,16 +19,19 @@ #include "MessagesParser.h" +#include +#include + // clang-format off #include "generated/parser/StreamOffsetParser.h" -#include +#include // clang-format on namespace olp { namespace parser { -namespace model = dataservice::read::model; +namespace model = olp::dataservice::read::model; -void from_json(const rapidjson::Value& value, model::Metadata& x) { +void from_json(const boost::json::value& value, model::Metadata& x) { x.SetPartition(parse(value, "partition")); x.SetChecksum(parse>(value, "checksum")); x.SetCompressedDataSize( @@ -39,12 +42,12 @@ void from_json(const rapidjson::Value& value, model::Metadata& x) { x.SetTimestamp(parse>(value, "timestamp")); } -void from_json(const rapidjson::Value& value, model::Message& x) { +void from_json(const boost::json::value& value, model::Message& x) { x.SetMetaData(parse(value, "metaData")); x.SetOffset(parse(value, "offset")); } -void from_json(const rapidjson::Value& value, model::Messages& x) { +void from_json(const boost::json::value& value, model::Messages& x) { x.SetMessages(parse>(value, "messages")); } diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/MessagesParser.h b/olp-cpp-sdk-dataservice-read/src/generated/parser/MessagesParser.h index 270a8dc36..df0e41add 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/MessagesParser.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/MessagesParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,19 +19,19 @@ #pragma once -#include #include +#include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::Metadata& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::Message& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::Messages& x); } // namespace parser diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/ParserWrapper.h b/olp-cpp-sdk-dataservice-read/src/generated/parser/ParserWrapper.h new file mode 100644 index 000000000..284238474 --- /dev/null +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/ParserWrapper.h @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2019-2026 HERE Europe B.V. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * License-Filename: LICENSE + */ + +#pragma once + +#include +#include +#include +#include +#include + +#include +#include + +namespace olp { +namespace parser { + +inline void from_json(const boost::json::value& value, std::string& x) { + const auto& str = value.get_string(); + x.assign(str.begin(), str.end()); +} + +inline void from_json(const boost::json::value& value, int32_t& x) { + x = static_cast(value.to_number()); +} + +inline void from_json(const boost::json::value& value, int64_t& x) { + x = value.to_number(); +} + +inline void from_json(const boost::json::value& value, double& x) { + x = value.to_number(); +} + +inline void from_json(const boost::json::value& value, bool& x) { + x = value.get_bool(); +} + +inline void from_json(const boost::json::value& value, + std::shared_ptr>& x) { + const auto& s = value.get_string(); + x = std::make_shared>(s.begin(), s.end()); +} + +template +inline void from_json(const boost::json::value& value, + porting::optional& x) { + T result = T(); + from_json(value, result); + x = result; +} + +template +inline void from_json(const boost::json::value& value, + std::map& results) { + const auto& object = value.get_object(); + for (const auto& object_value : object) { + std::string key = object_value.key(); + from_json(object_value.value(), results[key]); + } +} + +template +inline void from_json(const boost::json::value& value, + std::vector& results) { + const auto& array = value.get_array(); + for (const auto& array_value : array) { + T result; + from_json(array_value, result); + results.emplace_back(std::move(result)); + } +} + +template +inline T parse(const boost::json::value& value, const std::string& name) { + T result = T(); + const auto& object = value.get_object(); + auto itr = object.find(name); + if (itr != object.end()) { + from_json(itr->value(), result); + } + return result; +} + +} // namespace parser +} // namespace olp diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/PartitionsParser.cpp b/olp-cpp-sdk-dataservice-read/src/generated/parser/PartitionsParser.cpp index b09c7a370..68e162fe0 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/PartitionsParser.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/PartitionsParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,15 @@ #include "PartitionsParser.h" -#include +#include + +#include namespace olp { namespace parser { -using dataservice::read::model::Partition; -using dataservice::read::model::Partitions; +namespace model = olp::dataservice::read::model; -void from_json(const rapidjson::Value& value, Partition& x) { +void from_json(const boost::json::value& value, model::Partition& x) { x.SetChecksum(parse>(value, "checksum")); x.SetCompressedDataSize( parse>(value, "compressedDataSize")); @@ -37,8 +38,8 @@ void from_json(const rapidjson::Value& value, Partition& x) { x.SetVersion(parse>(value, "version")); } -void from_json(const rapidjson::Value& value, Partitions& x) { - x.SetPartitions(parse>(value, "partitions")); +void from_json(const boost::json::value& value, model::Partitions& x) { + x.SetPartitions(parse>(value, "partitions")); } } // namespace parser diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/PartitionsParser.h b/olp-cpp-sdk-dataservice-read/src/generated/parser/PartitionsParser.h index 120e1129f..f1742538d 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/PartitionsParser.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/PartitionsParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,17 +19,17 @@ #pragma once -#include +#include #include "olp/dataservice/read/model/Partitions.h" #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::Partition& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::Partitions& x); } // namespace parser diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/StreamOffsetParser.cpp b/olp-cpp-sdk-dataservice-read/src/generated/parser/StreamOffsetParser.cpp index d11ba87e6..70adeab2b 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/StreamOffsetParser.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/StreamOffsetParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,13 @@ #include "StreamOffsetParser.h" -#include +#include namespace olp { namespace parser { -using namespace olp::dataservice::read; +namespace model = olp::dataservice::read::model; -void from_json(const rapidjson::Value& value, model::StreamOffset& x) { +void from_json(const boost::json::value& value, model::StreamOffset& x) { x.SetPartition(parse(value, "partition")); x.SetOffset(parse(value, "offset")); } diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/StreamOffsetParser.h b/olp-cpp-sdk-dataservice-read/src/generated/parser/StreamOffsetParser.h index fdefafc65..ce6b7ef42 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/StreamOffsetParser.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/StreamOffsetParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,13 @@ #pragma once -#include #include +#include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::StreamOffset& x); } // namespace parser diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/SubscribeResponseParser.cpp b/olp-cpp-sdk-dataservice-read/src/generated/parser/SubscribeResponseParser.cpp index 68d7c7ef8..710f4478f 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/SubscribeResponseParser.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/SubscribeResponseParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,15 @@ #include "SubscribeResponseParser.h" -#include +#include + +#include namespace olp { namespace parser { -using namespace olp::dataservice::read; +namespace model = olp::dataservice::read::model; -void from_json(const rapidjson::Value& value, model::SubscribeResponse& x) { +void from_json(const boost::json::value& value, model::SubscribeResponse& x) { x.SetNodeBaseURL(parse(value, "nodeBaseURL")); x.SetSubscriptionId(parse(value, "subscriptionId")); } diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/SubscribeResponseParser.h b/olp-cpp-sdk-dataservice-read/src/generated/parser/SubscribeResponseParser.h index 226922b5a..283bb76a4 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/SubscribeResponseParser.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/SubscribeResponseParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,13 @@ #pragma once -#include +#include #include "generated/model/SubscribeResponse.h" namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::SubscribeResponse& x); } // namespace parser diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionInfosParser.cpp b/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionInfosParser.cpp index dc71aebac..3b38f9fc0 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionInfosParser.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionInfosParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,21 +20,22 @@ #include "VersionInfosParser.h" #include +#include #include -#include +#include namespace olp { namespace parser { namespace model = olp::dataservice::read::model; -void from_json(const rapidjson::Value& value, model::VersionDependency& x) { +void from_json(const boost::json::value& value, model::VersionDependency& x) { x.SetHrn(parse(value, "hrn")); x.SetVersion(parse(value, "version")); x.SetDirect(parse(value, "direct")); } -void from_json(const rapidjson::Value& value, model::VersionInfo& x) { +void from_json(const boost::json::value& value, model::VersionInfo& x) { x.SetDependencies( parse>(value, "dependencies")); x.SetTimestamp(parse(value, "timestamp")); @@ -43,7 +44,7 @@ void from_json(const rapidjson::Value& value, model::VersionInfo& x) { parse>(value, "partitionCounts")); } -void from_json(const rapidjson::Value& value, model::VersionInfos& x) { +void from_json(const boost::json::value& value, model::VersionInfos& x) { x.SetVersions(parse>(value, "versions")); } diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionInfosParser.h b/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionInfosParser.h index bd692e6a8..3934a9abb 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionInfosParser.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionInfosParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,18 +19,18 @@ #pragma once -#include +#include #include "olp/dataservice/read/model/VersionInfos.h" namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::VersionDependency& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::VersionInfo& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::VersionInfos& x); } // namespace parser diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionResponseParser.cpp b/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionResponseParser.cpp index 107594f85..20dd8f6b4 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionResponseParser.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionResponseParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,13 @@ #include "VersionResponseParser.h" -#include +#include namespace olp { namespace parser { -using namespace olp::dataservice::read; +namespace model = olp::dataservice::read::model; -void from_json(const rapidjson::Value& value, model::VersionResponse& x) { +void from_json(const boost::json::value& value, model::VersionResponse& x) { x.SetVersion(parse(value, "version")); } diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionResponseParser.h b/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionResponseParser.h index 4c57d9344..a0e595e8a 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionResponseParser.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionResponseParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,14 @@ #pragma once -#include +#include #include "olp/dataservice/read/model/VersionResponse.h" #include namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::VersionResponse& x); } // namespace parser diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionsResponseParser.cpp b/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionsResponseParser.cpp index 708f7e277..f403d32b5 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionsResponseParser.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionsResponseParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 HERE Europe B.V. + * Copyright (C) 2022-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,9 @@ #include "VersionsResponseParser.h" -#include +#include + +#include namespace olp { namespace parser { @@ -29,18 +31,18 @@ using VersionsResponseEntry = olp::dataservice::read::model::VersionsResponseEntry; using CatalogVersion = olp::dataservice::read::model::CatalogVersion; -void from_json(const rapidjson::Value& value, CatalogVersion& x) { +void from_json(const boost::json::value& value, CatalogVersion& x) { x.SetHrn(parse(value, "hrn")); x.SetVersion(parse(value, "version")); } -void from_json(const rapidjson::Value& value, VersionsResponseEntry& x) { +void from_json(const boost::json::value& value, VersionsResponseEntry& x) { x.SetVersion(parse(value, "version")); x.SetCatalogVersions( parse>(value, "sharedDependencies")); } -void from_json(const rapidjson::Value& value, VersionsResponse& x) { +void from_json(const boost::json::value& value, VersionsResponse& x) { x.SetVersionResponseEntries( parse>(value, "versions")); } diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionsResponseParser.h b/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionsResponseParser.h index 8d9eb783e..b12f20a85 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionsResponseParser.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/VersionsResponseParser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 HERE Europe B.V. + * Copyright (C) 2022-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,18 +21,17 @@ #include -#include +#include #include "olp/dataservice/read/model/VersionsResponse.h" - namespace olp { namespace parser { -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::CatalogVersion& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::VersionsResponseEntry& x); -void from_json(const rapidjson::Value& value, +void from_json(const boost::json::value& value, olp::dataservice::read::model::VersionsResponse& x); } // namespace parser diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/ApiSerializer.cpp b/olp-cpp-sdk-dataservice-read/src/generated/serializer/ApiSerializer.cpp index 91a3eae4a..1cd3f2756 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/serializer/ApiSerializer.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/ApiSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,21 +17,21 @@ * License-Filename: LICENSE */ -#include +#include #include "ApiSerializer.h" -#include +#include namespace olp { namespace serializer { -void to_json(const dataservice::read::model::Api& x, rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("api", x.GetApi(), value, allocator); - serialize("version", x.GetVersion(), value, allocator); - serialize("baseURL", x.GetBaseUrl(), value, allocator); - serialize("parameters", x.GetParameters(), value, allocator); +void to_json(const dataservice::read::model::Api& x, + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("api", x.GetApi(), object); + serialize("version", x.GetVersion(), object); + serialize("baseURL", x.GetBaseUrl(), object); + serialize("parameters", x.GetParameters(), object); } } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/ApiSerializer.h b/olp-cpp-sdk-dataservice-read/src/generated/serializer/ApiSerializer.h index 0e5b9bc06..67fea5f80 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/serializer/ApiSerializer.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/ApiSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,14 +21,12 @@ #include -#include +#include #include "generated/model/Api.h" namespace olp { namespace serializer { -void to_json(const dataservice::read::model::Api& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); +void to_json(const dataservice::read::model::Api& x, boost::json::value& value); } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/CatalogSerializer.cpp b/olp-cpp-sdk-dataservice-read/src/generated/serializer/CatalogSerializer.cpp index 8ca3a88d1..3a7c6fa1b 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/serializer/CatalogSerializer.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/CatalogSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,140 +17,129 @@ * License-Filename: LICENSE */ -#include +#include #include "CatalogSerializer.h" -#include +#include namespace olp { namespace serializer { void to_json(const dataservice::read::model::Coverage& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("adminAreas", x.GetAdminAreas(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("adminAreas", x.GetAdminAreas(), object); } void to_json(const dataservice::read::model::IndexDefinition& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("name", x.GetName(), value, allocator); - serialize("type", x.GetType(), value, allocator); - serialize("duration", x.GetDuration(), value, allocator); - serialize("zoomLevel", x.GetZoomLevel(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("name", x.GetName(), object); + serialize("type", x.GetType(), object); + serialize("duration", x.GetDuration(), object); + serialize("zoomLevel", x.GetZoomLevel(), object); } void to_json(const dataservice::read::model::IndexProperties& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("ttl", x.GetTtl(), value, allocator); - serialize("indexDefinitions", x.GetIndexDefinitions(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("ttl", x.GetTtl(), object); + serialize("indexDefinitions", x.GetIndexDefinitions(), object); } void to_json(const dataservice::read::model::Creator& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("id", x.GetId(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("id", x.GetId(), object); } -void to_json(const dataservice::read::model::Owner& x, rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("creator", x.GetCreator(), value, allocator); - serialize("organisation", x.GetOrganisation(), value, allocator); +void to_json(const dataservice::read::model::Owner& x, + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("creator", x.GetCreator(), object); + serialize("organisation", x.GetOrganisation(), object); } void to_json(const dataservice::read::model::Partitioning& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("scheme", x.GetScheme(), value, allocator); - serialize("tileLevels", x.GetTileLevels(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("scheme", x.GetScheme(), object); + serialize("tileLevels", x.GetTileLevels(), object); } -void to_json(const dataservice::read::model::Schema& x, rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("hrn", x.GetHrn(), value, allocator); +void to_json(const dataservice::read::model::Schema& x, + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("hrn", x.GetHrn(), object); } void to_json(const dataservice::read::model::StreamProperties& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("dataInThroughputMbps", x.GetDataInThroughputMbps(), value, - allocator); - serialize("dataOutThroughputMbps", x.GetDataOutThroughputMbps(), value, - allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("dataInThroughputMbps", x.GetDataInThroughputMbps(), object); + serialize("dataOutThroughputMbps", x.GetDataOutThroughputMbps(), object); } void to_json(const dataservice::read::model::Encryption& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("algorithm", x.GetAlgorithm(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("algorithm", x.GetAlgorithm(), object); } -void to_json(const dataservice::read::model::Volume& x, rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("volumeType", x.GetVolumeType(), value, allocator); - serialize("maxMemoryPolicy", x.GetMaxMemoryPolicy(), value, allocator); - serialize("packageType", x.GetPackageType(), value, allocator); - serialize("encryption", x.GetEncryption(), value, allocator); +void to_json(const dataservice::read::model::Volume& x, + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("volumeType", x.GetVolumeType(), object); + serialize("maxMemoryPolicy", x.GetMaxMemoryPolicy(), object); + serialize("packageType", x.GetPackageType(), object); + serialize("encryption", x.GetEncryption(), object); } -void to_json(const dataservice::read::model::Layer& x, rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("id", x.GetId(), value, allocator); - serialize("name", x.GetName(), value, allocator); - serialize("summary", x.GetSummary(), value, allocator); - serialize("description", x.GetDescription(), value, allocator); - serialize("owner", x.GetOwner(), value, allocator); - serialize("coverage", x.GetCoverage(), value, allocator); - serialize("schema", x.GetSchema(), value, allocator); - serialize("contentType", x.GetContentType(), value, allocator); - serialize("contentEncoding", x.GetContentEncoding(), value, allocator); - serialize("partitioning", x.GetPartitioning(), value, allocator); - serialize("layerType", x.GetLayerType(), value, allocator); - serialize("digest", x.GetDigest(), value, allocator); - serialize("tags", x.GetTags(), value, allocator); - serialize("billingTags", x.GetBillingTags(), value, allocator); - serialize("ttl", x.GetTtl(), value, allocator); - serialize("indexProperties", x.GetIndexProperties(), value, allocator); - serialize("streamProperties", x.GetStreamProperties(), value, allocator); - serialize("volume", x.GetVolume(), value, allocator); +void to_json(const dataservice::read::model::Layer& x, + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("id", x.GetId(), object); + serialize("name", x.GetName(), object); + serialize("summary", x.GetSummary(), object); + serialize("description", x.GetDescription(), object); + serialize("owner", x.GetOwner(), object); + serialize("coverage", x.GetCoverage(), object); + serialize("schema", x.GetSchema(), object); + serialize("contentType", x.GetContentType(), object); + serialize("contentEncoding", x.GetContentEncoding(), object); + serialize("partitioning", x.GetPartitioning(), object); + serialize("layerType", x.GetLayerType(), object); + serialize("digest", x.GetDigest(), object); + serialize("tags", x.GetTags(), object); + serialize("billingTags", x.GetBillingTags(), object); + serialize("ttl", x.GetTtl(), object); + serialize("indexProperties", x.GetIndexProperties(), object); + serialize("streamProperties", x.GetStreamProperties(), object); + serialize("volume", x.GetVolume(), object); } void to_json(const dataservice::read::model::Notifications& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("enabled", x.GetEnabled(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("enabled", x.GetEnabled(), object); } void to_json(const dataservice::read::model::Catalog& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("id", x.GetId(), value, allocator); - serialize("hrn", x.GetHrn(), value, allocator); - serialize("name", x.GetName(), value, allocator); - serialize("summary", x.GetSummary(), value, allocator); - serialize("description", x.GetDescription(), value, allocator); - serialize("coverage", x.GetCoverage(), value, allocator); - serialize("owner", x.GetOwner(), value, allocator); - serialize("tags", x.GetTags(), value, allocator); - serialize("billingTags", x.GetBillingTags(), value, allocator); - serialize("created", x.GetCreated(), value, allocator); - serialize("layers", x.GetLayers(), value, allocator); - serialize("version", x.GetVersion(), value, allocator); - serialize("notifications", x.GetNotifications(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("id", x.GetId(), object); + serialize("hrn", x.GetHrn(), object); + serialize("name", x.GetName(), object); + serialize("summary", x.GetSummary(), object); + serialize("description", x.GetDescription(), object); + serialize("coverage", x.GetCoverage(), object); + serialize("owner", x.GetOwner(), object); + serialize("tags", x.GetTags(), object); + serialize("billingTags", x.GetBillingTags(), object); + serialize("created", x.GetCreated(), object); + serialize("layers", x.GetLayers(), object); + serialize("version", x.GetVersion(), object); + serialize("notifications", x.GetNotifications(), object); } } // namespace serializer diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/CatalogSerializer.h b/olp-cpp-sdk-dataservice-read/src/generated/serializer/CatalogSerializer.h index 6d9417162..12406cb32 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/serializer/CatalogSerializer.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/CatalogSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,63 +19,50 @@ #pragma once -#include +#include #include "olp/dataservice/read/model/Catalog.h" namespace olp { namespace serializer { void to_json(const dataservice::read::model::Coverage& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::read::model::IndexDefinition& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::read::model::IndexProperties& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::read::model::Creator& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::read::model::Owner& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::read::model::Partitioning& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::read::model::Schema& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::read::model::StreamProperties& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::read::model::Encryption& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::read::model::Volume& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::read::model::Layer& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::read::model::Notifications& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::read::model::Catalog& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/CatalogVersionsSerializer.h b/olp-cpp-sdk-dataservice-read/src/generated/serializer/CatalogVersionsSerializer.h index 50bd3898e..5fbb8c77c 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/serializer/CatalogVersionsSerializer.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/CatalogVersionsSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 HERE Europe B.V. + * Copyright (C) 2022-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,35 +19,37 @@ #pragma once -#include +#include +#include + +#include #include -#include +#include namespace olp { namespace serializer { inline void to_json(const dataservice::read::model::CatalogVersion& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("hrn", x.GetHrn(), value, allocator); - serialize("version", x.GetVersion(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("hrn", x.GetHrn(), object); + serialize("version", x.GetVersion(), object); } template <> inline void to_json( const std::vector& x, - rapidjson::Value& value, rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - - rapidjson::Value array_value; - array_value.SetArray(); - for (auto itr = x.begin(); itr != x.end(); ++itr) { - rapidjson::Value item_value; - to_json(*itr, item_value, allocator); - array_value.PushBack(std::move(item_value), allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + + boost::json::array array_value; + for (const auto& version : x) { + boost::json::value item_value; + to_json(version, item_value); + array_value.emplace_back(std::move(item_value)); } - value.AddMember("dependencies", std::move(array_value), allocator); + + object.emplace("dependencies", std::move(array_value)); } } // namespace serializer diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/ConsumerPropertiesSerializer.h b/olp-cpp-sdk-dataservice-read/src/generated/serializer/ConsumerPropertiesSerializer.h index 1dea7c2fe..1c76810e7 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/serializer/ConsumerPropertiesSerializer.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/ConsumerPropertiesSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,11 @@ #pragma once -#include -#include +#include + +#include #include +#include namespace olp { namespace serializer { @@ -29,18 +31,17 @@ namespace serializer { template <> inline void to_json( const std::vector& x, - rapidjson::Value& value, rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - for (auto itr = x.begin(); itr != x.end(); ++itr) { - serialize(itr->GetKey(), itr->GetValue(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + for (const auto& option : x) { + serialize(option.GetKey(), option.GetValue(), object); } } inline void to_json(const dataservice::read::ConsumerProperties& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("kafkaConsumerProperties", x.GetProperties(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("kafkaConsumerProperties", x.GetProperties(), object); } } // namespace serializer diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/JsonSerializer.h b/olp-cpp-sdk-dataservice-read/src/generated/serializer/JsonSerializer.h index 399346219..f023aba1a 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/serializer/JsonSerializer.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/JsonSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2024 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,13 @@ #pragma once -#include -#include -#include +#include +#include +#include + +#include +#include +#include #include "ByteVectorBuffer.h" @@ -29,30 +33,28 @@ namespace olp { namespace serializer { template inline std::string serialize(const T& object) { - rapidjson::Document doc; - auto& allocator = doc.GetAllocator(); - - doc.SetObject(); - to_json(object, doc, allocator); - - rapidjson::StringBuffer buffer; - rapidjson::Writer writer(buffer); - doc.Accept(writer); - return buffer.GetString(); + boost::json::value value; + to_json(object, value); + return boost::json::serialize(value); } template inline ByteVectorBuffer::Buffer serialize_bytes(const T& object) { - rapidjson::Document doc; - auto& allocator = doc.GetAllocator(); + boost::json::value value; + to_json(object, value); + + boost::json::serializer serializer; + serializer.reset(&value); + + auto buffer = std::make_shared>(); - doc.SetObject(); - to_json(object, doc, allocator); + while (!serializer.done()) { + char temp[4096]; + auto result = serializer.read(temp); + buffer->insert(buffer->end(), temp, temp + result.size()); + } - ByteVectorBuffer buffer; - rapidjson::Writer writer(buffer); - doc.Accept(writer); - return buffer.GetBuffer(); + return buffer; } } // namespace serializer diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/LayerVersionsSerializer.cpp b/olp-cpp-sdk-dataservice-read/src/generated/serializer/LayerVersionsSerializer.cpp index 935fab9fc..f3cc90a10 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/serializer/LayerVersionsSerializer.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/LayerVersionsSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,28 +17,26 @@ * License-Filename: LICENSE */ -#include +#include #include "LayerVersionsSerializer.h" -#include +#include namespace olp { namespace serializer { void to_json(const dataservice::read::model::LayerVersion& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("layer", x.GetLayer(), value, allocator); - serialize("version", x.GetVersion(), value, allocator); - serialize("timestamp", x.GetTimestamp(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("layer", x.GetLayer(), object); + serialize("version", x.GetVersion(), object); + serialize("timestamp", x.GetTimestamp(), object); } void to_json(const dataservice::read::model::LayerVersions& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("layerVersions", x.GetLayerVersions(), value, allocator); - serialize("version", x.GetVersion(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("layerVersions", x.GetLayerVersions(), object); + serialize("version", x.GetVersion(), object); } } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/LayerVersionsSerializer.h b/olp-cpp-sdk-dataservice-read/src/generated/serializer/LayerVersionsSerializer.h index bff03a181..e36df1e8f 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/serializer/LayerVersionsSerializer.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/LayerVersionsSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,19 +19,16 @@ #pragma once -#include +#include #include "generated/model/LayerVersions.h" - namespace olp { namespace serializer { void to_json(const dataservice::read::model::LayerVersion& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::read::model::LayerVersions& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/PartitionsSerializer.cpp b/olp-cpp-sdk-dataservice-read/src/generated/serializer/PartitionsSerializer.cpp index b7bd4009e..de817e864 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/serializer/PartitionsSerializer.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/PartitionsSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,32 +17,30 @@ * License-Filename: LICENSE */ -#include +#include #include "PartitionsSerializer.h" -#include +#include namespace olp { namespace serializer { void to_json(const dataservice::read::model::Partition& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("checksum", x.GetChecksum(), value, allocator); - serialize("compressedDataSize", x.GetCompressedDataSize(), value, allocator); - serialize("dataHandle", x.GetDataHandle(), value, allocator); - serialize("dataSize", x.GetDataSize(), value, allocator); - serialize("crc", x.GetCrc(), value, allocator); - serialize("partition", x.GetPartition(), value, allocator); - serialize("version", x.GetVersion(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("checksum", x.GetChecksum(), object); + serialize("compressedDataSize", x.GetCompressedDataSize(), object); + serialize("dataHandle", x.GetDataHandle(), object); + serialize("dataSize", x.GetDataSize(), object); + serialize("crc", x.GetCrc(), object); + serialize("partition", x.GetPartition(), object); + serialize("version", x.GetVersion(), object); } void to_json(const dataservice::read::model::Partitions& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("partitions", x.GetPartitions(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("partitions", x.GetPartitions(), object); } } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/PartitionsSerializer.h b/olp-cpp-sdk-dataservice-read/src/generated/serializer/PartitionsSerializer.h index 0870aa75c..36ded6b6c 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/serializer/PartitionsSerializer.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/PartitionsSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,18 +19,16 @@ #pragma once -#include +#include #include "olp/dataservice/read/model/Partitions.h" namespace olp { namespace serializer { void to_json(const dataservice::read::model::Partition& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::read::model::Partitions& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/SerializerWrapper.h b/olp-cpp-sdk-dataservice-read/src/generated/serializer/SerializerWrapper.h new file mode 100644 index 000000000..7005b9cec --- /dev/null +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/SerializerWrapper.h @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2019-2026 HERE Europe B.V. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * License-Filename: LICENSE + */ + +#pragma once + +#include +#include +#include +#include +#include + +#include +#include + +namespace olp { +namespace serializer { + +inline void to_json(const std::string& x, boost::json::value& value) { + value.emplace_string() = x; +} + +inline void to_json(int32_t x, boost::json::value& value) { + value.emplace_int64() = x; +} + +inline void to_json(int64_t x, boost::json::value& value) { + value.emplace_int64() = x; +} + +inline void to_json(double x, boost::json::value& value) { + value.emplace_double() = x; +} +inline void to_json(bool x, boost::json::value& value) { + value.emplace_bool() = x; +} + +inline void to_json(const std::shared_ptr>& x, + boost::json::value& value) { + value.emplace_string().assign(x->begin(), x->end()); +} + +template +inline void to_json(const porting::optional& x, boost::json::value& value) { + if (x) { + to_json(*x, value); + } else { + value.emplace_null(); + } +} + +template +inline void to_json(const std::map& x, + boost::json::value& value) { + auto& object = value.emplace_object(); + for (auto itr = x.begin(); itr != x.end(); ++itr) { + const auto& key = itr->first; + boost::json::value item_value; + to_json(itr->second, item_value); + object.emplace(key, std::move(item_value)); + } +} + +template +inline void to_json(const std::vector& x, boost::json::value& value) { + auto& array = value.emplace_array(); + array.reserve(x.size()); + for (typename std::vector::const_iterator itr = x.begin(); itr != x.end(); + ++itr) { + boost::json::value item_value; + to_json(*itr, item_value); + array.emplace_back(std::move(item_value)); + } +} + +template +inline void serialize(const std::string& key, const T& x, + boost::json::object& value) { + boost::json::value item_value; + to_json(x, item_value); + if (!item_value.is_null()) { + value.emplace(key, std::move(item_value)); + } +} + +} // namespace serializer +} // namespace olp diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/StreamOffsetsSerializer.cpp b/olp-cpp-sdk-dataservice-read/src/generated/serializer/StreamOffsetsSerializer.cpp index a2e750d63..8fc4c098b 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/serializer/StreamOffsetsSerializer.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/StreamOffsetsSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,24 +19,22 @@ #include "StreamOffsetsSerializer.h" -#include +#include namespace olp { namespace serializer { void to_json(const dataservice::read::model::StreamOffset& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("partition", x.GetPartition(), value, allocator); - serialize("offset", x.GetOffset(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("partition", x.GetPartition(), object); + serialize("offset", x.GetOffset(), object); } void to_json(const dataservice::read::model::StreamOffsets& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("offsets", x.GetOffsets(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("offsets", x.GetOffsets(), object); } } // namespace serializer diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/StreamOffsetsSerializer.h b/olp-cpp-sdk-dataservice-read/src/generated/serializer/StreamOffsetsSerializer.h index f301dfc33..149a8d7e5 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/serializer/StreamOffsetsSerializer.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/StreamOffsetsSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,19 +19,17 @@ #pragma once -#include #include +#include namespace olp { namespace serializer { void to_json(const dataservice::read::model::StreamOffset& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::read::model::StreamOffsets& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/VersionInfosSerializer.cpp b/olp-cpp-sdk-dataservice-read/src/generated/serializer/VersionInfosSerializer.cpp index d24b124da..0386cb66d 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/serializer/VersionInfosSerializer.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/VersionInfosSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,35 +19,32 @@ #include "VersionInfosSerializer.h" -#include +#include namespace olp { namespace serializer { void to_json(const dataservice::read::model::VersionDependency& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("hrn", x.GetHrn(), value, allocator); - serialize("version", x.GetVersion(), value, allocator); - serialize("direct", x.GetDirect(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("hrn", x.GetHrn(), object); + serialize("version", x.GetVersion(), object); + serialize("direct", x.GetDirect(), object); } void to_json(const dataservice::read::model::VersionInfo& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("dependencies", x.GetDependencies(), value, allocator); - serialize("timestamp", x.GetTimestamp(), value, allocator); - serialize("version", x.GetVersion(), value, allocator); - serialize("partitionCounts", x.GetPartitionCounts(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("dependencies", x.GetDependencies(), object); + serialize("timestamp", x.GetTimestamp(), object); + serialize("version", x.GetVersion(), object); + serialize("partitionCounts", x.GetPartitionCounts(), object); } void to_json(const dataservice::read::model::VersionInfos& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("versions", x.GetVersions(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("versions", x.GetVersions(), object); } } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/VersionInfosSerializer.h b/olp-cpp-sdk-dataservice-read/src/generated/serializer/VersionInfosSerializer.h index 2d950baf0..3775170af 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/serializer/VersionInfosSerializer.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/VersionInfosSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,22 +19,19 @@ #pragma once -#include +#include #include "olp/dataservice/read/model/VersionInfos.h" namespace olp { namespace serializer { void to_json(const dataservice::read::model::VersionDependency& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::read::model::VersionInfo& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); void to_json(const dataservice::read::model::VersionInfos& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/VersionResponseSerializer.cpp b/olp-cpp-sdk-dataservice-read/src/generated/serializer/VersionResponseSerializer.cpp index ec4e2a4d8..ced2b121e 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/serializer/VersionResponseSerializer.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/VersionResponseSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,19 +17,18 @@ * License-Filename: LICENSE */ -#include +#include #include "VersionResponseSerializer.h" -#include +#include namespace olp { namespace serializer { void to_json(const dataservice::read::model::VersionResponse& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator) { - value.SetObject(); - serialize("version", x.GetVersion(), value, allocator); + boost::json::value& value) { + auto& object = value.emplace_object(); + serialize("version", x.GetVersion(), object); } } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-read/src/generated/serializer/VersionResponseSerializer.h b/olp-cpp-sdk-dataservice-read/src/generated/serializer/VersionResponseSerializer.h index af3c4f774..e68387478 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/serializer/VersionResponseSerializer.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/serializer/VersionResponseSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,13 @@ #pragma once -#include +#include #include "olp/dataservice/read/model/VersionResponse.h" namespace olp { namespace serializer { void to_json(const dataservice::read::model::VersionResponse& x, - rapidjson::Value& value, - rapidjson::Document::AllocatorType& allocator); + boost::json::value& value); } // namespace serializer } // namespace olp diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/AsyncJsonStream.h b/olp-cpp-sdk-dataservice-read/src/repositories/AsyncJsonStream.h index a2adad3f3..190a92a5f 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/AsyncJsonStream.h +++ b/olp-cpp-sdk-dataservice-read/src/repositories/AsyncJsonStream.h @@ -20,6 +20,7 @@ #pragma once #include +#include #include #include @@ -32,7 +33,7 @@ namespace dataservice { namespace read { namespace repository { -/// Json byte stream class. Implements rapidjson input stream concept. +/// Json byte stream class. Implements json input stream concept. class JsonByteStream { public: typedef char Ch; diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsCacheRepository.cpp b/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsCacheRepository.cpp index 55701ce85..e730f1ea3 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsCacheRepository.cpp +++ b/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsCacheRepository.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2025 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,8 +32,8 @@ #include "generated/parser/PartitionsParser.h" #include "generated/parser/LayerVersionsParser.h" #include "JsonResultParser.h" -#include -#include +#include +#include #include "generated/serializer/PartitionsSerializer.h" #include "generated/serializer/LayerVersionsSerializer.h" #include "generated/serializer/JsonSerializer.h" diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/QuadTreeIndex.cpp b/olp-cpp-sdk-dataservice-read/src/repositories/QuadTreeIndex.cpp index 6f9b30088..8a946b015 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/QuadTreeIndex.cpp +++ b/olp-cpp-sdk-dataservice-read/src/repositories/QuadTreeIndex.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2025 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,9 +23,8 @@ #include #include -#include -#include -#include +#include +#include #include "BlobDataReader.h" #include "BlobDataWriter.h" @@ -46,33 +45,37 @@ constexpr auto kCompressedDataSizeKey = "compressedDataSize"; constexpr auto kCrcKey = "crc"; constexpr auto kLogTag = "QuadTreeIndex"; -QuadTreeIndex::IndexData ParseCommonIndexData(rapidjson::Value& value) { +QuadTreeIndex::IndexData ParseCommonIndexData(boost::json::object& obj) { QuadTreeIndex::IndexData data; - const auto obj = value.GetObject(); - if (obj.HasMember(kAdditionalMetadataKey) && - obj[kAdditionalMetadataKey].IsString()) { - data.additional_metadata = obj[kAdditionalMetadataKey].GetString(); + if (obj.contains(kAdditionalMetadataKey) && + obj[kAdditionalMetadataKey].is_string()) { + data.additional_metadata = obj[kAdditionalMetadataKey].get_string().c_str(); } - if (obj.HasMember(kChecksumKey) && obj[kChecksumKey].IsString()) { - data.checksum = obj[kChecksumKey].GetString(); + if (obj.contains(kChecksumKey) && obj[kChecksumKey].is_string()) { + data.checksum = obj[kChecksumKey].get_string().c_str(); } - if (obj.HasMember(kCrcKey) && obj[kCrcKey].IsString()) { - data.crc = obj[kCrcKey].GetString(); + if (obj.contains(kCrcKey) && obj[kCrcKey].is_string()) { + data.crc = obj[kCrcKey].get_string().c_str(); } - if (obj.HasMember(kDataSizeKey) && obj[kDataSizeKey].IsInt64()) { - data.data_size = obj[kDataSizeKey].GetInt64(); + if (auto* data_size = obj.if_contains(kDataSizeKey)) { + if (data_size->is_uint64() || data_size->is_int64()) { + data.data_size = data_size->to_number(); + } } - if (obj.HasMember(kCompressedDataSizeKey) && - obj[kCompressedDataSizeKey].IsInt64()) { - data.compressed_data_size = obj[kCompressedDataSizeKey].GetInt64(); + if (auto* data_size = obj.if_contains(kCompressedDataSizeKey)) { + if (data_size->is_uint64() || data_size->is_int64()) { + data.compressed_data_size = data_size->to_number(); + } } - if (obj.HasMember(kVersionKey) && obj[kVersionKey].IsUint64()) { - data.version = obj[kVersionKey].GetUint64(); + if (auto* version = obj.if_contains(kVersionKey)) { + if (version->is_uint64() || version->is_int64()) { + data.version = version->to_number(); + } } return data; } @@ -101,60 +104,62 @@ QuadTreeIndex::QuadTreeIndex(const cache::KeyValueCache::ValueTypePtr& data) { QuadTreeIndex::QuadTreeIndex(const geo::TileKey& root, int depth, std::stringstream& json_stream) { - thread_local rapidjson::CrtAllocator crt_allocator; - thread_local rapidjson::MemoryPoolAllocator<> pool_allocator; - rapidjson::Document doc(&pool_allocator, 4096, &crt_allocator); + boost::json::error_code ec; + auto parsed_value = boost::json::parse(json_stream, ec); - rapidjson::IStreamWrapper stream(json_stream); - doc.ParseStream(stream); - - if (!doc.IsObject()) { + if (!parsed_value.is_object()) { return; } - std::vector subs; - std::vector parents; + auto& top_object = parsed_value.as_object(); - auto parent_quads_value = doc.FindMember(kParentQuadsKey); - auto sub_quads_value = doc.FindMember(kSubQuadsKey); + auto parent_quads_value = top_object.find(kParentQuadsKey); + auto sub_quads_value = top_object.find(kSubQuadsKey); - if (parent_quads_value == doc.MemberEnd() && - sub_quads_value == doc.MemberEnd()) { + if (parent_quads_value == top_object.end() && + sub_quads_value == top_object.end()) { return; } - if (parent_quads_value != doc.MemberEnd() && - parent_quads_value->value.IsArray()) { - parents.reserve(parent_quads_value->value.Size()); - for (auto& value : parent_quads_value->value.GetArray()) { - auto obj = value.GetObject(); + std::vector subs; + std::vector parents; - if (!obj.HasMember(kDataHandleKey) || !obj[kDataHandleKey].IsString() || - !obj.HasMember(kPartitionKey) || !obj[kPartitionKey].IsString()) { + if (parent_quads_value != top_object.end() && + parent_quads_value->value().is_array()) { + auto& parent_quads = parent_quads_value->value().as_array(); + parents.reserve(parent_quads.size()); + for (auto& value : parent_quads) { + auto& obj = value.as_object(); + + if (!obj.contains(kDataHandleKey) || !obj[kDataHandleKey].is_string() || + !obj.contains(kPartitionKey) || !obj[kPartitionKey].is_string()) { continue; } - IndexData data = ParseCommonIndexData(value); - data.data_handle = obj[kDataHandleKey].GetString(); + IndexData data = ParseCommonIndexData(obj); + data.data_handle = obj[kDataHandleKey].as_string().c_str(); data.tile_key = - geo::TileKey::FromHereTile(obj[kPartitionKey].GetString()); + geo::TileKey::FromHereTile(obj[kPartitionKey].as_string().c_str()); parents.push_back(std::move(data)); } } - if (sub_quads_value != doc.MemberEnd() && sub_quads_value->value.IsArray()) { - subs.reserve(sub_quads_value->value.Size()); - for (auto& value : sub_quads_value->value.GetArray()) { - auto obj = value.GetObject(); + if (sub_quads_value != top_object.end() && + sub_quads_value->value().is_array()) { + auto& sub_quads = sub_quads_value->value().as_array(); + subs.reserve(sub_quads.size()); + for (auto& value : sub_quads) { + auto obj = value.as_object(); - if (!obj.HasMember(kDataHandleKey) || !obj[kDataHandleKey].IsString() || - !obj.HasMember(kSubQuadKeyKey) || !obj[kSubQuadKeyKey].IsString()) { + if (!obj.contains(kDataHandleKey) || !obj[kDataHandleKey].is_string() || + !obj.contains(kSubQuadKeyKey) || !obj[kSubQuadKeyKey].is_string()) { continue; } - IndexData data = ParseCommonIndexData(value); - data.data_handle = obj[kDataHandleKey].GetString(); - data.tile_key = root.AddedSubHereTile(obj[kSubQuadKeyKey].GetString()); + IndexData data = ParseCommonIndexData(obj); + data.data_handle = obj[kDataHandleKey].as_string().c_str(); + data.tile_key = + root.AddedSubHereTile(obj[kSubQuadKeyKey].as_string().c_str()); subs.push_back(std::move(data)); } } diff --git a/olp-cpp-sdk-dataservice-read/tests/ParserTest.cpp b/olp-cpp-sdk-dataservice-read/tests/ParserTest.cpp index 0fffd77c3..9ef99df20 100644 --- a/olp-cpp-sdk-dataservice-read/tests/ParserTest.cpp +++ b/olp-cpp-sdk-dataservice-read/tests/ParserTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ #include "generated/parser/MessagesParser.h" #include "generated/parser/SubscribeResponseParser.h" #include "generated/parser/VersionInfosParser.h" -#include +#include #include "generated/serializer/VersionInfosSerializer.h" #include "generated/serializer/JsonSerializer.h" // clang-format on diff --git a/olp-cpp-sdk-dataservice-read/tests/PartitionsCacheRepositoryTest.cpp b/olp-cpp-sdk-dataservice-read/tests/PartitionsCacheRepositoryTest.cpp index d44495111..85801359a 100644 --- a/olp-cpp-sdk-dataservice-read/tests/PartitionsCacheRepositoryTest.cpp +++ b/olp-cpp-sdk-dataservice-read/tests/PartitionsCacheRepositoryTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ #include "repositories/DataCacheRepository.h" // clang-format off -#include +#include #include "generated/serializer/PartitionsSerializer.h" #include "generated/serializer/JsonSerializer.h" // clang-format on diff --git a/olp-cpp-sdk-dataservice-read/tests/PartitionsRepositoryTest.cpp b/olp-cpp-sdk-dataservice-read/tests/PartitionsRepositoryTest.cpp index b728d2b05..307a4bc69 100644 --- a/olp-cpp-sdk-dataservice-read/tests/PartitionsRepositoryTest.cpp +++ b/olp-cpp-sdk-dataservice-read/tests/PartitionsRepositoryTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2025 HERE Europe B.V. + * Copyright (C) 2019-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ // clang-format off #include "generated/parser/PartitionsParser.h" -#include +#include // clang-format on namespace { diff --git a/tests/common/ResponseGenerator.cpp b/tests/common/ResponseGenerator.cpp index 4ea6eb667..56c908841 100644 --- a/tests/common/ResponseGenerator.cpp +++ b/tests/common/ResponseGenerator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 HERE Europe B.V. + * Copyright (C) 2020-2026 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ #include "generated/serializer/ApiSerializer.h" #include "generated/serializer/VersionResponseSerializer.h" #include "generated/serializer/PartitionsSerializer.h" -#include +#include "generated/serializer/SerializerWrapper.h" #include "generated/serializer/JsonSerializer.h" // clang-format on