Home | History | Annotate | Download | only in Script
      1 //===- AssertCmd.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_ASSERTCMD_H_
     10 #define MCLD_SCRIPT_ASSERTCMD_H_
     11 
     12 #include "mcld/Script/ScriptCommand.h"
     13 
     14 #include <string>
     15 
     16 namespace mcld {
     17 
     18 class RpnExpr;
     19 class Module;
     20 
     21 /** \class AssertCmd
     22  *  \brief This class defines the interfaces to assert command.
     23  */
     24 
     25 class AssertCmd : public ScriptCommand {
     26  public:
     27   AssertCmd(RpnExpr& pRpnExpr, const std::string& pMessage);
     28 
     29   ~AssertCmd();
     30 
     31   AssertCmd& operator=(const AssertCmd& pAssertCmd);
     32 
     33   const RpnExpr& getRpnExpr() const { return m_RpnExpr; }
     34   RpnExpr& getRpnExpr() { return m_RpnExpr; }
     35 
     36   const std::string& message() const { return m_Message; }
     37 
     38   void dump() const;
     39 
     40   static bool classof(const ScriptCommand* pCmd) {
     41     return pCmd->getKind() == ScriptCommand::ASSERT;
     42   }
     43 
     44   void activate(Module& pModule);
     45 
     46  private:
     47   RpnExpr& m_RpnExpr;
     48   std::string m_Message;
     49 };
     50 
     51 }  // namespace mcld
     52 
     53 #endif  // MCLD_SCRIPT_ASSERTCMD_H_
     54