00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PALUDIS_GUARD_PALUDIS_CONTENTS_HH
00021 #define PALUDIS_GUARD_PALUDIS_CONTENTS_HH 1
00022
00023 #include <paludis/contents-fwd.hh>
00024 #include <paludis/util/simple_visitor.hh>
00025 #include <paludis/util/instantiation_policy.hh>
00026 #include <paludis/util/private_implementation_pattern.hh>
00027 #include <paludis/util/type_list.hh>
00028 #include <paludis/util/wrapped_forward_iterator-fwd.hh>
00029 #include <paludis/util/fs_entry-fwd.hh>
00030 #include <paludis/metadata_key_holder.hh>
00031 #include <tr1/memory>
00032 #include <string>
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 namespace paludis
00045 {
00046
00047
00048
00049
00050
00051
00052
00053
00054 class PALUDIS_VISIBLE ContentsEntry :
00055 private PrivateImplementationPattern<ContentsEntry>,
00056 public MetadataKeyHolder,
00057 public virtual DeclareAbstractAcceptMethods<ContentsEntry, MakeTypeList<
00058 ContentsFileEntry, ContentsDirEntry, ContentsSymEntry, ContentsOtherEntry>::Type>
00059 {
00060 private:
00061 PrivateImplementationPattern<ContentsEntry>::ImpPtr & _imp;
00062
00063 protected:
00064 virtual void need_keys_added() const;
00065
00066 public:
00067
00068
00069
00070 ContentsEntry(const FSEntry & path);
00071 virtual ~ContentsEntry() = 0;
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083 using MetadataKeyHolder::add_metadata_key;
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
00096
00097
00098
00099
00100 };
00101
00102
00103
00104
00105
00106
00107
00108 class PALUDIS_VISIBLE ContentsFileEntry :
00109 public ContentsEntry,
00110 public ImplementAcceptMethods<ContentsEntry, ContentsFileEntry>
00111 {
00112 public:
00113
00114
00115
00116 ContentsFileEntry(const FSEntry &);
00117
00118
00119 };
00120
00121
00122
00123
00124
00125
00126
00127 class PALUDIS_VISIBLE ContentsDirEntry :
00128 public ContentsEntry,
00129 public ImplementAcceptMethods<ContentsEntry, ContentsDirEntry>
00130 {
00131 public:
00132
00133
00134
00135 ContentsDirEntry(const FSEntry &);
00136
00137
00138 };
00139
00140
00141
00142
00143
00144
00145
00146
00147 class PALUDIS_VISIBLE ContentsOtherEntry :
00148 public ContentsEntry,
00149 public ImplementAcceptMethods<ContentsEntry, ContentsOtherEntry>
00150 {
00151 public:
00152
00153
00154
00155 ContentsOtherEntry(const FSEntry &);
00156
00157
00158 };
00159
00160
00161
00162
00163
00164
00165
00166 class PALUDIS_VISIBLE ContentsSymEntry :
00167 private PrivateImplementationPattern<ContentsSymEntry>,
00168 public ContentsEntry,
00169 public ImplementAcceptMethods<ContentsEntry, ContentsSymEntry>
00170 {
00171 private:
00172 PrivateImplementationPattern<ContentsSymEntry>::ImpPtr & _imp;
00173
00174 public:
00175
00176
00177
00178 ContentsSymEntry(const FSEntry &, const std::string & target);
00179 ~ContentsSymEntry();
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191 const std::tr1::shared_ptr<const MetadataValueKey<std::string> > target_key() const;
00192
00193
00194 };
00195
00196
00197
00198
00199
00200
00201
00202 class PALUDIS_VISIBLE Contents :
00203 private InstantiationPolicy<Contents, instantiation_method::NonCopyableTag>,
00204 private PrivateImplementationPattern<Contents>
00205 {
00206 public:
00207
00208
00209
00210 Contents();
00211 ~Contents();
00212
00213
00214
00215
00216 void add(const std::tr1::shared_ptr<const ContentsEntry> & c);
00217
00218
00219
00220
00221 struct ConstIteratorTag;
00222 typedef WrappedForwardIterator<ConstIteratorTag, const std::tr1::shared_ptr<const ContentsEntry> > ConstIterator;
00223
00224 ConstIterator begin() const
00225 PALUDIS_ATTRIBUTE((warn_unused_result));
00226
00227 ConstIterator end() const
00228 PALUDIS_ATTRIBUTE((warn_unused_result));
00229
00230
00231 };
00232
00233 #ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
00234 extern template class InstantiationPolicy<Contents, instantiation_method::NonCopyableTag>;
00235 extern template class PrivateImplementationPattern<Contents>;
00236 extern template class PrivateImplementationPattern<ContentsEntry>;
00237 extern template class PrivateImplementationPattern<ContentsSymEntry>;
00238 #endif
00239 }
00240
00241 #endif