Symbian platform (C++)
SDK native APIs, runtime and tooling
Loading...
Searching...
No Matches
json_codec.h
Go to the documentation of this file.
1/*
2 * Copyright 2026 The A11 Authors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
26#ifndef SYMBIAN_STATUS_JSON_CODEC_H_
27#define SYMBIAN_STATUS_JSON_CODEC_H_
28
29#include <string>
30#include <string_view>
31
32#include <absl/status/statusor.h>
33#include <nlohmann/json.hpp>
34
35namespace symbian {
36
43absl::StatusOr<nlohmann::json> ParseJson(std::string_view encoded,
44 std::string_view what);
45
60bool IsValidUtf8(std::string_view text);
61
74const nlohmann::json* FindUnencodableString(const nlohmann::json& value);
75
87absl::StatusOr<std::string> DumpJson(const nlohmann::json& value,
88 std::string_view what);
89
96std::string DumpJsonLossy(const nlohmann::json& value);
97
99absl::StatusOr<std::string> PackMsgpack(const nlohmann::json& value,
100 std::string_view what);
101
103absl::StatusOr<nlohmann::json> UnpackMsgpack(std::string_view encoded,
104 std::string_view what);
105
106} // namespace symbian
107
108#endif // SYMBIAN_STATUS_JSON_CODEC_H_
Definition control.cc:11
absl::StatusOr< std::string > DumpJson(const Json &value, std::string_view what)
Definition json_codec.cc:381
std::string DumpJsonLossy(const Json &value)
Definition json_codec.cc:396
const Json * FindUnencodableString(const Json &value)
Definition json_codec.cc:358
absl::StatusOr< std::string > PackMsgpack(const Json &value, std::string_view what)
Definition json_codec.cc:402
absl::StatusOr< Json > UnpackMsgpack(std::string_view encoded, std::string_view what)
Decodes MessagePack bytes, or explains why they are not.
Definition json_codec.cc:413
absl::StatusOr< Json > ParseJson(std::string_view encoded, std::string_view what)
Parses JSON text, or explains why it is not JSON.
Definition json_codec.cc:340
bool IsValidUtf8(std::string_view text)
Whether text is valid UTF-8.
Definition json_codec.cc:354
libusb_context * value
Definition usb.cc:35