Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

PkgPubkeyCache.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                    (C) SuSE Linux AG |
00011 \----------------------------------------------------------------------/
00012 
00013   File:       PkgPubkeyCache.h
00014 
00015   Author:     Michael Andres <ma@suse.de>
00016   Maintainer: Michael Andres <ma@suse.de>
00017 
00018   Purpose: Manage gpg-pubkeys (package singning keys)
00019 
00020 /-*/
00021 #ifndef PkgPubkeyCache_h
00022 #define PkgPubkeyCache_h
00023 
00024 #include <iosfwd>
00025 
00026 #include <y2util/Pathname.h>
00027 
00028 #include <y2pm/InstSrcError.h>
00029 
00031 //
00032 //      CLASS NAME : PkgPubkeyCache
00044 class PkgPubkeyCache {
00045 
00046   friend std::ostream & operator<<( std::ostream & str, const PkgPubkeyCache & obj );
00047 
00048   PkgPubkeyCache & operator=( const PkgPubkeyCache & );
00049   PkgPubkeyCache            ( const PkgPubkeyCache & );
00050 
00051   private:
00052 
00053     static const std::string _prefix;
00054     static const std::string _ext;
00055 
00056     Pathname _cachedir;
00057 
00058   public:
00059 
00063     typedef InstSrcError Error;
00064 
00065   public:
00066 
00070     PkgPubkeyCache() {}
00071 
00075     PkgPubkeyCache( const Pathname & cachedir_r );
00076 
00080     ~PkgPubkeyCache();
00081 
00082   public:
00083 
00087     const Pathname & cachedir() const { return _cachedir; }
00088 
00092     bool cacheDisabled() const { return _cachedir.empty(); }
00093 
00098     static bool isKey( const std::string & keyname_r );
00099 
00104     static bool isKey( const Pathname & keyfile_r ) {
00105       return isKey( keyfile_r.basename() );
00106     }
00107 
00112     static std::string keyEdition( const std::string & keyname_r );
00113 
00118     static std::string keyEdition( const Pathname & keyfile_r ) {
00119       return keyEdition( keyfile_r.basename() );
00120     }
00121 
00128     bool hasKey( const std::string & keyname_r ) const;
00129 
00134     bool hasKey( const Pathname & keyfile_r ) const {
00135       return hasKey( keyfile_r.basename() );
00136     }
00137 
00138   public:
00139 
00143     PMError setCachedir( const Pathname & cachedir_r );
00144 
00148     PMError storeKey( const Pathname & keyfile_r );
00149 
00154     PMError sync();
00155 
00156 
00160     PMError cacheCopyTo( const Pathname & newcachedir_r );
00161 };
00162 
00164 
00165 #endif // PkgPubkeyCache_h

Generated on Fri Nov 9 14:30:31 2007 for yast2-packagemanager by doxygen 1.3.6