MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
|
Public 成员函数 | |
Ini () | |
int | load (const string &ini_file) |
const map< string, string > & | get (const string §ion=DEFAULT_SECTION) |
string | get (const string &key, const string &default_value, const string §ion=DEFAULT_SECTION) |
int | put (const string &key, const string &value, const string §ion=DEFAULT_SECTION) |
void | to_string (string &output_str) |
Protected 类型 | |
typedef map< string, map< string, string > > | SessionsMap |
Protected 成员函数 | |
void | insert_session (const string &session_name) |
map< string, string > * | switch_session (const string &session_name) |
int | insert_entry (map< string, string > *session_map, const string &line) |
Private 属性 | |
set< string > | file_names_ |
SessionsMap | sections_ |
静态 Private 属性 | |
static const map< string, string > | empty_map_ |
common::Ini::Ini | ( | ) |
To simplify the logic, no lock's when loading configuration So don't modify the data parallel
string common::Ini::get | ( | const string & | key, |
const string & | default_value, | ||
const string & | section = DEFAULT_SECTION |
||
) |
get the value of the key in the section, if the key-value doesn't exist, use the input default_value
const map< string, string > & common::Ini::get | ( | const string & | section = DEFAULT_SECTION | ) |
get the map of the section if the section doesn't exist, return one empty section
|
protected |
insert one entry to session_map line's format is "key=value"
|
protected |
insert one empty session to sections_
int common::Ini::load | ( | const string & | ini_file | ) |
load one ini configuration it support load multiple ini configuration files
int common::Ini::put | ( | const string & | key, |
const string & | value, | ||
const string & | section = DEFAULT_SECTION |
||
) |
put the key-value pair to the section if the key-value already exist, just replace it if the section doesn't exist, it will create this section
|
protected |
switch session according to the session_name if the section doesn't exist, it will create one
void common::Ini::to_string | ( | string & | output_str | ) |
output all configuration to one string