|
|
@ -32,6 +32,7 @@ distribution.
|
|
|
|
#include <assert.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <iostream>
|
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
namespace tthread
|
|
|
|
namespace tthread
|
|
|
|
{
|
|
|
|
{
|
|
|
|
class mutex;
|
|
|
|
class mutex;
|
|
|
@ -44,7 +45,7 @@ namespace DFHack
|
|
|
|
class CommandHistory
|
|
|
|
class CommandHistory
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
CommandHistory(std::size_t capacity = 100)
|
|
|
|
CommandHistory(std::size_t capacity = 5000)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this->capacity = capacity;
|
|
|
|
this->capacity = capacity;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -114,6 +115,12 @@ namespace DFHack
|
|
|
|
{
|
|
|
|
{
|
|
|
|
history.pop_front();
|
|
|
|
history.pop_front();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// adds the current list of entries to the given vector
|
|
|
|
|
|
|
|
void getEntries(std::vector<std::string> &entries)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for (auto &entry : history)
|
|
|
|
|
|
|
|
entries.push_back(entry);
|
|
|
|
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
std::size_t capacity;
|
|
|
|
std::size_t capacity;
|
|
|
|
std::deque <std::string> history;
|
|
|
|
std::deque <std::string> history;
|
|
|
|