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
24
25namespace cupt {
26namespace internal {
27
28struct VersionParseParameters;
29
30template< typename VersionType >
31class 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
53namespace cache {
54
56class CUPT_API Package
57{
58 vector< unique_ptr< Version > > __parsed_versions;
59
60 CUPT_LOCAL void __merge_version(const string&, unique_ptr< Version >&&);
61 CUPT_LOCAL void p_mergeInstalledVersion(unique_ptr< Version >&&);
62
63 Package(const Package&);
64 Package& operator=(const Package&);
65 protected:
67 ;
68
69 CUPT_LOCAL const vector< unique_ptr< Version > >& _get_versions() const;
70 CUPT_LOCAL virtual unique_ptr< Version > _parse_version(const internal::VersionParseParameters&) const = 0;
71 CUPT_LOCAL virtual bool _is_architecture_appropriate(const string&, const Version*) const = 0;
73 public:
77 virtual ~Package();
79 CUPT_LOCAL void addEntry(const internal::VersionParseParameters&);
81
83 vector< const Version* > getVersions() const;
85
89 const Version* getSpecificVersion(const string& versionString) const;
90
91 typedef internal::BasePackageIterator< Version > iterator;
92 iterator begin() const;
93 iterator end() const;
94};
95
96}
97}
98
99#endif
100
a container for all versions of the same package name
Definition: package.hpp:57
vector< const Version * > getVersions() const
gets list of versions
virtual ~Package()
destructor
const Version * getSpecificVersion(const string &versionString) const
gets version with a certain Version::versionString
Package()
constructor
common version information
Definition: version.hpp:40