Cupt
package.hpp
Go to the documentation of this file.
1 /**************************************************************************
2 * Copyright (C) 2010 by Eugene V. Lyubimkin *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License *
6 * (version 3 or above) as published by the Free Software Foundation. *
7 * *
8 * This program is distributed in the hope that it will be useful, *
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
11 * GNU General Public License for more details. *
12 * *
13 * You should have received a copy of the GNU GPL *
14 * along with this program; if not, write to the *
15 * Free Software Foundation, Inc., *
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA *
17 **************************************************************************/
18 #ifndef CUPT_CACHE_PACKAGE_SEEN
19 #define CUPT_CACHE_PACKAGE_SEEN
20 
22 
23 #include <cupt/cache/version.hpp>
24 
25 namespace cupt {
26 namespace internal {
27 
28 struct VersionParseParameters;
29 
30 template< typename VersionType >
31 class CUPT_API BasePackageIterator: public std::iterator< std::bidirectional_iterator_tag, const VersionType* >
32 {
33  friend class cache::Package;
34  friend class cache::BinaryPackage;
35  friend class cache::SourcePackage;
36 
37  typedef vector< unique_ptr< cache::Version > >::const_iterator UnderlyingIterator;
38 
39  UnderlyingIterator __ui;
40 
41  BasePackageIterator(UnderlyingIterator);
42  public:
43  typedef BasePackageIterator Self;
44 
45  Self& operator++();
46  const VersionType* operator*() const;
47  bool operator==(const Self&) const;
48  bool operator!=(const Self&) const;
49 };
50 
51 }
52 
53 namespace cache {
54 
56 class CUPT_API Package
57 {
58  vector< unique_ptr< Version > > __parsed_versions;
59 
60  CUPT_LOCAL void __merge_version(const string&, unique_ptr< Version >&&);
61 
62  Package(const Package&);
63  Package& operator=(const Package&);
64  protected:
66  ;
67 
68  CUPT_LOCAL const vector< unique_ptr< Version > >& _get_versions() const;
69  CUPT_LOCAL virtual unique_ptr< Version > _parse_version(const internal::VersionParseParameters&) const = 0;
70  CUPT_LOCAL virtual bool _is_architecture_appropriate(const string&, const Version*) const = 0;
72  public:
74  Package();
76  virtual ~Package();
78  CUPT_LOCAL void addEntry(const internal::VersionParseParameters&);
80 
82  vector< const Version* > getVersions() const;
84 
88  const Version* getSpecificVersion(const string& versionString) const;
89 
90  typedef internal::BasePackageIterator< Version > iterator;
91  iterator begin() const;
92  iterator end() const;
93 };
94 
95 }
96 }
97 
98 #endif
99 
Definition: binarypackage.hpp:26
common version information
Definition: version.hpp:39
a container for all versions of the same package name
Definition: package.hpp:56