#include <brass_synonym.h>


Public Member Functions | |
| BrassSynonymTable (const std::string &dbdir, bool readonly) | |
| Create a new BrassSynonymTable 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 BrassTable. | |
| void | flush_db () |
| Override methods of BrassTable. | |
| void | cancel () |
| Override methods of BrassTable. | |
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 brass_synonym.h.
| BrassSynonymTable::BrassSynonymTable | ( | const std::string & | dbdir, | |
| bool | readonly | |||
| ) | [inline] |
Create a new BrassSynonymTable 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 brass database is stored in. | |
| readonly | true if we're opening read-only, else false. |
Definition at line 50 of file brass_synonym.h.
| void BrassSynonymTable::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 brass_synonym.cc.
References BrassTable::get_exact_entry(), last_synonyms, last_term, MAGIC_XOR_VALUE, and merge_changes().
Referenced by BrassWritableDatabase::add_synonym().
| void BrassSynonymTable::cancel | ( | ) | [inline] |
Override methods of BrassTable.
NB: these aren't virtual, but we always call them on the subclass in cases where it matters.
Reimplemented from BrassTable.
Definition at line 103 of file brass_synonym.h.
References discard_changes().
Referenced by BrassDatabase::cancel().
| void BrassSynonymTable::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 brass_synonym.cc.
References last_synonyms, last_term, and merge_changes().
Referenced by BrassWritableDatabase::clear_synonyms().
| void BrassSynonymTable::discard_changes | ( | ) | [inline] |
Definition at line 58 of file brass_synonym.h.
References last_synonyms, and last_term.
Referenced by cancel().
| void BrassSynonymTable::flush_db | ( | ) | [inline] |
Override methods of BrassTable.
NB: these aren't virtual, but we always call them on the subclass in cases where it matters.
Reimplemented from BrassTable.
Definition at line 98 of file brass_synonym.h.
References merge_changes().
Referenced by BrassDatabase::set_revision_number().
| bool BrassSynonymTable::is_modified | ( | ) | const [inline] |
Override methods of BrassTable.
NB: these aren't virtual, but we always call them on the subclass in cases where it matters.
Reimplemented from BrassTable.
Definition at line 94 of file brass_synonym.h.
References last_term.
Referenced by BrassDatabase::apply().
| void BrassSynonymTable::merge_changes | ( | ) |
Definition at line 43 of file brass_synonym.cc.
References BrassTable::add(), BrassTable::del(), last_synonyms, last_term, and MAGIC_XOR_VALUE.
Referenced by add_synonym(), clear_synonyms(), flush_db(), BrassWritableDatabase::open_synonym_keylist(), and remove_synonym().
| TermList * BrassSynonymTable::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 brass_synonym.cc.
References BrassTable::get_exact_entry(), last_synonyms, last_term, and MAGIC_XOR_VALUE.
Referenced by BrassDatabase::open_synonym_termlist().
| void BrassSynonymTable::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 brass_synonym.cc.
References BrassTable::get_exact_entry(), last_synonyms, last_term, MAGIC_XOR_VALUE, and merge_changes().
Referenced by BrassWritableDatabase::remove_synonym().
std::set<std::string> BrassSynonymTable::last_synonyms [mutable, private] |
The synonyms for the last term which was updated.
Definition at line 39 of file brass_synonym.h.
Referenced by add_synonym(), clear_synonyms(), discard_changes(), merge_changes(), open_termlist(), and remove_synonym().
std::string BrassSynonymTable::last_term [mutable, private] |
The last term which was updated.
Definition at line 36 of file brass_synonym.h.
Referenced by add_synonym(), clear_synonyms(), discard_changes(), is_modified(), merge_changes(), open_termlist(), and remove_synonym().