00001
00002
00003
00004
00005
00006
00007
00008
00015 #ifndef ZYPP_MEDIA_DIGEST_H
00016 #define ZYPP_MEDIA_DIGEST_H
00017
00018 #include <string>
00019 #include <iosfwd>
00020
00021 #include <zypp/Callback.h>
00022 #include <zypp/Pathname.h>
00023
00024 namespace zypp {
00025
00026
00027 struct DigestReport : public callback::ReportBase
00028 {
00029 virtual bool askUserToAcceptNoDigest( const zypp::Pathname &file );
00030 virtual bool askUserToAccepUnknownDigest( const Pathname &file, const std::string &name );
00031 virtual bool askUserToAcceptWrongDigest( const Pathname &file, const std::string &requested, const std::string &found );
00032 };
00033
00034
00035
00044 class Digest
00045 {
00046 private:
00047 class P;
00048 P* _dp;
00049
00050
00051 Digest(const Digest& d);
00052
00053 const Digest& operator=(const Digest& d);
00054
00055 public:
00056 Digest();
00057 ~Digest();
00058
00072 bool create(const std::string& name);
00073
00075 const std::string& name();
00076
00082 bool update(const char* bytes, size_t len);
00083
00091 std::string digest();
00092
00103 static std::string digest(const std::string& name, std::istream& is, size_t bufsize = 4096);
00104 };
00105
00106 }
00107
00108 #endif