File indexing completed on 2026-05-10 08:42:49
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLDB_INTERPRETER_COMMANDHISTORY_H
0010 #define LLDB_INTERPRETER_COMMANDHISTORY_H
0011
0012 #include <mutex>
0013 #include <optional>
0014 #include <string>
0015 #include <vector>
0016
0017 #include "lldb/Utility/Stream.h"
0018 #include "lldb/lldb-private.h"
0019
0020 namespace lldb_private {
0021
0022 class CommandHistory {
0023 public:
0024 CommandHistory() = default;
0025
0026 ~CommandHistory() = default;
0027
0028 size_t GetSize() const;
0029
0030 bool IsEmpty() const;
0031
0032 std::optional<llvm::StringRef> FindString(llvm::StringRef input_str) const;
0033
0034 llvm::StringRef GetStringAtIndex(size_t idx) const;
0035
0036 llvm::StringRef operator[](size_t idx) const;
0037
0038 llvm::StringRef GetRecentmostString() const;
0039
0040 void AppendString(llvm::StringRef str, bool reject_if_dupe = true);
0041
0042 void Clear();
0043
0044 void Dump(Stream &stream, size_t start_idx = 0,
0045 size_t stop_idx = SIZE_MAX) const;
0046
0047 static const char g_repeat_char = '!';
0048
0049 private:
0050 CommandHistory(const CommandHistory &) = delete;
0051 const CommandHistory &operator=(const CommandHistory &) = delete;
0052
0053 typedef std::vector<std::string> History;
0054 mutable std::recursive_mutex m_mutex;
0055 History m_history;
0056 };
0057
0058 }
0059
0060 #endif