1//===- GroupReader.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_GROUPREADER_H 10#define MCLD_LD_GROUPREADER_H 11 12#include <mcld/Module.h> 13 14namespace mcld 15{ 16class Archive; 17class ArchiveReader; 18class DynObjReader; 19class LinkerConfig; 20class ObjectReader; 21class BinaryReader; 22 23/** \class GroupReader 24 * \brief GroupReader handles the Group Node in InputTree 25 * 26 * Group Node is the root of sub-tree in InputTree which includes the iputs in 27 * the command line options --start-group and --end-group options 28 */ 29class GroupReader 30{ 31public: 32 GroupReader(Module& pModule, 33 ObjectReader& pObjectReader, 34 DynObjReader& pDynObjReader, 35 ArchiveReader& pArchiveReader, 36 BinaryReader& pBinaryReader); 37 38 ~GroupReader(); 39 40 /// readGroup - handle the input sub-tree wich its root is pRoot 41 /// @param pRoot - the root Group node of the sub-tree 42 bool readGroup(Module::input_iterator pRoot, 43 Module::input_iterator pEnd, 44 InputBuilder& pBuilder, 45 const LinkerConfig& pConfig); 46 47private: 48 /// ArchiveListEntry - record the Archive and the corresponding input iterator 49 /// of the archive node 50 struct ArchiveListEntry { 51 ArchiveListEntry(Archive& pArchive, Module::input_iterator pIterator) 52 : archive(pArchive), input(pIterator) { 53 } 54 Archive& archive; 55 Module::input_iterator input; 56 }; 57 58private: 59 Module& m_Module; 60 ObjectReader& m_ObjectReader; 61 DynObjReader& m_DynObjReader; 62 ArchiveReader& m_ArchiveReader; 63 BinaryReader& m_BinaryReader; 64}; 65 66} // namespace of mcld 67 68#endif 69 70