Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef EPT_DEBTAGS_UTILS_H
00022 #define EPT_DEBTAGS_UTILS_H
00023
00024 #include <wibble/mixin.h>
00025 #include <ept/debtags/tag.h>
00026
00027 namespace ept {
00028 namespace debtags {
00029
00034 template<typename OUT>
00035 class TagToFacet : public wibble::mixin::OutputIterator< TagToFacet<OUT> >
00036 {
00037 protected:
00038 OUT out;
00039
00040 public:
00041 TagToFacet(const OUT& out) : out(out) {}
00042
00043 template<typename ITEMS, typename TAGS>
00044 TagToFacet<OUT>& operator=(const std::pair<ITEMS, TAGS>& data)
00045 {
00046 std::set< Facet > facets;
00047 for (typename TAGS::const_iterator i = data.second.begin();
00048 i != data.second.end(); ++i)
00049 facets.insert(i->facet());
00050 *out = make_pair(data.first, facets);
00051 ++out;
00052 return *this;
00053 }
00054 };
00055
00056 template<typename OUT>
00057 static TagToFacet<OUT> tagToFacet(const OUT& out)
00058 {
00059 return TagToFacet<OUT>(out);
00060 }
00061
00062 }
00063 }
00064
00065
00066 #endif