MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
|
A singleton class for line-reading, providing an interface to replxx。 更多...
#include <line_reader.h>
Public 成员函数 | |
void | init (const std::string &history_file) |
Initialize the lineReader with history file 更多... | |
std::string | my_readline (const std::string &prompt) |
Read a line from input 更多... | |
bool | is_exit_command (const std::string &cmd) |
Check if the command is an exit command 更多... | |
静态 Public 成员函数 | |
static MiniobLineReader & | instance () |
Get the singleton instance 更多... | |
Private 成员函数 | |
MiniobLineReader (const MiniobLineReader &)=delete | |
MiniobLineReader & | operator= (const MiniobLineReader &)=delete |
bool | check_and_save_history () |
Check if history should be auto-saved 更多... | |
Private 属性 | |
replxx::Replxx | reader_ |
std::string | history_file_ |
time_t | previous_history_save_time_ |
int | history_save_interval_ |
A singleton class for line-reading, providing an interface to replxx。
|
private |
Check if history should be auto-saved
void common::MiniobLineReader::init | ( | const std::string & | history_file | ) |
Initialize the lineReader with history file
history_file | path/to/file |
|
static |
Get the singleton instance
bool common::MiniobLineReader::is_exit_command | ( | const std::string & | cmd | ) |
Check if the command is an exit command
cmd | The input command |
std::string common::MiniobLineReader::my_readline | ( | const std::string & | prompt | ) |
Read a line from input
prompt | The prompt to display |