SBCommandInterpreter.h revision 6e4c5ce0f697eb9899a54854a2a9004e961b0de2
1//===-- SBCommandInterpreter.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 LLDB_SBCommandInterpreter_h_
11#define LLDB_SBCommandInterpreter_h_
12
13#include "lldb/API/SBDefines.h"
14
15namespace lldb {
16
17class SBCommandInterpreter
18{
19public:
20    enum
21    {
22        eBroadcastBitThreadShouldExit       = (1 << 0),
23        eBroadcastBitResetPrompt            = (1 << 1),
24        eBroadcastBitQuitCommandReceived    = (1 << 2)   // User entered quit
25    };
26
27
28    ~SBCommandInterpreter ();
29
30    bool
31    IsValid() const;
32
33    bool
34    CommandExists (const char *cmd);
35
36    bool
37    AliasExists (const char *cmd);
38
39    bool
40    UserCommandExists (const char *cmd);
41
42    lldb::SBBroadcaster
43    GetBroadcaster ();
44
45    //const char **
46    //GetEnvironmentVariables ();
47
48    bool
49    HasCommands ();
50
51    bool
52    HasAliases ();
53
54    bool
55    HasUserCommands ();
56
57    bool
58    HasAliasOptions ();
59
60    //bool
61    //HasInterpreterVariables ();
62
63    lldb::SBProcess
64    GetProcess ();
65
66    ssize_t
67    WriteToScriptInterpreter (const char *src);
68
69    ssize_t
70    WriteToScriptInterpreter (const char *src, size_t src_len);
71
72    void
73    SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result);
74
75    void
76    SourceInitFileInCurrentWorkingDirectory (lldb::SBCommandReturnObject &result);
77
78    lldb::ReturnStatus
79    HandleCommand (const char *command_line, lldb::SBCommandReturnObject &result, bool add_to_history = false);
80
81    int
82    HandleCompletion (const char *current_line,
83                      const char *cursor,
84                      const char *last_char,
85                      int match_start_point,
86                      int max_return_elements,
87                      SBStringList &matches);
88
89protected:
90
91    lldb_private::CommandInterpreter &
92    ref ();
93
94    lldb_private::CommandInterpreter *
95    get ();
96
97    void
98    reset (lldb_private::CommandInterpreter *);
99private:
100    friend class SBDebugger;
101
102    SBCommandInterpreter (lldb_private::CommandInterpreter *interpreter_ptr = NULL);   // Access using SBDebugger::GetCommandInterpreter();
103
104
105    lldb_private::CommandInterpreter *m_opaque_ptr;
106};
107
108
109} // namespace lldb
110
111#endif // LLDB_SBCommandInterpreter_h_
112