1 //===- SectionsCmd.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_SCRIPT_SECTIONSCMD_H_ 10 #define MCLD_SCRIPT_SECTIONSCMD_H_ 11 12 #include "mcld/Script/ScriptCommand.h" 13 14 #include <llvm/Support/DataTypes.h> 15 16 #include <vector> 17 18 namespace mcld { 19 20 class Module; 21 22 /** \class SectionsCmd 23 * \brief This class defines the interfaces to SECTIONS command. 24 */ 25 26 class SectionsCmd : public ScriptCommand { 27 public: 28 typedef std::vector<ScriptCommand*> SectionCommands; 29 typedef SectionCommands::const_iterator const_iterator; 30 typedef SectionCommands::iterator iterator; 31 typedef SectionCommands::const_reference const_reference; 32 typedef SectionCommands::reference reference; 33 34 public: 35 SectionsCmd(); 36 ~SectionsCmd(); 37 38 const_iterator begin() const { return m_SectionCommands.begin(); } 39 iterator begin() { return m_SectionCommands.begin(); } 40 const_iterator end() const { return m_SectionCommands.end(); } 41 iterator end() { return m_SectionCommands.end(); } 42 43 const_reference front() const { return m_SectionCommands.front(); } 44 reference front() { return m_SectionCommands.front(); } 45 const_reference back() const { return m_SectionCommands.back(); } 46 reference back() { return m_SectionCommands.back(); } 47 48 size_t size() const { return m_SectionCommands.size(); } 49 50 bool empty() const { return m_SectionCommands.empty(); } 51 52 void dump() const; 53 54 static bool classof(const ScriptCommand* pCmd) { 55 return pCmd->getKind() == ScriptCommand::SECTIONS; 56 } 57 58 void activate(Module& pModule); 59 60 void push_back(ScriptCommand* pCommand); 61 62 private: 63 SectionCommands m_SectionCommands; 64 }; 65 66 } // namespace mcld 67 68 #endif // MCLD_SCRIPT_SECTIONSCMD_H_ 69