MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / ReadFile

Function ReadFile

bazel/cel_cc_embed.cc:35–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33namespace {
34
35std::vector<uint8_t> ReadFile(const std::string& path) {
36 ABSL_CHECK(!path.empty()) << "--in is required";
37 std::ifstream file(path, std::ifstream::binary);
38 ABSL_CHECK(file.is_open()) << path;
39 file.seekg(0, file.end);
40 ABSL_CHECK(file.good());
41 size_t size = static_cast<size_t>(file.tellg());
42 file.seekg(0, file.beg);
43 ABSL_CHECK(file.good());
44 std::vector<uint8_t> buffer;
45 buffer.resize(size);
46 file.read(reinterpret_cast<char*>(buffer.data()), size);
47 ABSL_CHECK(file.good());
48 return buffer;
49}
50
51void WriteFile(const std::string& path, absl::Span<const char> data) {
52 ABSL_CHECK(!path.empty()) << "--out is required";

Callers 1

mainFunction · 0.85

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected