25 virtual bool Jump(
const string& key);
31 TextDbData::const_iterator iter_;
43 const string& db_name,
44 const string& db_type,
62 RIME_DLL bool Fetch(
const string& key,
string* value)
override;
63 RIME_DLL bool Update(
const string& key,
const string& value)
override;
#define RIME_DLL
Definition rime_api.h:33
std::shared_ptr< T > an
Definition common.h:60
map< string, string > TextDbData
Definition text_db.h:17
function< bool(const string &key, const string &value, Tsv *row)> TsvFormatter
Definition tsv.h:18
function< bool(const Tsv &row, string *key, string *value)> TsvParser
Definition tsv.h:16
Db(const path &file_path, const string &name)
Definition db.cc:39
const path & file_path() const
Definition db.h:60
virtual bool Reset()
Definition text_db.cc:21
virtual bool GetNextRecord(string *key, string *value)
Definition text_db.cc:31
virtual bool Jump(const string &key)
Definition text_db.cc:26
TextDbAccessor(const TextDbData &data, const string &prefix)
Definition text_db.cc:14
virtual bool exhausted()
Definition text_db.cc:40
TsvParser parser
Definition text_db.h:35
string file_description
Definition text_db.h:37
TsvFormatter formatter
Definition text_db.h:36
RIME_DLL bool Erase(const string &key) override
Definition text_db.cc:92
RIME_DLL bool OpenReadOnly() override
Definition text_db.cc:123
RIME_DLL bool Restore(const path &snapshot_file) override
Definition text_db.cc:168
TextDbData metadata_
Definition text_db.h:73
bool SaveToFile(const path &file)
Definition text_db.cc:218
RIME_DLL bool Open() override
Definition text_db.cc:102
RIME_DLL an< DbAccessor > QueryAll() override
Definition text_db.cc:63
RIME_DLL bool Fetch(const string &key, string *value) override
Definition text_db.cc:73
TextDb(const path &file_path, const string &db_name, const string &db_type, TextFormat format)
Definition text_db.cc:46
RIME_DLL bool MetaUpdate(const string &key, const string &value) override
Definition text_db.cc:194
RIME_DLL bool Close() override
Definition text_db.cc:138
void Clear()
Definition text_db.cc:151
RIME_DLL an< DbAccessor > Query(const string &key) override
Definition text_db.cc:67
RIME_DLL bool CreateMetadata() override
Definition text_db.cc:180
RIME_DLL bool MetaFetch(const string &key, string *value) override
Definition text_db.cc:184
string db_type_
Definition text_db.h:71
bool modified_
Definition text_db.h:75
TextFormat format_
Definition text_db.h:72
RIME_DLL an< DbAccessor > QueryMetadata() override
Definition text_db.cc:57
RIME_DLL bool Update(const string &key, const string &value) override
Definition text_db.cc:83
TextDbData data_
Definition text_db.h:74
RIME_DLL bool Backup(const path &snapshot_file) override
Definition text_db.cc:156
bool LoadFromFile(const path &file)
Definition text_db.cc:203