Stephen Hines | 87f3465 | 2014-02-14 18:00:16 -0800 | [diff] [blame] | 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 | //===----------------------------------------------------------------------===// |
Stephen Hines | 37b74a3 | 2014-11-26 18:48:20 -0800 | [diff] [blame] | 9 | #ifndef MCLD_SCRIPT_OUTPUTFORMATCMD_H_ |
| 10 | #define MCLD_SCRIPT_OUTPUTFORMATCMD_H_ |
Stephen Hines | 87f3465 | 2014-02-14 18:00:16 -0800 | [diff] [blame] | 11 | |
Stephen Hines | 37b74a3 | 2014-11-26 18:48:20 -0800 | [diff] [blame] | 12 | #include "mcld/Script/ScriptCommand.h" |
| 13 | |
Stephen Hines | 87f3465 | 2014-02-14 18:00:16 -0800 | [diff] [blame] | 14 | #include <string> |
| 15 | #include <vector> |
| 16 | |
Stephen Hines | 37b74a3 | 2014-11-26 18:48:20 -0800 | [diff] [blame] | 17 | namespace mcld { |
Stephen Hines | 87f3465 | 2014-02-14 18:00:16 -0800 | [diff] [blame] | 18 | |
| 19 | class Module; |
| 20 | |
| 21 | /** \class OutputFormatCmd |
| 22 | * \brief This class defines the interfaces to OutputFormat command. |
| 23 | */ |
| 24 | |
Stephen Hines | 37b74a3 | 2014-11-26 18:48:20 -0800 | [diff] [blame] | 25 | class OutputFormatCmd : public ScriptCommand { |
| 26 | public: |
Stephen Hines | 87f3465 | 2014-02-14 18:00:16 -0800 | [diff] [blame] | 27 | typedef std::vector<std::string> FormatList; |
| 28 | typedef FormatList::const_iterator const_iterator; |
| 29 | typedef FormatList::iterator iterator; |
| 30 | |
Stephen Hines | 37b74a3 | 2014-11-26 18:48:20 -0800 | [diff] [blame] | 31 | public: |
| 32 | explicit OutputFormatCmd(const std::string& pFormat); |
Stephen Hines | 87f3465 | 2014-02-14 18:00:16 -0800 | [diff] [blame] | 33 | 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 Hines | 37b74a3 | 2014-11-26 18:48:20 -0800 | [diff] [blame] | 39 | iterator begin() { return m_FormatList.begin(); } |
| 40 | const_iterator end() const { return m_FormatList.end(); } |
| 41 | iterator end() { return m_FormatList.end(); } |
Stephen Hines | 87f3465 | 2014-02-14 18:00:16 -0800 | [diff] [blame] | 42 | |
| 43 | void dump() const; |
| 44 | |
Stephen Hines | 37b74a3 | 2014-11-26 18:48:20 -0800 | [diff] [blame] | 45 | static bool classof(const ScriptCommand* pCmd) { |
Stephen Hines | 87f3465 | 2014-02-14 18:00:16 -0800 | [diff] [blame] | 46 | return pCmd->getKind() == ScriptCommand::OUTPUT_FORMAT; |
| 47 | } |
| 48 | |
| 49 | void activate(Module& pModule); |
| 50 | |
Stephen Hines | 37b74a3 | 2014-11-26 18:48:20 -0800 | [diff] [blame] | 51 | private: |
Stephen Hines | 87f3465 | 2014-02-14 18:00:16 -0800 | [diff] [blame] | 52 | FormatList m_FormatList; |
| 53 | }; |
| 54 | |
Stephen Hines | 37b74a3 | 2014-11-26 18:48:20 -0800 | [diff] [blame] | 55 | } // namespace mcld |
Stephen Hines | 87f3465 | 2014-02-14 18:00:16 -0800 | [diff] [blame] | 56 | |
Stephen Hines | 37b74a3 | 2014-11-26 18:48:20 -0800 | [diff] [blame] | 57 | #endif // MCLD_SCRIPT_OUTPUTFORMATCMD_H_ |