]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandObjectRegexCommand.h
Import the Linaro Cortex Strings library into contrib.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Interpreter / CommandObjectRegexCommand.h
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
22 namespace lldb_private {
23
24 //-------------------------------------------------------------------------
25 // CommandObjectRegexCommand
26 //-------------------------------------------------------------------------
27
28 class CommandObjectRegexCommand : public CommandObjectRaw
29 {
30 public:
31     CommandObjectRegexCommand (CommandInterpreter &interpreter,
32                                const char *name, 
33                                const char *help, 
34                                const char *syntax, 
35                                uint32_t max_matches,
36                                uint32_t completion_type_mask,
37                                bool is_removable);
38     
39     ~CommandObjectRegexCommand() override;
40
41     bool
42     IsRemovable () const override { return m_is_removable; }
43
44     bool
45     AddRegexCommand (const char *re_cstr, const char *command_cstr);
46
47     bool
48     HasRegexEntries () const
49     {
50         return !m_entries.empty();
51     }
52     
53     int
54     HandleCompletion (Args &input,
55                       int &cursor_index,
56                       int &cursor_char_position,
57                       int match_start_point,
58                       int max_return_elements,
59                       bool &word_complete,
60                       StringList &matches) override;
61
62 protected:
63     bool
64     DoExecute (const char *command, CommandReturnObject &result) override;
65
66     struct Entry
67     {
68         RegularExpression regex;
69         std::string command;
70     };
71
72     typedef std::list<Entry> EntryCollection;
73     const uint32_t m_max_matches;
74     const uint32_t m_completion_type_mask;
75     EntryCollection m_entries;
76     bool m_is_removable;
77
78 private:
79     DISALLOW_COPY_AND_ASSIGN (CommandObjectRegexCommand);
80 };
81
82 } // namespace lldb_private
83
84 #endif // liblldb_CommandObjectRegexCommand_h_