MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / Bytes

Class Bytes

lib/core/bytes.h:9–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7class ByteWriter;
8
9class Bytes
10{
11public:
12 Bytes();
13 Bytes(unsigned size);
14 Bytes(const uint8_t* ptr, size_t len);
15 Bytes(const char* data);
16 Bytes(const std::string& data);
17 Bytes(std::initializer_list<uint8_t> data);
18 Bytes(std::shared_ptr<std::vector<uint8_t>> data);
19 Bytes(std::shared_ptr<std::vector<uint8_t>> data,
20 unsigned start,
21 unsigned end);
22 Bytes(std::istream& istream, size_t len = SIZE_MAX);
23
24 Bytes* operator=(const Bytes& other);
25
26public:
27 static Bytes readFromFile(const std::string& filename);
28
29public:
30 /* General purpose methods */
31
32 unsigned size() const
33 {
34 return _high - _low;
35 }
36 bool empty() const
37 {
38 return _high == _low;
39 }
40
41 bool operator==(const Bytes& other) const
42 {
43 return std::equal(cbegin(), cend(), other.cbegin(), other.cend());
44 }
45
46 bool operator!=(const Bytes& other) const
47 {
48 return !(*this == other);
49 }
50
51 const uint8_t& operator[](unsigned offset) const;
52 const uint8_t* cbegin() const
53 {
54 return _data->data() + _low;
55 }
56 const uint8_t* cend() const
57 {
58 return _data->data() + _high;
59 }
60 const uint8_t* begin() const
61 {
62 return _data->data() + _low;
63 }
64 const uint8_t* end() const
65 {
66 return _data->data() + _high;

Callers 15

sliceMethod · 0.70
ByteWriterClass · 0.70
write_sectorFunction · 0.50
sqlReadFluxBytesFunction · 0.50
readSingleFluxMethod · 0.50
CwfFluxSourceMethod · 0.50
writeImageMethod · 0.50
addMissingSectorsMethod · 0.50
getFileMethod · 0.50
writeMethod · 0.50
getFileMethod · 0.50
getFileMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected