libept
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ept::debtags::Debtags Class Reference

Access the on-disk Debtags tag database. More...

#include <debtags.h>

Inheritance diagram for ept::debtags::Debtags:
ept::debtags::coll::Fast

Public Types

typedef ept::debtags::coll::Fast coll_type
 
typedef std::pair< std::string, std::set< std::string > > value_type
 
- Public Types inherited from ept::debtags::coll::Fast
typedef std::map< std::string, std::set< std::string > >::const_iterator const_iterator
 
typedef std::map< std::string, std::set< std::string > >::iterator iterator
 
typedef std::map< std::string, std::set< std::string > >::value_type value_type
 
typedef std::map< std::string, std::set< std::string > >::const_iterator const_tag_iterator
 
typedef std::map< std::string, std::set< std::string > >::iterator tag_iterator
 

Public Member Functions

 Debtags ()
 Create a Debtags object, reading the system database. More...
 
 Debtags (const std::string &pathname)
 Create a Debtags object, reading the given database file. More...
 
 ~Debtags ()
 
time_t timestamp () const
 Get the timestamp of when the index was last updated. More...
 
bool hasData () const
 Return true if this data source has data, false if it's empty. More...
 
coll_typetagdb ()
 
const coll_typetagdb () const
 
- Public Member Functions inherited from ept::debtags::coll::Fast
const_iterator begin () const
 
const_iterator end () const
 
iterator begin ()
 
iterator end ()
 
const_tag_iterator tagBegin () const
 
const_tag_iterator tagEnd () const
 
tag_iterator tagBegin ()
 
tag_iterator tagEnd ()
 
void insert (const std::string &item, const std::set< std::string > &tags)
 
void insert (const std::set< std::string > &items, const std::string &tag)
 
void insert (const std::set< std::string > &items, const std::set< std::string > &tags)
 
void clear ()
 
std::set< std::string > getTagsOfItem (const std::string &item) const
 
std::set< std::string > getItemsHavingTag (const std::string &tag) const
 
std::set< std::string > getItemsHavingTags (const std::set< std::string > &tags) const
 Get the items which are tagged with at least the tags `tags'. More...
 
bool empty () const
 
bool hasItem (const std::string &item) const
 
bool hasTag (const std::string &tag) const
 
std::set< std::string > getTaggedItems () const
 
std::set< std::string > getAllTags () const
 
std::vector< std::string > getAllTagsAsVector () const
 
unsigned int itemCount () const
 
unsigned int tagCount () const
 
std::set< std::string > getTagsImplying (const std::string &tag) const
 
std::set< std::string > getItemsExactMatch (const std::set< std::string > &tags) const
 
std::string findTagWithMaxCardinality (size_t &card) const
 
Fast getChildCollection (const std::string &tag) const
 Return the collection with only those items that have this tag, but with the given tag removed. More...
 
void removeTag (const std::string &tag)
 
void removeTagsWithCardinalityLessThan (size_t card)
 

Static Public Member Functions

static std::string pathname ()
 Return the default pathname for the debtags tags. More...
 

Protected Member Functions

void load (const std::string &pathname)
 

Protected Attributes

std::string rcdir
 
time_t m_timestamp
 
- Protected Attributes inherited from ept::debtags::coll::Fast
std::map< std::string, std::set< std::string > > items
 
std::map< std::string, std::set< std::string > > tags
 

Detailed Description

Access the on-disk Debtags tag database.

The database is normally found in /var/lib/debtags.

Tags and Facets are returned as std::strings. The objects follow the flyweight pattern and access the data contained in the Vocabulary instantiated inside Debtags.

It is possible to get a reference to the Vocabulary object using the vocabulary() method.

Member Typedef Documentation

◆ coll_type

◆ value_type

typedef std::pair< std::string, std::set<std::string> > ept::debtags::Debtags::value_type

Constructor & Destructor Documentation

◆ Debtags() [1/2]

ept::debtags::Debtags::Debtags ( )

Create a Debtags object, reading the system database.

References ept::sys::exists(), load(), and pathname().

◆ Debtags() [2/2]

ept::debtags::Debtags::Debtags ( const std::string &  pathname)

Create a Debtags object, reading the given database file.

References load().

◆ ~Debtags()

ept::debtags::Debtags::~Debtags ( )
inline

Member Function Documentation

◆ hasData()

bool ept::debtags::Debtags::hasData ( ) const
inline

Return true if this data source has data, false if it's empty.

◆ load()

void ept::debtags::Debtags::load ( const std::string &  pathname)
protected

◆ pathname()

string ept::debtags::Debtags::pathname ( )
static

Return the default pathname for the debtags tags.

This returns /var/lib/debtags/package-tags, unless it has been overridden by setting $DEBTAGS_TAGS

References res.

Referenced by Debtags(), and tagdb().

◆ tagdb() [1/2]

coll_type& ept::debtags::Debtags::tagdb ( )
inline

◆ tagdb() [2/2]

const coll_type& ept::debtags::Debtags::tagdb ( ) const
inline

References pathname().

◆ timestamp()

time_t ept::debtags::Debtags::timestamp ( ) const
inline

Get the timestamp of when the index was last updated.

References m_timestamp.

Member Data Documentation

◆ m_timestamp

time_t ept::debtags::Debtags::m_timestamp
protected

Referenced by load(), and timestamp().

◆ rcdir

std::string ept::debtags::Debtags::rcdir
protected

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