1 //===- OutputFormatCmd.cpp ------------------------------------------------===//
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 #include "mcld/Script/OutputFormatCmd.h"
10 #include "mcld/Support/raw_ostream.h"
11 
12 namespace mcld {
13 
14 //===----------------------------------------------------------------------===//
15 // OutputFormatCmd
16 //===----------------------------------------------------------------------===//
OutputFormatCmd(const std::string & pFormat)17 OutputFormatCmd::OutputFormatCmd(const std::string& pFormat)
18     : ScriptCommand(ScriptCommand::OUTPUT_FORMAT) {
19   m_FormatList.push_back(pFormat);
20 }
21 
OutputFormatCmd(const std::string & pDefault,const std::string & pBig,const std::string & pLittle)22 OutputFormatCmd::OutputFormatCmd(const std::string& pDefault,
23                                  const std::string& pBig,
24                                  const std::string& pLittle)
25     : ScriptCommand(ScriptCommand::OUTPUT_FORMAT) {
26   m_FormatList.push_back(pDefault);
27   m_FormatList.push_back(pBig);
28   m_FormatList.push_back(pLittle);
29 }
30 
~OutputFormatCmd()31 OutputFormatCmd::~OutputFormatCmd() {
32 }
33 
dump() const34 void OutputFormatCmd::dump() const {
35   mcld::outs() << "OUTPUT_FORMAT ( ";
36   assert(m_FormatList.size() == 1 || m_FormatList.size() == 3);
37   for (size_t i = 0; i < m_FormatList.size(); ++i) {
38     if (i != 0)
39       mcld::outs() << " , ";
40     mcld::outs() << m_FormatList[i];
41   }
42   mcld::outs() << " )\n";
43 }
44 
activate(Module & pModule)45 void OutputFormatCmd::activate(Module& pModule) {
46   // TODO
47 }
48 
49 }  // namespace mcld
50