30 #include <tqvaluelist.h>
34 class Tag::TagPrivate : public Shared
42 TQValueList<TagSet*> tagSets;
43 bool operator==( const TagPrivate& other) const
45 return id == other.id;
49 Tag::Tag() : d(new TagPrivate)
52 Tag::Tag( const TQString& id, const TQString& name, const TQString& scheme) : d(new TagPrivate)
55 d->name = name.isNull() ? id : name;
60 Tag Tag::fromCategory( const TQString& term, const TQString& scheme, const TQString& name)
62 Tag tag(scheme + "/" + term, name, scheme);
67 Tag::Tag( const Tag& other) : d(0)
81 Tag& Tag::operator=( const Tag& other)
94 bool Tag::operator==( const Tag& other) const
96 return *(other.d) == *d;
99 bool Tag::operator<( const Tag& other) const
101 return (name() < other.name()) || (name() == other.name() && id() < other.id());
104 bool Tag::isNull() const
106 return d->id.isNull();
109 TQString Tag::name() const
114 TQString Tag::scheme() const
119 TQString Tag::icon() const
124 void Tag::setIcon( const TQString& icon)
129 for (TQValueList<TagSet*>::ConstIterator it = d->tagSets.begin(); it != d->tagSets.end(); ++it)
130 (*it)->tagUpdated(* this);
135 void Tag::setName( const TQString& name)
140 for (TQValueList<TagSet*>::ConstIterator it = d->tagSets.begin(); it != d->tagSets.end(); ++it)
141 (*it)->tagUpdated(* this);
145 void Tag::addedToTagSet(TagSet* tagSet) const
147 d->tagSets.append(tagSet);
150 void Tag::removedFromTagSet(TagSet* tagSet) const
152 d->tagSets.remove(tagSet);
155 TQString Tag::id() const
|