2013-08-23 13:46:38 -04:00
|
|
|
//===-- CommandObjectRegexCommand.h -----------------------------*- C++ -*-===//
|
|
|
|
|
//
|
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
|
//
|
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
|
|
#ifndef liblldb_CommandObjectRegexCommand_h_
|
|
|
|
|
#define liblldb_CommandObjectRegexCommand_h_
|
|
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
|
|
|
|
|
|
#include "lldb/Interpreter/CommandObject.h"
|
2018-07-28 07:09:23 -04:00
|
|
|
#include "lldb/Utility/CompletionRequest.h"
|
2017-04-16 12:04:10 -04:00
|
|
|
#include "lldb/Utility/RegularExpression.h"
|
2013-08-23 13:46:38 -04:00
|
|
|
|
|
|
|
|
namespace lldb_private {
|
|
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
// CommandObjectRegexCommand
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
2017-01-02 14:26:05 -05:00
|
|
|
class CommandObjectRegexCommand : public CommandObjectRaw {
|
2013-08-23 13:46:38 -04:00
|
|
|
public:
|
2017-01-02 14:26:05 -05:00
|
|
|
CommandObjectRegexCommand(CommandInterpreter &interpreter, llvm::StringRef name,
|
|
|
|
|
llvm::StringRef help, llvm::StringRef syntax,
|
|
|
|
|
uint32_t max_matches, uint32_t completion_type_mask,
|
|
|
|
|
bool is_removable);
|
|
|
|
|
|
|
|
|
|
~CommandObjectRegexCommand() override;
|
|
|
|
|
|
|
|
|
|
bool IsRemovable() const override { return m_is_removable; }
|
|
|
|
|
|
|
|
|
|
bool AddRegexCommand(const char *re_cstr, const char *command_cstr);
|
|
|
|
|
|
|
|
|
|
bool HasRegexEntries() const { return !m_entries.empty(); }
|
|
|
|
|
|
2018-07-28 07:09:23 -04:00
|
|
|
int HandleCompletion(CompletionRequest &request) override;
|
2013-08-23 13:46:38 -04:00
|
|
|
|
|
|
|
|
protected:
|
2018-07-28 07:09:23 -04:00
|
|
|
bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
|
2013-08-23 13:46:38 -04:00
|
|
|
|
2017-01-02 14:26:05 -05:00
|
|
|
struct Entry {
|
|
|
|
|
RegularExpression regex;
|
|
|
|
|
std::string command;
|
|
|
|
|
};
|
2013-08-23 13:46:38 -04:00
|
|
|
|
2017-01-02 14:26:05 -05:00
|
|
|
typedef std::list<Entry> EntryCollection;
|
|
|
|
|
const uint32_t m_max_matches;
|
|
|
|
|
const uint32_t m_completion_type_mask;
|
|
|
|
|
EntryCollection m_entries;
|
|
|
|
|
bool m_is_removable;
|
2013-08-23 13:46:38 -04:00
|
|
|
|
|
|
|
|
private:
|
2017-01-02 14:26:05 -05:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CommandObjectRegexCommand);
|
2013-08-23 13:46:38 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace lldb_private
|
|
|
|
|
|
2015-12-30 06:55:28 -05:00
|
|
|
#endif // liblldb_CommandObjectRegexCommand_h_
|