1254721Semaste//===-- CommandObjectRegexCommand.h -----------------------------*- C++ -*-===// 2254721Semaste// 3254721Semaste// The LLVM Compiler Infrastructure 4254721Semaste// 5254721Semaste// This file is distributed under the University of Illinois Open Source 6254721Semaste// License. See LICENSE.TXT for details. 7254721Semaste// 8254721Semaste//===----------------------------------------------------------------------===// 9254721Semaste 10254721Semaste#ifndef liblldb_CommandObjectRegexCommand_h_ 11254721Semaste#define liblldb_CommandObjectRegexCommand_h_ 12254721Semaste 13254721Semaste// C Includes 14254721Semaste// C++ Includes 15254721Semaste#include <list> 16254721Semaste 17254721Semaste// Other libraries and framework includes 18254721Semaste// Project includes 19254721Semaste#include "lldb/Core/RegularExpression.h" 20254721Semaste#include "lldb/Interpreter/CommandObject.h" 21254721Semaste 22254721Semastenamespace lldb_private { 23254721Semaste 24254721Semaste//------------------------------------------------------------------------- 25254721Semaste// CommandObjectRegexCommand 26254721Semaste//------------------------------------------------------------------------- 27254721Semaste 28254721Semasteclass CommandObjectRegexCommand : public CommandObjectRaw 29254721Semaste{ 30254721Semastepublic: 31254721Semaste 32254721Semaste CommandObjectRegexCommand (CommandInterpreter &interpreter, 33254721Semaste const char *name, 34254721Semaste const char *help, 35254721Semaste const char *syntax, 36254721Semaste uint32_t max_matches, 37254721Semaste uint32_t completion_type_mask = 0); 38254721Semaste 39254721Semaste virtual 40254721Semaste ~CommandObjectRegexCommand (); 41254721Semaste 42254721Semaste bool 43254721Semaste AddRegexCommand (const char *re_cstr, const char *command_cstr); 44254721Semaste 45254721Semaste bool 46254721Semaste HasRegexEntries () const 47254721Semaste { 48254721Semaste return !m_entries.empty(); 49254721Semaste } 50254721Semaste 51254721Semaste virtual int 52254721Semaste HandleCompletion (Args &input, 53254721Semaste int &cursor_index, 54254721Semaste int &cursor_char_position, 55254721Semaste int match_start_point, 56254721Semaste int max_return_elements, 57254721Semaste bool &word_complete, 58254721Semaste StringList &matches); 59254721Semaste 60254721Semasteprotected: 61254721Semaste virtual bool 62254721Semaste DoExecute (const char *command, CommandReturnObject &result); 63254721Semaste 64254721Semaste struct Entry 65254721Semaste { 66254721Semaste RegularExpression regex; 67254721Semaste std::string command; 68254721Semaste }; 69254721Semaste 70254721Semaste typedef std::list<Entry> EntryCollection; 71254721Semaste const uint32_t m_max_matches; 72254721Semaste const uint32_t m_completion_type_mask; 73254721Semaste EntryCollection m_entries; 74254721Semaste 75254721Semasteprivate: 76254721Semaste DISALLOW_COPY_AND_ASSIGN (CommandObjectRegexCommand); 77254721Semaste}; 78254721Semaste 79254721Semaste} // namespace lldb_private 80254721Semaste 81254721Semaste#endif // liblldb_CommandObjectRegexCommand_h_ 82