retdec
file_segment.h
Go to the documentation of this file.
1 
7 #ifndef FILEINFO_FILE_INFORMATION_FILE_INFORMATION_TYPES_FILE_SEGMENT_H
8 #define FILEINFO_FILE_INFORMATION_FILE_INFORMATION_TYPES_FILE_SEGMENT_H
9 
10 #include <limits>
11 
13 
14 namespace retdec {
15 namespace fileinfo {
16 
23 {
24  private:
25  std::string segmentType;
26  std::string crc32;
27  std::string md5;
28  std::string sha256;
29  unsigned long long index = std::numeric_limits<unsigned long long>::max();
30  unsigned long long offset = std::numeric_limits<unsigned long long>::max();
31  unsigned long long virtualAddress = std::numeric_limits<unsigned long long>::max();
32  unsigned long long physicalAddress = std::numeric_limits<unsigned long long>::max();
33  unsigned long long sizeInFile = std::numeric_limits<unsigned long long>::max();
34  unsigned long long sizeInMemory = std::numeric_limits<unsigned long long>::max();
35  unsigned long long alignment = std::numeric_limits<unsigned long long>::max();
37  public:
40  std::string getType() const;
41  std::string getCrc32() const;
42  std::string getMd5() const;
43  std::string getSha256() const;
44  std::string getIndexStr() const;
45  std::string getOffsetStr(std::ios_base &(* format)(std::ios_base &)) const;
46  std::string getVirtualAddressStr(std::ios_base &(* format)(std::ios_base &)) const;
47  std::string getPhysicalAddressStr(std::ios_base &(* format)(std::ios_base &)) const;
48  std::string getSizeInFileStr(std::ios_base &(* format)(std::ios_base &)) const;
49  std::string getSizeInMemoryStr(std::ios_base &(* format)(std::ios_base &)) const;
50  std::string getAlignmentStr(std::ios_base &(* format)(std::ios_base &)) const;
51  unsigned long long getFlagsSize() const;
52  unsigned long long getFlags() const;
53  std::string getFlagsStr() const;
54  std::size_t getNumberOfFlagsDescriptors() const;
55  void getFlagsDescriptors(std::vector<std::string> &desc, std::vector<std::string> &abb) const;
57 
60  void setType(std::string type);
61  void setCrc32(std::string segmentCrc32);
62  void setMd5(std::string segmentMd5);
63  void setSha256(std::string segmentSha256);
64  void setIndex(unsigned long long segmentIndex);
65  void setOffset(unsigned long long fileOffset);
66  void setVirtualAddress(unsigned long long address);
67  void setPhysicalAddress(unsigned long long address);
68  void setSizeInFile(unsigned long long size);
69  void setSizeInMemory(unsigned long long size);
70  void setAlignment(unsigned long long segmentAlignment);
71  void setFlagsSize(unsigned long long flagsSize);
72  void setFlags(unsigned long long flags);
74 
77  void addFlagsDescriptor(std::string descriptor, std::string abbreviation);
78  void clearFlagsDescriptors();
80 };
81 
82 } // namespace fileinfo
83 } // namespace retdec
84 
85 #endif
Definition: file_segment.h:23
std::string getCrc32() const
Definition: file_segment.cpp:26
void setPhysicalAddress(unsigned long long address)
Definition: file_segment.cpp:231
std::size_t getNumberOfFlagsDescriptors() const
Definition: file_segment.cpp:147
void setFlags(unsigned long long flags)
Definition: file_segment.cpp:276
void getFlagsDescriptors(std::vector< std::string > &desc, std::vector< std::string > &abb) const
Definition: file_segment.cpp:159
std::string getFlagsStr() const
Definition: file_segment.cpp:138
std::string getSha256() const
Definition: file_segment.cpp:44
std::string getVirtualAddressStr(std::ios_base &(*format)(std::ios_base &)) const
Definition: file_segment.cpp:73
unsigned long long sizeInFile
size of segment in file
Definition: file_segment.h:33
unsigned long long alignment
alignment in memory and in file
Definition: file_segment.h:35
void setCrc32(std::string segmentCrc32)
Definition: file_segment.cpp:177
std::string getOffsetStr(std::ios_base &(*format)(std::ios_base &)) const
Definition: file_segment.cpp:63
std::string getAlignmentStr(std::ios_base &(*format)(std::ios_base &)) const
Definition: file_segment.cpp:111
std::string getSizeInFileStr(std::ios_base &(*format)(std::ios_base &)) const
Definition: file_segment.cpp:92
void clearFlagsDescriptors()
Definition: file_segment.cpp:294
unsigned long long getFlagsSize() const
Definition: file_segment.cpp:120
void setMd5(std::string segmentMd5)
Definition: file_segment.cpp:186
std::string getType() const
Definition: file_segment.cpp:17
std::string getSizeInMemoryStr(std::ios_base &(*format)(std::ios_base &)) const
Definition: file_segment.cpp:101
std::string getMd5() const
Definition: file_segment.cpp:35
unsigned long long getFlags() const
Definition: file_segment.cpp:129
std::string crc32
CRC32 of segment content.
Definition: file_segment.h:26
void setVirtualAddress(unsigned long long address)
Definition: file_segment.cpp:222
unsigned long long physicalAddress
physical address in memory
Definition: file_segment.h:32
unsigned long long offset
offset in file
Definition: file_segment.h:30
void setSha256(std::string segmentSha256)
Definition: file_segment.cpp:195
void setIndex(unsigned long long segmentIndex)
Definition: file_segment.cpp:204
void setSizeInMemory(unsigned long long size)
Definition: file_segment.cpp:249
void setAlignment(unsigned long long segmentAlignment)
Definition: file_segment.cpp:258
void setOffset(unsigned long long fileOffset)
Definition: file_segment.cpp:213
unsigned long long virtualAddress
virtual address in memory
Definition: file_segment.h:31
void addFlagsDescriptor(std::string descriptor, std::string abbreviation)
Definition: file_segment.cpp:286
std::string getPhysicalAddressStr(std::ios_base &(*format)(std::ios_base &)) const
Definition: file_segment.cpp:83
unsigned long long sizeInMemory
size of segment in memory
Definition: file_segment.h:34
Flags flags
segment flags
Definition: file_segment.h:36
std::string sha256
SHA256 of segment content.
Definition: file_segment.h:28
unsigned long long index
index of segment
Definition: file_segment.h:29
std::string segmentType
type of segment
Definition: file_segment.h:25
std::string getIndexStr() const
Definition: file_segment.cpp:53
void setSizeInFile(unsigned long long size)
Definition: file_segment.cpp:240
void setFlagsSize(unsigned long long flagsSize)
Definition: file_segment.cpp:267
void setType(std::string type)
Definition: file_segment.cpp:168
std::string md5
MD5 of segment content.
Definition: file_segment.h:27
Definition: flags.h:20
Class for binary flags.
Definition: archive_wrapper.h:19