retdec
segment_data_source.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_LOADER_RETDEC_LOADER_SEGMENT_DATA_SOURCE_H
8 #define RETDEC_LOADER_RETDEC_LOADER_SEGMENT_DATA_SOURCE_H
9 
10 #include <cstdint>
11 #include <string>
12 #include <vector>
13 
14 #include <llvm/ADT/StringRef.h>
15 
16 namespace retdec {
17 namespace loader {
18 
20 {
21 public:
23  SegmentDataSource(const llvm::StringRef& data);
24  SegmentDataSource(const SegmentDataSource& dataLoader);
25 
26  bool isDataSet() const;
27 
28  const std::uint8_t* getData() const;
29  std::uint64_t getDataSize() const;
30 
31  void resize(std::uint64_t newSize);
32  bool shrink(std::uint64_t newOffset, std::uint64_t newSize);
33 
34  bool loadData(std::uint64_t loadOffset, std::uint64_t loadSize, std::vector<std::uint8_t>& data) const;
35  bool saveData(std::uint64_t saveOffset, std::uint64_t saveSize, const std::vector<std::uint8_t>& data);
36 
37 private:
38  llvm::StringRef _data;
39 };
40 
41 } // namespace loader
42 } // namespace retdec
43 
44 #endif
Definition: segment_data_source.h:20
llvm::StringRef _data
Definition: segment_data_source.h:38
SegmentDataSource()
Definition: segment_data_source.cpp:15
bool loadData(std::uint64_t loadOffset, std::uint64_t loadSize, std::vector< std::uint8_t > &data) const
Definition: segment_data_source.cpp:70
void resize(std::uint64_t newSize)
Definition: segment_data_source.cpp:44
const std::uint8_t * getData() const
Definition: segment_data_source.cpp:34
std::uint64_t getDataSize() const
Definition: segment_data_source.cpp:39
bool saveData(std::uint64_t saveOffset, std::uint64_t saveSize, const std::vector< std::uint8_t > &data)
Definition: segment_data_source.cpp:85
bool shrink(std::uint64_t newOffset, std::uint64_t newSize)
Definition: segment_data_source.cpp:49
bool isDataSet() const
Definition: segment_data_source.cpp:29
Generic loader.
Definition: archive_wrapper.h:19