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
27#ifndef SYMBIAN_STATUS_JSON_CODEC_H_
28#define SYMBIAN_STATUS_JSON_CODEC_H_
29
30#include <string>
31#include <string_view>
32
33#include <absl/base/nullability.h>
34#include <absl/status/statusor.h>
35#include <nlohmann/json.hpp>
36
37namespace symbian {
38
45absl::StatusOr<nlohmann::json> ParseJson(std::string_view encoded,
46 std::string_view what);
47
62bool IsValidUtf8(std::string_view text);
63
76const nlohmann::json* absl_nullable FindUnencodableString(
77 const nlohmann::json& value);
78
90absl::StatusOr<std::string> DumpJson(const nlohmann::json& value,
91 std::string_view what);
92
99std::string DumpJsonLossy(const nlohmann::json& value);
100
102absl::StatusOr<std::string> PackMsgpack(const nlohmann::json& value,
103 std::string_view what);
104
106absl::StatusOr<nlohmann::json> UnpackMsgpack(std::string_view encoded,
107 std::string_view what);
108
109} // namespace symbian
110
111#endif // SYMBIAN_STATUS_JSON_CODEC_H_
Definition control.cc:14
absl::StatusOr< std::string > DumpJson(const Json &value, std::string_view what)
Definition json_codec.cc:382
std::string DumpJsonLossy(const Json &value)
Definition json_codec.cc:397
absl::StatusOr< std::string > PackMsgpack(const Json &value, std::string_view what)
Definition json_codec.cc:403
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:414
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:341
const Json *absl_nullable FindUnencodableString(const Json &value)
Definition json_codec.cc:359
bool IsValidUtf8(std::string_view text)
Whether text is valid UTF-8.
Definition json_codec.cc:355
libusb_context *absl_nullable value
Definition usb.cc:37