libept  0.5.25
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ept::debtags::Tag Class Reference

Representation of a tag. More...

#include <tag.h>

Collaboration diagram for ept::debtags::Tag:
Collaboration graph
[legend]

Public Types

typedef std::set< TagSet
 

Public Member Functions

 Tag ()
 
 ~Tag ()
 
bool operator== (const Tag &f) const
 
bool operator!= (const Tag &f) const
 
bool operator< (const Tag &f) const
 
 operator bool () const
 
bool valid () const
 
Facet facet () const
 
std::string name () const
 Return the name of the tag, without the facet:: prefix. More...
 
std::string name (const std::string &d) const
 Return the short description of the tag. More...
 
std::string fullname () const
 Return the name of the tag, with the facet:: prefix. More...
 
std::string fullname (const std::string &d) const
 Return the short description of the tag. More...
 
std::string shortDescription () const
 Return the short description of the tag. More...
 
std::string shortDescription (const std::string &d) const
 Return the short description of the tag. More...
 
std::string longDescription () const
 Return the long description of the tag. More...
 
std::string longDescription (const std::string &d) const
 Return the long description of the tag. More...
 
int id () const
 Return the ID of this tag. More...
 

Protected Member Functions

 Tag (const Vocabulary *tags, int id)
 

Protected Attributes

const Vocabularym_tags
 
int m_id
 

Friends

class Vocabulary
 

Detailed Description

Representation of a tag.

ept::debtags::Tag represents a Tag with all its informations. It is guaranteed to have fast value-copy semantics, so it can be passed around freely and efficiently without worrying about memory management issues.

The class is normally instantiated using a Vocabulary:

Tag tag = vocabulary.tagByName("made-of::lang:c++");

Tags can contain an "invalid" value, in which case using any of their methods will likely produce segfault. The "invalid" facets are useful as "none" return values:

Tag tag = vocabulary.tagByName("made-of");
if (!tag)
throw SomeException("tag \"mytag\" has not been defined");

Member Typedef Documentation

typedef std::set< Tag > ept::debtags::Tag::Set

Constructor & Destructor Documentation

ept::debtags::Tag::Tag ( const Vocabulary tags,
int  id 
)
inlineprotected
ept::debtags::Tag::Tag ( )
inline
ept::debtags::Tag::~Tag ( )
inline

Member Function Documentation

Facet ept::debtags::Tag::facet ( ) const
std::string ept::debtags::Tag::fullname ( ) const
std::string ept::debtags::Tag::fullname ( const std::string &  d) const

Return the short description of the tag.

Returns d if the tag is not valid.

References ept::debtags::Facet::m_id, ept::debtags::Facet::m_tags, ept::debtags::Vocabulary::tagName(), and ept::debtags::Facet::valid().

int ept::debtags::Tag::id ( ) const
inline

Return the ID of this tag.

Warning
This method is exported to help in writing tests, but it is not part of the normal API: do not use it, because future implementations may not be based on IDs and therefore not have this method.

References ept::debtags::Facet::m_id.

Referenced by TestDebtags::_2(), ept::debtags::Debtags::getCardinality(), ept::debtags::Debtags::getItemsHavingTag(), ept::debtags::Debtags::hasTag(), ept::debtags::StringToInt< OUT >::operator=(), and ept::debtags::PatchStringToInt< OUT >::operator=().

std::string ept::debtags::Tag::longDescription ( ) const

Return the long description of the tag.

Exceptions
std::out_of_rangeif the tag is not valid

References ept::debtags::Facet::m_id, ept::debtags::Facet::m_tags, ept::debtags::Vocabulary::tagData(), and ept::debtags::Facet::valid().

Referenced by TestVocabulary::_15().

std::string ept::debtags::Tag::longDescription ( const std::string &  d) const

Return the long description of the tag.

Returns d if the tag is not valid.

References ept::debtags::Facet::m_id, ept::debtags::Facet::m_tags, ept::debtags::Vocabulary::tagData(), and ept::debtags::Facet::valid().

std::string ept::debtags::Tag::name ( ) const

Return the name of the tag, without the facet:: prefix.

Exceptions
std::out_of_rangeif the tag is not valid

References ept::debtags::Facet::m_id, ept::debtags::Facet::m_tags, ept::debtags::Vocabulary::tagShortName(), and ept::debtags::Facet::valid().

Referenced by TestVocabulary::_13(), TestVocabulary::_15(), and TestVocabulary::_6().

std::string ept::debtags::Tag::name ( const std::string &  d) const

Return the short description of the tag.

Returns d if the tag is not valid.

References ept::debtags::Facet::m_id, ept::debtags::Facet::m_tags, ept::debtags::Vocabulary::tagShortName(), and ept::debtags::Facet::valid().

ept::debtags::Tag::operator bool ( ) const
inline
bool ept::debtags::Tag::operator!= ( const Tag f) const
inline

References m_id.

bool ept::debtags::Tag::operator< ( const Tag f) const
inline

References m_id.

bool ept::debtags::Tag::operator== ( const Tag f) const
inline

References m_id.

std::string ept::debtags::Tag::shortDescription ( ) const

Return the short description of the tag.

Exceptions
std::out_of_rangeif the tag is not valid

References ept::debtags::Facet::m_id, ept::debtags::Facet::m_tags, ept::debtags::Vocabulary::tagData(), and ept::debtags::Facet::valid().

Referenced by TestVocabulary::_13(), and TestVocabulary::_15().

std::string ept::debtags::Tag::shortDescription ( const std::string &  d) const

Return the short description of the tag.

Returns d if the tag is not valid.

References ept::debtags::Facet::m_id, ept::debtags::Facet::m_tags, ept::debtags::Vocabulary::tagData(), and ept::debtags::Facet::valid().

bool ept::debtags::Tag::valid ( ) const
inline

Friends And Related Function Documentation

friend class Vocabulary
friend

Member Data Documentation

int ept::debtags::Tag::m_id
protected

Referenced by operator!=(), operator<(), and operator==().

const Vocabulary* ept::debtags::Tag::m_tags
protected

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