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  {
44  shared_ptr< const ReleaseInfo > release;
45  string directory;
46  };
49  {
50  string packageName;
51  shared_ptr< File > file;
52  uint32_t offset;
53  shared_ptr< const ReleaseInfo > releaseInfo;
54  };
57  {
58  string baseUri;
59  string directory;
60  };
62  struct Priorities
63  {
65  enum Type { Required, Important, Standard, Optional, Extra };
67  static const string strings[];
68  };
70  struct FileRecord
71  {
72  string name;
73  uint32_t size;
75  };
76  vector< Source > sources;
77  string packageName;
79  string section;
80  string maintainer;
81  string versionString;
82  map< string, string >* others;
83 
85  Version();
87  virtual ~Version();
89 
94  virtual bool areHashesEqual(const shared_ptr< const Version >& other) const = 0;
95 
97  bool isVerified() const;
99  vector< DownloadRecord > getDownloadInfo() const;
100 
102 
105  bool operator<(const Version&) const;
107 
110  bool operator==(const Version&) const;
111 
113  static bool parseRelations;
115  static bool parseInfoOnly;
117  static bool parseOthers;
118 };
119 
120 } // namespace
121 } // namespace
122 
123 #endif
124