diff --git a/elfio/elfio_section.hpp b/elfio/elfio_section.hpp index 0e873ff..fd8b586 100644 --- a/elfio/elfio_section.hpp +++ b/elfio/elfio_section.hpp @@ -32,6 +32,7 @@ namespace ELFIO { class section { + friend class elfio; public: virtual ~section() {}; @@ -65,6 +66,7 @@ class section virtual void append_data( const char* pData, Elf_Word size ) = 0; virtual void append_data( const std::string& data ) = 0; + protected: virtual void load( std::ifstream& f, std::streampos header_offset ) const = 0; virtual void save( std::ofstream& f, @@ -190,6 +192,8 @@ class section_impl : public section return append_data( str_data.c_str(), str_data.size() ); } +//------------------------------------------------------------------------------ + protected: //------------------------------------------------------------------------------ void load( std::ifstream& stream, diff --git a/elfio/elfio_segment.hpp b/elfio/elfio_segment.hpp index 5bf430c..3c88e3d 100644 --- a/elfio/elfio_segment.hpp +++ b/elfio/elfio_segment.hpp @@ -32,6 +32,7 @@ namespace ELFIO { class segment { + friend class elfio; public: virtual ~segment() {}; @@ -59,6 +60,7 @@ class segment virtual Elf_Half get_sections_num() const = 0; virtual Elf_Half get_section_index_at( Elf_Half num ) const = 0; + protected: virtual void load( std::ifstream& stream, std::streampos header_offset ) const = 0; virtual void save( std::ofstream& f, std::streampos header_offset, std::streampos data_offset ) = 0; @@ -145,6 +147,8 @@ class segment_impl : public segment return -1; } +//------------------------------------------------------------------------------ + protected: //------------------------------------------------------------------------------ void load( std::ifstream& stream,