#include <OpSet.h>
Public Member Functions | |
bool | contains (const T &item) const |
Return true if the tag set contains tag, else false. | |
bool | contains (const OpSet< T > &ts) const |
Return true if the tag set contains ts, else false. | |
int | distance (const OpSet< T > &ts) const |
Calculates the distance between two tagsets. | |
OpSet< T > | operator+ (const T &tag) const |
Singleton union. | |
OpSet< T > & | operator+= (const T &ts) |
Singleton union. | |
OpSet< T > | operator+ (const OpSet< T > &ts) const |
Set union. | |
OpSet< T > & | operator+= (const OpSet< T > &ts) |
Singleton union. | |
OpSet< T > | operator- (const T &tag) const |
Singleton difference. | |
OpSet< T > & | operator-= (const T &tag) |
Singleton difference. | |
OpSet< T > | operator- (const OpSet< T > &ts) const |
Set difference. | |
OpSet< T > & | operator-= (const OpSet< T > &ts) |
Set difference. | |
OpSet< T > | operator^ (const OpSet< T > &ts) const |
Set intersection. | |
OpSet< T > & | operator^= (const OpSet< T > &ts) |
Set intersection. |
The reason for not using a plain std::set is that the libtagcoll code involves a lot of set operations, and overridden operators greatly help in having cleaner code.
Example:
OpSet<string> myfavs; OpSet<string> yourfavs; myfavourite += "pear"; myfavourite += "banana"; yourfavourite += "apple"; yourfavourite += "pear"; OpSet<string> ourfavs = myfavs ^ yourfavs; OpSet<string> interesting = myfavs + yourfavs; OpSet<string> myonlyfavs = myfavs - yourfavs; for (OpSet<string>::const_iterator i = ourfavs.begin(); i != ourfavs.end(); i++) cout << *i << endl;
|
Return true if the tag set contains ts, else false.
|
|
Return true if the tag set contains tag, else false.
|
|
Calculates the distance between two tagsets.
The distance between A and B is defined by infinity if the intersection between A und B is empty, else it is
|
|
Set union.
|
|
Singleton union.
|
|
Singleton union.
|
|
Singleton union.
|
|
Set difference.
|
|
Singleton difference.
|
|
Set difference.
|
|
Singleton difference.
|
|
Set intersection.
|
|
Set intersection.
|