35 std::vector<std::shared_ptr<Section>>
sections;
85 void Append(std::shared_ptr<Section> section);
89 offset_t
WriteFile(std::ostream& out, offset_t size, offset_t offset = 0);
97 offset_t
WriteFile(
Writer& wr, offset_t count, offset_t offset = 0)
override;
102 int GetByte(offset_t offset)
override;
133 void ShiftAddress(int64_t amount);
141 std::ostream& operator<<(std::ostream& out,
const Segment& segment);
A class representing a sequence of sections that must be written to the output file as a group.
Definition segment.h:26
std::string name
The name of the segment.
Definition segment.h:31
void Append(std::shared_ptr< Section > section)
Appends section to segment.
Definition segment.cc:40
offset_t zero_fill
Extra zero filled space following filled data.
Definition segment.h:57
offset_t GetEndAddress()
Returns end address (GetStartAddress() + TotalSize())
Definition segment.cc:171
void AlignEndAddress(offset_t align)
Aligns the end of the segment.
Definition segment.cc:203
offset_t base_address
Address where segment starts.
Definition segment.h:39
std::vector< std::shared_ptr< Section > > sections
Sequence of sections belonging to the segment.
Definition segment.h:35
void RealignEnd(offset_t align)
Aligns end of segment by increasing size of last section.
Definition segment.cc:26
void Fill()
Fills zero filled sections with zero data, making them non-zero filled in the sense that they have to...
Definition segment.cc:12
offset_t data_size
Cached value of the non-filled data for the entire segment.
Definition segment.h:50
offset_t optional_extra
Optional extra space after zero filled data.
Definition segment.h:61
offset_t WriteFile(std::ostream &out, offset_t size, offset_t offset=0)
Writes data of non-zero filled sections.
Definition segment.cc:86
void SetStartAddress(offset_t address)
Forcibly resets starting address of segment.
Definition segment.cc:226
offset_t ActualDataSize() override
Retrieves size of all data in segment.
Definition segment.cc:154
offset_t TotalSize()
Retrieves total size of segment.
Definition segment.cc:149
bool IsMissing()
Segment that contains neither non zero filled, nor zero filled, nor optional extra data.
Definition segment.cc:7
int GetByte(offset_t offset) override
Retrieve byte at a certain offset (optional, might not be defined)
Definition segment.cc:133
void SetEndAddress(offset_t address)
Increases final section to end on specified address.
Definition segment.cc:176
offset_t GetStartAddress()
Returns starting address (base_address)
Definition segment.cc:166
offset_t align
Alignment requirements of segment.
Definition segment.h:43
Represents an abstract interface whose data can be written to a file.
Definition writable.h:15
A helper class, encapsulating functionality needed to export binary data.
Definition writer.h:15