1 //===-- CommandHistory.h ----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_CommandHistory_h_
11 #define liblldb_CommandHistory_h_
17 #include "lldb/Utility/Stream.h"
18 #include "lldb/lldb-private.h"
20 namespace lldb_private {
22 class CommandHistory {
28 size_t GetSize() const;
32 llvm::Optional<llvm::StringRef> FindString(llvm::StringRef input_str) const;
34 llvm::StringRef GetStringAtIndex(size_t idx) const;
36 llvm::StringRef operator[](size_t idx) const;
38 llvm::StringRef GetRecentmostString() const;
40 void AppendString(llvm::StringRef str, bool reject_if_dupe = true);
44 void Dump(Stream &stream, size_t start_idx = 0,
45 size_t stop_idx = SIZE_MAX) const;
47 static const char g_repeat_char = '!';
50 DISALLOW_COPY_AND_ASSIGN(CommandHistory);
52 typedef std::vector<std::string> History;
53 mutable std::recursive_mutex m_mutex;
57 } // namespace lldb_private
59 #endif // liblldb_CommandHistory_h_