Cupt
|
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_HASHSUMS_SEEN 00019 #define CUPT_HASHSUMS_SEEN 00020 00022 00023 #include <cupt/common.hpp> 00024 00025 namespace cupt { 00026 00028 class CUPT_API HashSums 00029 { 00030 public: 00032 enum Type { MD5, SHA1, SHA256, Count }; 00033 00035 string values[Count]; 00036 00038 string& operator[](const Type& type); 00040 const string& operator[](const Type& type) const; 00042 00047 bool verify(const string& path) const; 00049 00055 bool match(const HashSums& other) const; 00057 00060 bool empty() const; 00061 00063 00066 void fill(const string& path); 00067 00069 00074 static string getHashOfString(const Type& type, const string& pattern); 00075 }; 00076 00077 } 00078 00079 #endif 00080