Path: blob/main/contrib/llvm-project/lldb/source/Commands/CommandObjectRegexCommand.h
39587 views
//===-- CommandObjectRegexCommand.h -----------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_INTERPRETER_COMMANDOBJECTREGEXCOMMAND_H9#define LLDB_INTERPRETER_COMMANDOBJECTREGEXCOMMAND_H1011#include <list>1213#include "lldb/Interpreter/CommandObject.h"14#include "lldb/Utility/CompletionRequest.h"15#include "lldb/Utility/RegularExpression.h"1617namespace lldb_private {1819// CommandObjectRegexCommand2021class CommandObjectRegexCommand : public CommandObjectRaw {22public:23CommandObjectRegexCommand(CommandInterpreter &interpreter,24llvm::StringRef name, llvm::StringRef help,25llvm::StringRef syntax,26uint32_t completion_type_mask, bool is_removable);2728~CommandObjectRegexCommand() override;2930bool IsRemovable() const override { return m_is_removable; }3132bool AddRegexCommand(llvm::StringRef re_cstr, llvm::StringRef command_cstr);3334bool HasRegexEntries() const { return !m_entries.empty(); }3536void HandleCompletion(CompletionRequest &request) override;3738protected:39void DoExecute(llvm::StringRef command, CommandReturnObject &result) override;4041/// Substitute variables of the format %\d+ in the input string.42static llvm::Expected<std::string> SubstituteVariables(43llvm::StringRef input,44const llvm::SmallVectorImpl<llvm::StringRef> &replacements);4546struct Entry {47RegularExpression regex;48std::string command;49};5051typedef std::list<Entry> EntryCollection;52const uint32_t m_completion_type_mask;53EntryCollection m_entries;54bool m_is_removable;5556private:57CommandObjectRegexCommand(const CommandObjectRegexCommand &) = delete;58const CommandObjectRegexCommand &59operator=(const CommandObjectRegexCommand &) = delete;60};6162} // namespace lldb_private6364#endif // LLDB_INTERPRETER_COMMANDOBJECTREGEXCOMMAND_H656667