GCC Code Coverage Report


Directory: ../
File: src/util/RawStringOStream.cpp
Date: 2024-11-22 23:10:59
Exec Total Coverage
Lines: 2 7 28.6%
Functions: 2 4 50.0%
Branches: 0 2 0.0%

Line Branch Exec Source
1 // Copyright (c) 2021-2024 ChilliBits. All rights reserved.
2
3 #include "RawStringOStream.h"
4
5 namespace spice::compiler {
6
7 641 RawStringOStream::RawStringOStream(std::string &output) : raw_pwrite_stream(true), output(output) {}
8
9 void RawStringOStream::pwrite_impl(const char *Ptr, const size_t Size, const uint64_t Offset) {
10 assert(output.length() >= Offset + Size);
11 std::memcpy(output.data() + Offset, Ptr, Size);
12 }
13
14 2127329 void RawStringOStream::write_impl(const char *Ptr, const size_t Size) { output.append(Ptr, Size); }
15
16 uint64_t RawStringOStream::current_pos() const { return output.size(); }
17
18 } // namespace spice::compiler
19