Play-/Source/ElfFile.h

35 lines
652 B
C
Raw Permalink Normal View History

2022-03-13 16:13:38 -04:00
#pragma once
#include "ELF.h"
2022-03-13 16:13:38 -04:00
#include "Stream.h"
class CElfFileContainer
{
public:
2018-04-30 21:01:23 +01:00
CElfFileContainer(Framework::CStream&);
virtual ~CElfFileContainer();
2018-04-30 21:01:23 +01:00
uint8* GetFileContent() const;
uint64 GetFileSize() const;
private:
uint8* m_content = nullptr;
uint64 m_size = 0;
};
template <typename ElfType>
class CElfFile : protected CElfFileContainer, public ElfType
{
public:
CElfFile(Framework::CStream& stream)
: CElfFileContainer(stream)
, ElfType(GetFileContent(), GetFileSize())
{
}
virtual ~CElfFile() = default;
};
typedef CElfFile<CELF32> CElf32File;
typedef CElfFile<CELF64> CElf64File;