#include <OpSet.h>
Public Member Functions | |
| OpSet () | |
| template<typename A, typename B> | |
| OpSet (A a, B b) | |
| 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;
| Tagcoll::OpSet< T >::OpSet | ( | ) | [inline] |
| bool Tagcoll::OpSet< T >::contains | ( | const T & | item | ) | const [inline] |
Return true if the tag set contains tag, else false.
| bool OpSet::contains | ( | const OpSet< T > & | ts | ) | const |
Return true if the tag set contains ts, else false.
| int OpSet::distance | ( | const OpSet< T > & | ts | ) | const |
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
| OpSet< T > OpSet::operator+ | ( | const T & | tag | ) | const |
Singleton union.
| OpSet< T > & OpSet::operator+= | ( | const T & | ts | ) |
Singleton union.
Set union.
Singleton union.
| OpSet< T > OpSet::operator- | ( | const T & | tag | ) | const |
Singleton difference.
| OpSet< T > & OpSet::operator-= | ( | const T & | tag | ) |
Singleton difference.
Set difference.
Set difference.
Set intersection.
Set intersection.
1.5.1