Go to the documentation of this file.
20 #include <google/protobuf/text_format.h>
21 #include <google/protobuf/util/json_util.h>
31 std::filesystem::path
const& path, google::protobuf::Message
const& proto);
34 std::filesystem::path
const& path, google::protobuf::Message
const& proto);
37 std::filesystem::path
const& path);
39 template <
class TProtobufT>
41 std::filesystem::path
const& path) {
44 google::protobuf::util::JsonParseOptions parse_options;
45 auto status = google::protobuf::util::JsonStringToMessage(
46 json_string, &
message, parse_options);
54 std::filesystem::path
const& path);
56 template <
class TProtobufT>
58 std::filesystem::path
const& path) {
61 if (
message.ParseFromString(bytes)) {
auto writeProtobufToJsonFile(std::filesystem::path const &path, google::protobuf::Message const &proto) -> Expected< farm_ng::Success >
TODO: Add API docs.
Definition: proto_reader_writer.cpp:19
Definition: backtrace.cpp:102
Expected< TProtobufT > readProtobufFromBinaryFile(std::filesystem::path const &path)
Definition: proto_reader_writer.h:57
#define FARM_TRY(Type, var, expression)
Assigns *expression to var of Type, but returns error if there is one.
Definition: expected.h:91
auto readJsonStringFromJsonFile(std::filesystem::path const &path) -> Expected< std::string >
Definition: proto_reader_writer.cpp:56
cmake message("farm_ng_cmake_DIR" ${farm_ng_cmake_DIR}) include($
Definition: CMakeLists.txt:8
auto readBytesFromBinaryFile(std::filesystem::path const &path) -> Expected< std::string >
Definition: proto_reader_writer.cpp:73
#define FARM_UNEXPECTED(cstr,...)
Definition: expected.h:86
auto writeProtobufToBinaryFile(std::filesystem::path const &path, google::protobuf::Message const &proto) -> Expected< Success >
Definition: proto_reader_writer.cpp:39
Expected< TProtobufT > readProtobufFromJsonFile(std::filesystem::path const &path)
Definition: proto_reader_writer.h:40
tl::expected< TT, TE > Expected
Definition: expected.h:37