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 
14 #include <string>
15 #include <vector>
16 
17 namespace mcld {
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  public:
27   typedef std::vector<std::string> FormatList;
28   typedef FormatList::const_iterator const_iterator;
29   typedef FormatList::iterator iterator;
30 
31  public:
32   explicit OutputFormatCmd(const std::string& pFormat);
33   OutputFormatCmd(const std::string& pDefault,
34                   const std::string& pBig,
35                   const std::string& pLittle);
36   ~OutputFormatCmd();
37 
begin()38   const_iterator begin() const { return m_FormatList.begin(); }
begin()39   iterator begin() { return m_FormatList.begin(); }
end()40   const_iterator end() const { return m_FormatList.end(); }
end()41   iterator end() { return m_FormatList.end(); }
42 
43   void dump() const;
44 
classof(const ScriptCommand * pCmd)45   static bool classof(const ScriptCommand* pCmd) {
46     return pCmd->getKind() == ScriptCommand::OUTPUT_FORMAT;
47   }
48 
49   void activate(Module& pModule);
50 
51  private:
52   FormatList m_FormatList;
53 };
54 
55 }  // namespace mcld
56 
57 #endif  // MCLD_SCRIPT_OUTPUTFORMATCMD_H_
58