libept
|
#include <vocabulary.h>
Public Member Functions | |
Vocabulary (bool empty=false) | |
Instantiate the Debtags vocabulary. | |
~Vocabulary () | |
time_t | timestamp () const |
Get the timestamp of when the index was last updated. | |
bool | hasData () const |
Return true if this data source has data, false if it's empty. | |
bool | empty () const |
Check if there is any data in the merged vocabulary. | |
bool | hasFacet (const std::string &name) const |
Check if the vocabulary contains the facet `name'. | |
bool | hasTag (const std::string &name) const |
Check if the vocabulary contains the tag `fullname'. | |
const voc::FacetData * | facetData (const std::string &name) const |
Return the facet with the given name. | |
const voc::TagData * | tagData (const std::string &fullname) const |
Return the tag with the given full name. | |
std::set< std::string > | facets () const |
Return all the facets in the vocabulary. | |
std::set< std::string > | tags () const |
Return all the tags in the vocabulary. | |
std::set< std::string > | tags (const std::string &facet) const |
Return the tags in the given facet. | |
void | read (tagcoll::input::Input &input) |
Parse and import the vocabulary from `input', merging the data with the previously imported ones. | |
void | write () |
Atomically update the system vocabulary. | |
void | write (const std::string &fname) |
Atomically write the vocabulary data to the given file. | |
void | write (FILE *out) |
Write the vocabulary data to the given output stream. |
Protected Member Functions | |
void | parseVocBuf (std::map< std::string, std::string > &res, size_t ofs, size_t len) const |
voc::FacetData & | obtainFacet (const std::string &name) |
voc::TagData & | obtainTag (const std::string &fullname) |
Protected Attributes | |
std::map< std::string, voc::FacetData > | m_facets |
time_t | m_timestamp |
std::map< std::string, std::string > | emptyData |
ept::debtags::Vocabulary::Vocabulary | ( | bool | empty = false | ) |
Instantiate the Debtags vocabulary.
empty | false if the Debtags vocabulary should be loaded, true if it should start as an empty vocabulary |
References ept::debtags::SourceDir::readVocabularies(), and ept::debtags::SourceDir::vocTimestamp().
ept::debtags::Vocabulary::~Vocabulary | ( | ) |
|
inline |
Check if there is any data in the merged vocabulary.
References m_facets.
const voc::FacetData * ept::debtags::Vocabulary::facetData | ( | const std::string & | name | ) | const |
Return the facet with the given name.
std::set< std::string > ept::debtags::Vocabulary::facets | ( | ) | const |
Return all the facets in the vocabulary.
Referenced by TestVocabulary::_21().
|
inline |
Return true if this data source has data, false if it's empty.
References m_timestamp.
Referenced by TestVocabulary::_21().
bool ept::debtags::Vocabulary::hasFacet | ( | const std::string & | name | ) | const |
Check if the vocabulary contains the facet `name'.
bool ept::debtags::Vocabulary::hasTag | ( | const std::string & | name | ) | const |
Check if the vocabulary contains the tag `fullname'.
References ept::debtags::voc::getfacet(), and ept::debtags::voc::FacetData::hasTag().
|
protected |
References ept::debtags::voc::Data::name.
|
protected |
References ept::debtags::voc::getfacet().
|
protected |
void ept::debtags::Vocabulary::read | ( | tagcoll::input::Input & | input | ) |
Parse and import the vocabulary from `input', merging the data with the previously imported ones.
References ept::debtags::voc::Data::name, and ept::debtags::DebDBParser::nextRecord().
Referenced by ept::debtags::SourceDir::readVocabularies().
const voc::TagData * ept::debtags::Vocabulary::tagData | ( | const std::string & | fullname | ) | const |
Return the tag with the given full name.
References ept::debtags::voc::getfacet(), and ept::debtags::voc::FacetData::tagData().
Referenced by TestVocabulary::_13().
std::set< std::string > ept::debtags::Vocabulary::tags | ( | ) | const |
Return all the tags in the vocabulary.
Referenced by TestVocabulary::_21().
std::set< std::string > ept::debtags::Vocabulary::tags | ( | const std::string & | facet | ) | const |
Return the tags in the given facet.
References ept::debtags::voc::FacetData::tags().
|
inline |
Get the timestamp of when the index was last updated.
References m_timestamp.
void ept::debtags::Vocabulary::write | ( | ) |
Atomically update the system vocabulary.
References ept::debtags::SourceDir::vocTimestamp().
void ept::debtags::Vocabulary::write | ( | const std::string & | fname | ) |
Atomically write the vocabulary data to the given file.
void ept::debtags::Vocabulary::write | ( | FILE * | out | ) |
Write the vocabulary data to the given output stream.
|
protected |
|
protected |
Referenced by empty().
|
protected |
Referenced by hasData(), and timestamp().