MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
Public 成员函数 | 静态 Public 成员函数 | Private 成员函数 | Private 属性 | 所有成员列表
common::MiniobLineReader类 参考

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 MiniobLineReaderinstance ()
 Get the singleton instance 更多...
 

Private 成员函数

 MiniobLineReader (const MiniobLineReader &)=delete
 
MiniobLineReaderoperator= (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。

成员函数说明

◆ check_and_save_history()

bool common::MiniobLineReader::check_and_save_history ( )
private

Check if history should be auto-saved

返回
True if history should be saved due to time interval

◆ init()

void common::MiniobLineReader::init ( const std::string &  history_file)

Initialize the lineReader with history file

参数
history_filepath/to/file

◆ instance()

MiniobLineReader & common::MiniobLineReader::instance ( )
static

Get the singleton instance

返回
Reference to the singleton instance

◆ is_exit_command()

bool common::MiniobLineReader::is_exit_command ( const std::string &  cmd)

Check if the command is an exit command

参数
cmdThe input command
返回
True if the command is an exit command

◆ my_readline()

std::string common::MiniobLineReader::my_readline ( const std::string &  prompt)

Read a line from input

参数
promptThe prompt to display
返回
input string

该类的文档由以下文件生成: