PersistentStorage.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_TARGET_PERSISTENTSTORAGE_H
00013 #define ZYPP_TARGET_PERSISTENTSTORAGE_H
00014 
00015 #include <iosfwd>
00016 
00017 #include "zypp/base/ReferenceCounted.h"
00018 #include "zypp/base/NonCopyable.h"
00019 #include "zypp/base/PtrTypes.h"
00020 #include <zypp/Pathname.h>
00021 #include <zypp/Url.h>
00022 #include <zypp/Date.h>
00023 #include <zypp/Patch.h>
00024 #include <zypp/source/SourceInfo.h>
00025 
00026 using namespace zypp::source;
00027 
00029 namespace zypp
00030 { 
00031 
00032   namespace storage
00033   { 
00034 
00035     //
00036     //  CLASS NAME : PersistentStorage
00037     //
00039     class PersistentStorage : public base::ReferenceCounted, private base::NonCopyable
00040     {
00041       friend std::ostream & operator<<( std::ostream & str, const PersistentStorage & obj );
00042       typedef intrusive_ptr<PersistentStorage> Ptr;
00043       typedef intrusive_ptr<const PersistentStorage> constPtr;
00044     public:
00046       PersistentStorage();
00048       ~PersistentStorage();
00049       void doTest();
00050 
00051     public:
00056        void init(const Pathname &root);
00057 
00061        bool isInitialized() const;
00062 
00066        Date timestamp() const;
00067        
00071       void storeObject( ResObject::constPtr resolvable );
00075       void deleteObject( ResObject::constPtr resolvable );
00079       std::list<ResObject::Ptr> storedObjects() const;
00083       std::list<ResObject::Ptr> storedObjects(const Resolvable::Kind kind) const;
00088       std::list<ResObject::Ptr> storedObjects(const Resolvable::Kind kind, const std::string & name, bool partial_match = false) const;
00090       // Resolvables Flags API
00092       public:
00096       void setObjectFlag( ResObject::constPtr resolvable, const std::string &flag );
00100       void removeObjectFlag( ResObject::constPtr resolvable, const std::string &flag );
00104       std::set<std::string> objectFlags( ResObject::constPtr resolvable ) const;
00108       bool doesObjectHasFlag( ResObject::constPtr resolvable, const std::string &flag ) const;
00109 
00111       // Named Flags API
00113       public:
00114       void setFlag( const std::string &key, const std::string &flag );
00115       void removeFlag( const std::string &key, const std::string &flag );
00116       std::set<std::string> flags( const std::string &key ) const;
00117       bool hasFlag( const std::string &key, const std::string &flag ) const;
00118 
00120       // SOURCES API
00122 
00125       std::list<SourceInfo> storedSources() const;
00129       void storeSource(const SourceInfo &data);
00133       void deleteSource(const std::string &alias);
00134 
00135     private:
00136       class Private;
00137       shared_ptr<Private> d;
00138     };
00140 
00141     std::ostream & operator<<( std::ostream & str, const PersistentStorage & obj );
00142 
00144   } // namespace storage
00147 } // namespace zypp
00149 #endif // ZYPP_TARGET_PERSISTENTSTORAGE_H

Generated on Tue Nov 28 16:49:33 2006 for zypp by  doxygen 1.5.0