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