7
7
#define APTFRONT_CACHE_COMPONENT_DEBTAGS_SERIALIZER_H
9
9
#include <apt-front/forward.h>
10
#include <apt-front/cache/cache.h>
10
#include <apt-front/cache/component/base.h>
11
11
#include <tagcoll/Serializer.h>
17
* Convert Packages to strings
20
class Converter<aptFront::cache::entity::Package, std::string>
23
std::string operator()(const aptFront::cache::entity::Package& item);
24
OpSet<std::string> operator()(const OpSet<aptFront::cache::entity::Package>& items);
28
* Convert strings to Packages
31
class Converter<std::string, aptFront::cache::entity::Package>
34
aptFront::cache::Cache* cache;
36
Converter(aptFront::cache::Cache* cache = 0) : cache(cache) {}
38
void setOwnerCache( aptFront::cache::Cache *c ) { cache = c; }
40
aptFront::cache::entity::Package operator()(const std::string& item);
41
OpSet<aptFront::cache::entity::Package> operator()(const OpSet<std::string>& items);
19
* Convert Facets to ints
21
class FacetIntConverter : public Implementation<FacetIntConverter>,
22
public Tagcoll::Converter<aptFront::cache::entity::Facet, int>,
23
public Tagcoll::Converter<int, aptFront::cache::entity::Facet>
25
typedef aptFront::cache::entity::Facet Facet;
26
typedef Tagcoll::OpSet<aptFront::cache::entity::Facet> FacetSet;
27
typedef Tagcoll::OpSet<int> IntSet;
29
virtual int operator()(const aptFront::cache::entity::Facet& item) const;
30
virtual aptFront::cache::entity::Facet operator()(const int& item) const;
32
virtual IntSet operator()(const FacetSet& item) const
33
{ return Tagcoll::Converter<Facet, int>::operator()(item); }
34
virtual FacetSet operator()(const IntSet& item) const
35
{ return Tagcoll::Converter<int, Facet>::operator()(item); }
37
static std::string componentName();
45
41
* Convert Facets to strings
48
class Converter<aptFront::cache::entity::Facet, std::string>
43
class FacetStringConverter : public Implementation<FacetStringConverter>,
44
public Tagcoll::Converter<aptFront::cache::entity::Facet, std::string>,
45
public Tagcoll::Converter<std::string, aptFront::cache::entity::Facet>
47
typedef aptFront::cache::entity::Facet Facet;
48
typedef Tagcoll::OpSet<aptFront::cache::entity::Facet> FacetSet;
49
typedef Tagcoll::OpSet<std::string> StringSet;
51
std::string operator()(const aptFront::cache::entity::Facet& item);
52
OpSet<std::string> operator()(const OpSet<aptFront::cache::entity::Facet>& items);
51
virtual std::string operator()(const aptFront::cache::entity::Facet& item) const;
52
virtual aptFront::cache::entity::Facet operator()(const std::string& item) const;
54
virtual StringSet operator()(const FacetSet& item) const
55
{ return Tagcoll::Converter<Facet, std::string>::operator()(item); }
56
virtual FacetSet operator()(const StringSet& item) const
57
{ return Tagcoll::Converter<std::string, Facet>::operator()(item); }
59
static std::string componentName();
56
* Convert strings to Facets
63
* Convert Tags to ints
59
class Converter<std::string, aptFront::cache::entity::Facet>
65
class TagIntConverter : public Implementation<TagIntConverter>,
66
public Tagcoll::Converter<aptFront::cache::entity::Tag, int>,
67
public Tagcoll::Converter<int, aptFront::cache::entity::Tag>
62
aptFront::cache::Cache* cache;
69
typedef aptFront::cache::entity::Tag Tag;
70
typedef Tagcoll::OpSet<aptFront::cache::entity::Tag> TagSet;
71
typedef Tagcoll::OpSet<int> IntSet;
64
Converter(aptFront::cache::Cache* cache = 0) : cache(cache) {}
66
void setOwnerCache( aptFront::cache::Cache *c ) { cache = c; }
68
aptFront::cache::entity::Facet operator()(const std::string& item);
69
OpSet<aptFront::cache::entity::Facet> operator()(const OpSet<std::string>& items);
73
virtual int operator()(const aptFront::cache::entity::Tag& item) const;
74
virtual aptFront::cache::entity::Tag operator()(const int& item) const;
76
virtual IntSet operator()(const TagSet& item) const
77
{ return Tagcoll::Converter<Tag, int>::operator()(item); }
78
virtual TagSet operator()(const IntSet& item) const
79
{ return Tagcoll::Converter<int, Tag>::operator()(item); }
81
static std::string componentName();
74
85
* Convert Tags to strings
77
class Converter<aptFront::cache::entity::Tag, std::string>
80
std::string operator()(const aptFront::cache::entity::Tag& item);
81
OpSet<std::string> operator()(const OpSet<aptFront::cache::entity::Tag>& items);
85
* Convert strings to Tags
88
class Converter<std::string, aptFront::cache::entity::Tag>
91
aptFront::cache::Cache* cache;
93
Converter(aptFront::cache::Cache* cache = 0) : cache(cache) {}
95
void setOwnerCache( aptFront::cache::Cache *c ) { cache = c; }
97
aptFront::cache::entity::Tag operator()(const std::string& item);
98
OpSet<aptFront::cache::entity::Tag> operator()(const OpSet<std::string>& items);
87
class TagStringConverter : public Implementation<TagStringConverter>,
88
public Tagcoll::Converter<aptFront::cache::entity::Tag, std::string>,
89
public Tagcoll::Converter<std::string, aptFront::cache::entity::Tag>
91
typedef aptFront::cache::entity::Tag Tag;
92
typedef Tagcoll::OpSet<aptFront::cache::entity::Tag> TagSet;
93
typedef Tagcoll::OpSet<std::string> StringSet;
95
virtual std::string operator()(const Tag& item) const;
96
virtual Tag operator()(const std::string& item) const;
98
virtual StringSet operator()(const TagSet& item) const
99
{ return Tagcoll::Converter<Tag, std::string>::operator()(item); }
100
virtual TagSet operator()(const StringSet& item) const
101
{ return Tagcoll::Converter<std::string, Tag>::operator()(item); }
103
TagSet parseTagList(const std::string& str) const;
105
static std::string componentName();
109
* Convert Packages to ints
111
class PackageIntConverter : public Implementation<PackageIntConverter>,
112
public Tagcoll::Converter<aptFront::cache::entity::Package, int>,
113
public Tagcoll::Converter<int, aptFront::cache::entity::Package>
115
typedef aptFront::cache::entity::Package Package;
116
typedef Tagcoll::OpSet<aptFront::cache::entity::Package> PackageSet;
117
typedef Tagcoll::OpSet<int> IntSet;
119
virtual int operator()(const Package& item) const;
120
virtual Package operator()(const int& item) const;
122
virtual IntSet operator()(const PackageSet& item) const
123
{ return Tagcoll::Converter<Package, int>::operator()(item); }
124
virtual PackageSet operator()(const IntSet& item) const
125
{ return Tagcoll::Converter<int, Package>::operator()(item); }
127
static std::string componentName();
131
* Convert Packages to strings
133
class PackageStringConverter : public Implementation<PackageStringConverter>,
134
public Tagcoll::Converter<aptFront::cache::entity::Package, std::string>,
135
public Tagcoll::Converter<std::string, aptFront::cache::entity::Package>
137
typedef aptFront::cache::entity::Package Package;
138
typedef Tagcoll::OpSet<aptFront::cache::entity::Package> PackageSet;
139
typedef Tagcoll::OpSet<std::string> StringSet;
141
virtual std::string operator()(const Package& item) const;
142
virtual Package operator()(const std::string& item) const;
144
virtual StringSet operator()(const PackageSet& item) const
145
{ return Tagcoll::Converter<Package, std::string>::operator()(item); }
146
virtual PackageSet operator()(const StringSet& item) const
147
{ return Tagcoll::Converter<std::string, Package>::operator()(item); }
149
static std::string componentName();