1 //===-- CommandObjectRegexCommand.h -----------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef liblldb_CommandObjectRegexCommand_h_
10 #define liblldb_CommandObjectRegexCommand_h_
14 #include "lldb/Interpreter/CommandObject.h"
15 #include "lldb/Utility/CompletionRequest.h"
16 #include "lldb/Utility/RegularExpression.h"
18 namespace lldb_private {
20 // CommandObjectRegexCommand
22 class CommandObjectRegexCommand : public CommandObjectRaw {
24 CommandObjectRegexCommand(CommandInterpreter &interpreter, llvm::StringRef name,
25 llvm::StringRef help, llvm::StringRef syntax,
26 uint32_t max_matches, uint32_t completion_type_mask,
29 ~CommandObjectRegexCommand() override;
31 bool IsRemovable() const override { return m_is_removable; }
33 bool AddRegexCommand(const char *re_cstr, const char *command_cstr);
35 bool HasRegexEntries() const { return !m_entries.empty(); }
37 int HandleCompletion(CompletionRequest &request) override;
40 bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
43 RegularExpression regex;
47 typedef std::list<Entry> EntryCollection;
48 const uint32_t m_max_matches;
49 const uint32_t m_completion_type_mask;
50 EntryCollection m_entries;
54 DISALLOW_COPY_AND_ASSIGN(CommandObjectRegexCommand);
57 } // namespace lldb_private
59 #endif // liblldb_CommandObjectRegexCommand_h_