Cupt
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
version.hpp
Go to the documentation of this file.
00001 /**************************************************************************
00002 *   Copyright (C) 2010 by Eugene V. Lyubimkin                             *
00003 *                                                                         *
00004 *   This program is free software; you can redistribute it and/or modify  *
00005 *   it under the terms of the GNU General Public License                  *
00006 *   (version 3 or above) as published by the Free Software Foundation.    *
00007 *                                                                         *
00008 *   This program is distributed in the hope that it will be useful,       *
00009 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00010 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00011 *   GNU General Public License for more details.                          *
00012 *                                                                         *
00013 *   You should have received a copy of the GNU GPL                        *
00014 *   along with this program; if not, write to the                         *
00015 *   Free Software Foundation, Inc.,                                       *
00016 *   51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA               *
00017 **************************************************************************/
00018 #ifndef CUPT_CACHE_VERSION_SEEN
00019 #define CUPT_CACHE_VERSION_SEEN
00020 
00022 
00023 #include <cstdint>
00024 #include <map>
00025 
00026 #include <cupt/fwd.hpp>
00027 #include <cupt/common.hpp>
00028 #include <cupt/hashsums.hpp>
00029 
00030 namespace cupt {
00031 namespace cache {
00032 
00033 using std::map;
00034 
00036 
00039 struct CUPT_API Version
00040 {
00042     struct Source
00043     {
00044         shared_ptr< const ReleaseInfo > release; 
00045         string directory; 
00046     };
00048     struct InitializationParameters
00049     {
00050         string packageName; 
00051         shared_ptr< File > file; 
00052         uint32_t offset; 
00053         shared_ptr< const ReleaseInfo > releaseInfo; 
00054     };
00056     struct DownloadRecord
00057     {
00058         string baseUri; 
00059         string directory; 
00060     };
00062     struct Priorities
00063     {
00065         enum Type { Required, Important, Standard, Optional, Extra };
00067         static const string strings[];
00068     };
00070     struct FileRecord
00071     {
00072         string name; 
00073         uint32_t size; 
00074         HashSums hashSums; 
00075     };
00076     vector< Source > sources; 
00077     string packageName; 
00078     Priorities::Type priority; 
00079     string section; 
00080     string maintainer; 
00081     string versionString; 
00082     map< string, string >* others; 
00083 
00085     Version();
00087     virtual ~Version();
00089 
00094     virtual bool areHashesEqual(const shared_ptr< const Version >& other) const = 0;
00095 
00097     bool isVerified() const;
00099     vector< DownloadRecord > getDownloadInfo() const;
00100 
00102 
00105     bool operator<(const Version&) const;
00107 
00110     bool operator==(const Version&) const;
00111 
00113     static bool parseRelations;
00115     static bool parseInfoOnly;
00117     static bool parseOthers;
00118 };
00119 
00120 } // namespace
00121 } // namespace
00122 
00123 #endif
00124 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator