#include <chert_synonym.h>


Public Member Functions | |
| ChertSynonymTable (const std::string &dbdir, bool readonly) | |
| Create a new ChertSynonymTable object. | |
| void | merge_changes () |
| void | discard_changes () |
| void | add_synonym (const std::string &term, const std::string &synonym) |
| Add a synonym for term. | |
| void | remove_synonym (const std::string &term, const std::string &synonym) |
| Remove a synonym for term. | |
| void | clear_synonyms (const std::string &term) |
| Remove all synonyms for term. | |
| TermList * | open_termlist (const std::string &term) |
| Open synonym termlist for a term. | |
| bool | is_modified () const |
| Override methods of ChertTable. | |
| void | flush_db () |
| Override methods of ChertTable. | |
| void | cancel () |
| Override methods of ChertTable. | |
Private Attributes | |
| std::string | last_term |
| The last term which was updated. | |
| std::set< std::string > | last_synonyms |
| The synonyms for the last term which was updated. | |
Definition at line 34 of file chert_synonym.h.
| ChertSynonymTable::ChertSynonymTable | ( | const std::string & | dbdir, | |
| bool | readonly | |||
| ) | [inline] |
Create a new ChertSynonymTable object.
This method does not create or open the table on disk - you must call the create() or open() methods respectively!
| dbdir | The directory the chert database is stored in. | |
| readonly | true if we're opening read-only, else false. |
Definition at line 50 of file chert_synonym.h.
| void ChertSynonymTable::add_synonym | ( | const std::string & | term, | |
| const std::string & | synonym | |||
| ) |
Add a synonym for term.
If the synonym has already been added, no action is taken.
Definition at line 66 of file chert_synonym.cc.
References ChertTable::get_exact_entry(), last_synonyms, last_term, MAGIC_XOR_VALUE, and merge_changes().
Referenced by ChertWritableDatabase::add_synonym().
| void ChertSynonymTable::cancel | ( | ) | [inline] |
Override methods of ChertTable.
NB: these aren't virtual, but we always call them on the subclass in cases where it matters.
Reimplemented from ChertTable.
Definition at line 103 of file chert_synonym.h.
References discard_changes().
Referenced by ChertDatabase::cancel().
| void ChertSynonymTable::clear_synonyms | ( | const std::string & | term | ) |
Remove all synonyms for term.
If term has no synonyms, no action is taken.
Definition at line 118 of file chert_synonym.cc.
References last_synonyms, last_term, and merge_changes().
Referenced by ChertWritableDatabase::clear_synonyms().
| void ChertSynonymTable::discard_changes | ( | ) | [inline] |
Definition at line 58 of file chert_synonym.h.
References last_synonyms, and last_term.
Referenced by cancel().
| void ChertSynonymTable::flush_db | ( | ) | [inline] |
Override methods of ChertTable.
NB: these aren't virtual, but we always call them on the subclass in cases where it matters.
Reimplemented from ChertTable.
Definition at line 98 of file chert_synonym.h.
References merge_changes().
Referenced by ChertDatabase::set_revision_number().
| bool ChertSynonymTable::is_modified | ( | ) | const [inline] |
Override methods of ChertTable.
NB: these aren't virtual, but we always call them on the subclass in cases where it matters.
Reimplemented from ChertTable.
Definition at line 94 of file chert_synonym.h.
References last_term.
Referenced by ChertDatabase::apply().
| void ChertSynonymTable::merge_changes | ( | ) |
Definition at line 43 of file chert_synonym.cc.
References ChertTable::add(), ChertTable::del(), last_synonyms, last_term, and MAGIC_XOR_VALUE.
Referenced by add_synonym(), clear_synonyms(), flush_db(), ChertWritableDatabase::open_synonym_keylist(), and remove_synonym().
| TermList * ChertSynonymTable::open_termlist | ( | const std::string & | term | ) |
Open synonym termlist for a term.
If term has no synonyms, NULL is returned.
Definition at line 134 of file chert_synonym.cc.
References ChertTable::get_exact_entry(), last_synonyms, last_term, and MAGIC_XOR_VALUE.
Referenced by ChertDatabase::open_synonym_termlist().
| void ChertSynonymTable::remove_synonym | ( | const std::string & | term, | |
| const std::string & | synonym | |||
| ) |
Remove a synonym for term.
If the synonym doesn't exist, no action is taken.
Definition at line 92 of file chert_synonym.cc.
References ChertTable::get_exact_entry(), last_synonyms, last_term, MAGIC_XOR_VALUE, and merge_changes().
Referenced by ChertWritableDatabase::remove_synonym().
std::set<std::string> ChertSynonymTable::last_synonyms [mutable, private] |
The synonyms for the last term which was updated.
Definition at line 39 of file chert_synonym.h.
Referenced by add_synonym(), clear_synonyms(), discard_changes(), merge_changes(), open_termlist(), and remove_synonym().
std::string ChertSynonymTable::last_term [mutable, private] |
The last term which was updated.
Definition at line 36 of file chert_synonym.h.
Referenced by add_synonym(), clear_synonyms(), discard_changes(), is_modified(), merge_changes(), open_termlist(), and remove_synonym().