]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandHistory.h
Update to ELF Tool Chain r3475
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Interpreter / CommandHistory.h
1 //===-- CommandHistory.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_CommandHistory_h_
11 #define liblldb_CommandHistory_h_
12
13 // C Includes
14 // C++ Includes
15 #include <string>
16 #include <vector>
17
18 // Other libraries and framework includes
19 // Project includes
20 #include "lldb/lldb-private.h"
21 #include "lldb/Core/Stream.h"
22 #include "lldb/Host/Mutex.h"
23
24 namespace lldb_private {
25     
26 class CommandHistory
27 {
28 public:
29     CommandHistory ();
30     
31     ~CommandHistory ();
32     
33     size_t
34     GetSize () const;
35     
36     bool
37     IsEmpty () const;
38     
39     const char*
40     FindString (const char* input_str) const;
41     
42     const char*
43     GetStringAtIndex (size_t idx) const;
44     
45     const char*
46     operator [] (size_t idx) const;
47     
48     const char*
49     GetRecentmostString () const;
50     
51     void
52     AppendString (const std::string& str,
53                   bool reject_if_dupe = true);
54     
55     void
56     Clear ();
57
58     void
59     Dump (Stream& stream,
60           size_t start_idx = 0,
61           size_t stop_idx = SIZE_MAX) const;
62     
63     static const char g_repeat_char = '!';
64     
65 private:
66     DISALLOW_COPY_AND_ASSIGN(CommandHistory);
67     
68     typedef std::vector<std::string> History;
69     mutable Mutex m_mutex;
70     History m_history;
71 };
72
73 } // namespace lldb_private
74
75 #endif  // liblldb_CommandHistory_h_