1 //===- BinaryReader.h -----------------------------------------------------===// 2 // 3 // The MCLinker Project 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 #ifndef MCLD_Binary_READER_H 10 #define MCLD_Binary_READER_H 11 #ifdef ENABLE_UNITTEST 12 #include <gtest.h> 13 #endif 14 #include "mcld/LD/LDReader.h" 15 #include <llvm/Support/system_error.h> 16 17 namespace mcld { 18 19 class Module; 20 class Input; 21 22 /** \class BinaryReader 23 * \brief BinaryReader provides an common interface for different Binary 24 * formats. 25 */ 26 class BinaryReader : public LDReader 27 { 28 protected: BinaryReader()29 BinaryReader() 30 { } 31 32 public: ~BinaryReader()33 virtual ~BinaryReader() 34 { } 35 isMyFormat(Input & pInput)36 virtual bool isMyFormat(Input& pInput) const 37 { return true; } 38 39 virtual bool readBinary(Input& pFile) = 0; 40 }; 41 42 } // namespace of mcld 43 44 #endif 45 46