1 //===- ObjectWriter.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_LD_OBJECTWRITER_H 10 #define MCLD_LD_OBJECTWRITER_H 11 #include <system_error> 12 13 namespace mcld { 14 15 class Module; 16 class FileOutputBuffer; 17 18 /** \class ObjectWriter 19 * \brief ObjectWriter provides a common interface for object file writers. 20 */ 21 class ObjectWriter 22 { 23 protected: 24 ObjectWriter(); 25 26 public: 27 virtual ~ObjectWriter(); 28 29 virtual std::error_code writeObject(Module& pModule, 30 FileOutputBuffer& pOutput) = 0; 31 32 virtual size_t getOutputSize(const Module& pModule) const = 0; 33 }; 34 35 } // namespace of mcld 36 37 #endif 38 39