CommandObjectRegexCommand.h revision d12aeab33bab559e138307f599077da3918a3238
1//===-- CommandObjectRegexCommand.h -----------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef liblldb_CommandObjectRegexCommand_h_ 11#define liblldb_CommandObjectRegexCommand_h_ 12 13// C Includes 14// C++ Includes 15#include <list> 16 17// Other libraries and framework includes 18// Project includes 19#include "lldb/Core/RegularExpression.h" 20#include "lldb/Interpreter/CommandObject.h" 21 22namespace lldb_private { 23 24//------------------------------------------------------------------------- 25// CommandObjectRegexCommand 26//------------------------------------------------------------------------- 27 28class CommandObjectRegexCommand : public CommandObject 29{ 30public: 31 32 CommandObjectRegexCommand (CommandInterpreter &interpreter, 33 const char *name, 34 const char *help, 35 const char *syntax, 36 uint32_t max_matches); 37 38 virtual 39 ~CommandObjectRegexCommand (); 40 41 virtual bool 42 Execute (Args& command, 43 CommandReturnObject &result); 44 45 virtual bool 46 WantsRawCommandString() { return true; } 47 48 virtual bool 49 ExecuteRawCommandString (const char *command, 50 CommandReturnObject &result); 51 52 53 bool 54 AddRegexCommand (const char *re_cstr, const char *command_cstr); 55 56 bool 57 HasRegexEntries () const 58 { 59 return !m_entries.empty(); 60 } 61 62protected: 63 struct Entry 64 { 65 RegularExpression regex; 66 std::string command; 67 }; 68 69 typedef std::list<Entry> EntryCollection; 70 const uint32_t m_max_matches; 71 EntryCollection m_entries; 72 73private: 74 DISALLOW_COPY_AND_ASSIGN (CommandObjectRegexCommand); 75}; 76 77} // namespace lldb_private 78 79#endif // liblldb_CommandObjectRegexCommand_h_ 80