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/Patch.h>
00023 
00025 namespace zypp
00026 { 
00027 
00028   namespace storage
00029   { 
00030 
00031     //
00032     //  CLASS NAME : PersistentStorage
00033     //
00035     class PersistentStorage : public base::ReferenceCounted, private base::NonCopyable
00036     {
00037       friend std::ostream & operator<<( std::ostream & str, const PersistentStorage & obj );
00038       typedef intrusive_ptr<PersistentStorage> Ptr;
00039       typedef intrusive_ptr<const PersistentStorage> constPtr;
00040     public:
00042       PersistentStorage();
00044       ~PersistentStorage();
00045       void doTest();
00046 
00047       struct SourceData
00048       {
00049         SourceData()
00050         {
00051           enabled = true;
00052           autorefresh = false;
00053         };
00054 
00055         bool enabled;
00056         bool autorefresh;
00057         Pathname product_dir;
00058         std::string type;
00059         Url url;
00060         Pathname cache_dir;
00061         std::string alias;
00062       };
00063 
00064     public:
00069        void init(const Pathname &root);
00070 
00074        bool isInitialized() const;
00075 
00079       void storeObject( ResObject::constPtr resolvable );
00083       void deleteObject( ResObject::constPtr resolvable );
00087       std::list<ResObject::Ptr> storedObjects() const;
00091       std::list<ResObject::Ptr> storedObjects(const Resolvable::Kind kind) const;
00096       std::list<ResObject::Ptr> storedObjects(const Resolvable::Kind kind, const std::string & name, bool partial_match = false) const;
00098       // Resolvables Flags API
00100       public:
00104       void setObjectFlag( ResObject::constPtr resolvable, const std::string &flag );
00108       void removeObjectFlag( ResObject::constPtr resolvable, const std::string &flag );
00112       std::set<std::string> objectFlags( ResObject::constPtr resolvable ) const;
00116       bool doesObjectHasFlag( ResObject::constPtr resolvable, const std::string &flag ) const;
00117 
00119       // Named Flags API
00121       public:
00122       void setFlag( const std::string &key, const std::string &flag );
00123       void removeFlag( const std::string &key, const std::string &flag );
00124       std::set<std::string> flags( const std::string &key ) const;
00125       bool hasFlag( const std::string &key, const std::string &flag ) const;
00126 
00128       // SOURCES API
00130 
00133       std::list<SourceData> storedSources() const;
00137       void storeSource(const SourceData &data);
00141       void deleteSource(const std::string &alias);
00142 
00143     private:
00144       class Private;
00145       shared_ptr<Private> d;
00146     };
00148 
00149     std::ostream & operator<<( std::ostream & str, const PersistentStorage & obj );
00150 
00152   } // namespace storage
00155 } // namespace zypp
00157 #endif // ZYPP_TARGET_PERSISTENTSTORAGE_H

Generated on Thu Jul 6 00:07:26 2006 for zypp by  doxygen 1.4.6