blob: 307f738e65893d9573b8c095dc14bf82b3882f72 [file] [log] [blame]
Stephen Hines87f34652014-02-14 18:00:16 -08001//===- 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//===----------------------------------------------------------------------===//
Stephen Hines37b74a32014-11-26 18:48:20 -08009#ifndef MCLD_SCRIPT_OUTPUTFORMATCMD_H_
10#define MCLD_SCRIPT_OUTPUTFORMATCMD_H_
Stephen Hines87f34652014-02-14 18:00:16 -080011
Stephen Hines37b74a32014-11-26 18:48:20 -080012#include "mcld/Script/ScriptCommand.h"
13
Stephen Hines87f34652014-02-14 18:00:16 -080014#include <string>
15#include <vector>
16
Stephen Hines37b74a32014-11-26 18:48:20 -080017namespace mcld {
Stephen Hines87f34652014-02-14 18:00:16 -080018
19class Module;
20
21/** \class OutputFormatCmd
22 * \brief This class defines the interfaces to OutputFormat command.
23 */
24
Stephen Hines37b74a32014-11-26 18:48:20 -080025class OutputFormatCmd : public ScriptCommand {
26 public:
Stephen Hines87f34652014-02-14 18:00:16 -080027 typedef std::vector<std::string> FormatList;
28 typedef FormatList::const_iterator const_iterator;
29 typedef FormatList::iterator iterator;
30
Stephen Hines37b74a32014-11-26 18:48:20 -080031 public:
32 explicit OutputFormatCmd(const std::string& pFormat);
Stephen Hines87f34652014-02-14 18:00:16 -080033 OutputFormatCmd(const std::string& pDefault,
34 const std::string& pBig,
35 const std::string& pLittle);
36 ~OutputFormatCmd();
37
38 const_iterator begin() const { return m_FormatList.begin(); }
Stephen Hines37b74a32014-11-26 18:48:20 -080039 iterator begin() { return m_FormatList.begin(); }
40 const_iterator end() const { return m_FormatList.end(); }
41 iterator end() { return m_FormatList.end(); }
Stephen Hines87f34652014-02-14 18:00:16 -080042
43 void dump() const;
44
Stephen Hines37b74a32014-11-26 18:48:20 -080045 static bool classof(const ScriptCommand* pCmd) {
Stephen Hines87f34652014-02-14 18:00:16 -080046 return pCmd->getKind() == ScriptCommand::OUTPUT_FORMAT;
47 }
48
49 void activate(Module& pModule);
50
Stephen Hines37b74a32014-11-26 18:48:20 -080051 private:
Stephen Hines87f34652014-02-14 18:00:16 -080052 FormatList m_FormatList;
53};
54
Stephen Hines37b74a32014-11-26 18:48:20 -080055} // namespace mcld
Stephen Hines87f34652014-02-14 18:00:16 -080056
Stephen Hines37b74a32014-11-26 18:48:20 -080057#endif // MCLD_SCRIPT_OUTPUTFORMATCMD_H_