Home | History | Annotate | Download | only in Script
      1 //===- OutputFormatCmd.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_OUTPUTFORMATCMD_H
     10 #define MCLD_SCRIPT_OUTPUTFORMATCMD_H
     11 
     12 #include <mcld/Script/ScriptCommand.h>
     13 #include <string>
     14 #include <vector>
     15 
     16 namespace mcld
     17 {
     18 
     19 class Module;
     20 
     21 /** \class OutputFormatCmd
     22  *  \brief This class defines the interfaces to OutputFormat command.
     23  */
     24 
     25 class OutputFormatCmd : public ScriptCommand
     26 {
     27 public:
     28   typedef std::vector<std::string> FormatList;
     29   typedef FormatList::const_iterator const_iterator;
     30   typedef FormatList::iterator iterator;
     31 
     32 public:
     33   OutputFormatCmd(const std::string& pFormat);
     34   OutputFormatCmd(const std::string& pDefault,
     35                   const std::string& pBig,
     36                   const std::string& pLittle);
     37   ~OutputFormatCmd();
     38 
     39   const_iterator begin() const { return m_FormatList.begin(); }
     40   iterator       begin()       { return m_FormatList.begin(); }
     41   const_iterator end()   const { return m_FormatList.end(); }
     42   iterator       end()         { return m_FormatList.end(); }
     43 
     44   void dump() const;
     45 
     46   static bool classof(const ScriptCommand* pCmd)
     47   {
     48     return pCmd->getKind() == ScriptCommand::OUTPUT_FORMAT;
     49   }
     50 
     51   void activate(Module& pModule);
     52 
     53 private:
     54   FormatList m_FormatList;
     55 };
     56 
     57 } // namespace of mcld
     58 
     59 #endif
     60 
     61