Cupt
version.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_VERSION_SEEN
19 #define CUPT_CACHE_VERSION_SEEN
20 
22 
23 #include <cstdint>
24 #include <map>
25 
26 #include <cupt/fwd.hpp>
27 #include <cupt/common.hpp>
28 #include <cupt/hashsums.hpp>
29 
30 namespace cupt {
31 namespace cache {
32 
33 using std::map;
34 
36 
39 struct CUPT_API Version
40 {
42  struct Source
43  {
45  string directory;
46  };
49  {
50  string baseUri;
51  string directory;
52  };
54  struct Priorities
55  {
57  enum Type { Required, Important, Standard, Optional, Extra };
59  static const string strings[];
60  };
62  struct FileRecord
63  {
64  string name;
65  uint32_t size;
67  };
68  vector< Source > sources;
69  string packageName;
71  string section;
72  string maintainer;
73  string versionString;
74  map< string, string >* others;
75 
77  Version();
79  virtual ~Version();
81 
86  virtual bool areHashesEqual(const Version* other) const = 0;
87 
89  bool isVerified() const;
91  vector< DownloadRecord > getDownloadInfo() const;
92 
94 
97  bool operator<(const Version&) const;
98 
100  static bool parseRelations;
102  static bool parseInfoOnly;
104  static bool parseOthers;
105 
107  string getCodenameAndComponentString(const string&) const;
109 };
110 
111 } // namespace
112 } // namespace
113 
114 #endif
115 
cupt::cache::Version::sources
vector< Source > sources
list of sources
Definition: version.hpp:68
cupt::cache::Version::packageName
string packageName
package name
Definition: version.hpp:69
cupt::cache::Version::FileRecord::name
string name
file name
Definition: version.hpp:64
cupt::cache::Version::DownloadRecord
download place record
Definition: version.hpp:48
cupt::cache::Version::FileRecord
file information
Definition: version.hpp:62
cupt::cache::Version::Priorities::Type
Type
priority types
Definition: version.hpp:57
common.hpp
hashsums.hpp
cupt::cache::Version::others
map< string, string > * others
unknown fields in the form 'name' -> 'value', NULL by default
Definition: version.hpp:74
cupt::cache::Version::FileRecord::hashSums
HashSums hashSums
hash sums
Definition: version.hpp:66
cupt::cache::Version::parseRelations
static bool parseRelations
enables parsing relation fields in versions, true by default
Definition: version.hpp:100
cupt::cache::Version::DownloadRecord::baseUri
string baseUri
base URI
Definition: version.hpp:50
cupt::cache::Version::Source::directory
string directory
remote directory containing files
Definition: version.hpp:45
cupt::cache::ReleaseInfo
release information
Definition: releaseinfo.hpp:30
cupt::cache::Version
common version information
Definition: version.hpp:39
cupt::cache::Version::parseInfoOnly
static bool parseInfoOnly
enables parsing info-only fields in versions, true by default
Definition: version.hpp:102
cupt::HashSums
hash sums
Definition: hashsums.hpp:28
cupt::cache::Version::DownloadRecord::directory
string directory
directory on the baseUri
Definition: version.hpp:51
cupt::cache::Version::FileRecord::size
uint32_t size
file size
Definition: version.hpp:65
cupt::cache::Version::maintainer
string maintainer
maintainer (usually name and mail address)
Definition: version.hpp:72
cupt::cache::Version::Priorities
priority
Definition: version.hpp:54
cupt::cache::Version::parseOthers
static bool parseOthers
enables parsing unknown fields in versions, false by default
Definition: version.hpp:104
cupt::cache::Version::section
string section
section
Definition: version.hpp:71
cupt::cache::Version::versionString
string versionString
version
Definition: version.hpp:73
cupt::cache::Version::Source
where version comes from
Definition: version.hpp:42
cupt::cache::Version::Source::release
const ReleaseInfo * release
release info
Definition: version.hpp:44
cupt::cache::Version::priority
Priorities::Type priority
priority
Definition: version.hpp:70