ept::debtags::Tag Class Reference

#include <tag.h>

Collaboration diagram for ept::debtags::Tag:

Collaboration graph
[legend]

List of all members.


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");

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.
std::string name (const std::string &d) const
 Return the short description of the tag.
std::string fullname () const
 Return the name of the tag, with the facet:: prefix.
std::string fullname (const std::string &d) const
 Return the short description of the tag.
std::string shortDescription () const
 Return the short description of the tag.
std::string shortDescription (const std::string &d) const
 Return the short description of the tag.
std::string longDescription () const
 Return the long description of the tag.
std::string longDescription (const std::string &d) const
 Return the long description of the tag.
int id () const
 Return the ID of this tag.

Protected Member Functions

 Tag (const Vocabulary *tags, int id)

Protected Attributes

const Vocabularym_tags
int m_id

Friends

class Vocabulary

Member Typedef Documentation

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


Constructor & Destructor Documentation

ept::debtags::Tag::Tag ( const Vocabulary tags,
int  id 
) [inline, protected]

ept::debtags::Tag::Tag (  )  [inline]

ept::debtags::Tag::~Tag (  )  [inline]


Member Function Documentation

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.

ept::debtags::Tag::operator bool (  )  const [inline]

References m_id.

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

Facet ept::debtags::Tag::facet (  )  const

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

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

Exceptions:
std::out_of_range if the tag is not valid

References m_id, m_tags, ept::debtags::Vocabulary::tagShortName(), and 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 m_id, m_tags, ept::debtags::Vocabulary::tagShortName(), and valid().

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

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

Exceptions:
std::out_of_range if the tag is not valid

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

Referenced by TestVocabulary::_13(), TestVocabulary::_15(), TestDebtags::_2(), TestVocabulary::_6(), and ept::debtags::PatchIntToString< OUT >::operator=().

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 m_id, m_tags, ept::debtags::Vocabulary::tagName(), and valid().

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

Return the short description of the tag.

Exceptions:
std::out_of_range if the tag is not valid

References m_id, m_tags, ept::debtags::Vocabulary::tagData(), and 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 m_id, m_tags, ept::debtags::Vocabulary::tagData(), and valid().

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

Return the long description of the tag.

Exceptions:
std::out_of_range if the tag is not valid

References m_id, m_tags, ept::debtags::Vocabulary::tagData(), and 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 m_id, m_tags, ept::debtags::Vocabulary::tagData(), and 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 m_id.

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


Friends And Related Function Documentation

friend class Vocabulary [friend]


Member Data Documentation

int ept::debtags::Tag::m_id [protected]


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

Generated on Sat Jul 26 13:20:08 2008 for libept by  doxygen 1.5.6