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

Representation of a facet. More...

#include <tag.h>

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

Public Member Functions

 Facet ()
 
 ~Facet ()
 
bool operator== (const Facet &f) const
 
bool operator!= (const Facet &f) const
 
bool operator< (const Facet &f) const
 
 operator bool () const
 Return true if the facet is valid. More...
 
bool valid () const
 
std::string name () const
 Return the name of the facet. More...
 
std::string name (const std::string &d) const
 Return the name of the facet. More...
 
std::string shortDescription () const
 Return the short description of the facet. More...
 
std::string shortDescription (const std::string &d) const
 Return the short description of the facet. More...
 
std::string longDescription () const
 Return the long description of the facet. More...
 
std::string longDescription (const std::string &d) const
 Return the long description of the facet. More...
 
bool hasTag (const std::string &name) const
 Return true if the facet has a tag with the given name (name, not fullname) More...
 
std::set< Tagtags () const
 Return the list of tags in this facet. More...
 
int id () const
 Return the ID of this facet. More...
 

Protected Member Functions

 Facet (const Vocabulary *tags, int id)
 

Protected Attributes

const Vocabularym_tags
 
int m_id
 

Friends

class Vocabulary
 

Detailed Description

Representation of a facet.

ept::debtags::Facet represents a Facet 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:

Facet facet = vocabulary.faceByName("made-of");

Facets 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:

Facet facet = vocabulary.facetByName("made-of");
if (!facet)
throw SomeException("facet \"made-of\" has not been defined");

Constructor & Destructor Documentation

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

Member Function Documentation

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

Return true if the facet has a tag with the given name (name, not fullname)

References ept::debtags::Vocabulary::hasTag(), m_tags, name(), and valid().

Referenced by valid().

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

Return the ID of this facet.

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 m_id.

Referenced by ept::debtags::Vocabulary::tags().

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

Return the long description of the facet.

Exceptions
std::out_of_rangeif the facet is not valid

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

Referenced by TestVocabulary::_14(), TestVocabulary::_9(), valid(), and ept::debtags::Tag::valid().

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

Return the long description of the facet.

Returns d if the facet is not valid.

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

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

Return the name of the facet.

Exceptions
std::out_of_rangeif the facet is not valid

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

Referenced by TestVocabulary::_14(), TestVocabulary::_6(), hasTag(), valid(), and ept::debtags::Tag::valid().

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

Return the name of the facet.

Returns d if the facet is not valid.

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

ept::debtags::Facet::operator bool ( ) const
inline

Return true if the facet is valid.

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

References m_id.

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

References m_id.

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

References m_id.

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

Return the short description of the facet.

Exceptions
std::out_of_rangeif the facet is not valid

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

Referenced by TestVocabulary::_14(), TestVocabulary::_9(), valid(), and ept::debtags::Tag::valid().

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

Return the short description of the facet.

Returns d if the facet is not valid.

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

std::set< Tag > ept::debtags::Facet::tags ( ) const

Return the list of tags in this facet.

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

Referenced by TestVocabulary::_14(), TestVocabulary::_7(), TestVocabulary::_8(), and valid().

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

Friends And Related Function Documentation

friend class Vocabulary
friend

Member Data Documentation

int ept::debtags::Facet::m_id
protected
const Vocabulary* ept::debtags::Facet::m_tags
protected

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