Public Member Functions | Protected Member Functions | Protected Attributes

ept::debtags::Vocabulary Class Reference

#include <vocabulary.h>

List of all members.

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::FacetDatafacetData (const std::string &name) const
 Return the facet with the given name.
const voc::TagDatatagData (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::FacetDataobtainFacet (const std::string &name)
voc::TagDataobtainTag (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

Constructor & Destructor Documentation

ept::debtags::Vocabulary::Vocabulary ( bool  empty = false  ) 

Instantiate the Debtags vocabulary.

Parameters:
empty false if the Debtags vocabulary should be loaded, true if it should start as an empty vocabulary

References ept::debtags::Path::debtagsSourceDir(), ept::debtags::Path::debtagsUserSourceDir(), m_timestamp, ept::debtags::SourceDir::readVocabularies(), and ept::debtags::SourceDir::vocTimestamp().

ept::debtags::Vocabulary::~Vocabulary (  ) 

Member Function Documentation

bool ept::debtags::Vocabulary::empty (  )  const [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.

References m_facets.

Referenced by hasTag(), tagData(), and tags().

std::set< std::string > ept::debtags::Vocabulary::facets (  )  const

Return all the facets in the vocabulary.

References m_facets.

Referenced by TestVocabulary::_21().

bool ept::debtags::Vocabulary::hasData (  )  const [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'.

References m_facets.

bool ept::debtags::Vocabulary::hasTag ( const std::string &  name  )  const

Check if the vocabulary contains the tag `fullname'.

References facetData(), ept::debtags::voc::getfacet(), and ept::debtags::voc::FacetData::hasTag().

voc::FacetData & ept::debtags::Vocabulary::obtainFacet ( const std::string &  name  )  [protected]

References m_facets.

Referenced by obtainTag(), and read().

voc::TagData & ept::debtags::Vocabulary::obtainTag ( const std::string &  fullname  )  [protected]
void ept::debtags::Vocabulary::parseVocBuf ( std::map< std::string, std::string > &  res,
size_t  ofs,
size_t  len 
) const [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, ept::debtags::DebDBParser::nextRecord(), obtainFacet(), and obtainTag().

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 facetData(), ept::debtags::voc::getfacet(), and ept::debtags::voc::FacetData::tagData().

Referenced by TestVocabulary::_13().

std::set< std::string > ept::debtags::Vocabulary::tags ( const std::string &  facet  )  const

Return the tags in the given facet.

References facetData(), and ept::debtags::voc::FacetData::tags().

std::set< std::string > ept::debtags::Vocabulary::tags (  )  const

Return all the tags in the vocabulary.

References m_facets.

Referenced by TestVocabulary::_21().

time_t ept::debtags::Vocabulary::timestamp (  )  const [inline]

Get the timestamp of when the index was last updated.

References m_timestamp.

void ept::debtags::Vocabulary::write ( FILE *  out  ) 

Write the vocabulary data to the given output stream.

References m_facets.

void ept::debtags::Vocabulary::write ( const std::string &  fname  ) 

Atomically write the vocabulary data to the given file.

References write().

void ept::debtags::Vocabulary::write (  ) 

Member Data Documentation

std::map<std::string, std::string> ept::debtags::Vocabulary::emptyData [protected]
std::map<std::string, voc::FacetData> ept::debtags::Vocabulary::m_facets [protected]

Referenced by hasData(), timestamp(), and Vocabulary().


The documentation for this class was generated from the following files: