1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
10 #ifndef ZYPP_CacheInitializer_H
11 #define ZYPP_CacheInitializer_H
16 #include "zypp/base/PtrTypes.h"
17 #include "zypp/base/ReferenceCounted.h"
18 #include "zypp/base/NonCopyable.h"
19 #include "zypp/Pathname.h"
20 #include "zypp/cache/sqlite3x/sqlite3x.hpp"
22 #define ZYPP_CACHE_SCHEMA_VERSION 1002
24 ///////////////////////////////////////////////////////////////////
26 { /////////////////////////////////////////////////////////////////
27 ///////////////////////////////////////////////////////////////////
29 { /////////////////////////////////////////////////////////////////
31 ///////////////////////////////////////////////////////////////////
33 // CLASS NAME : CacheInitializer
35 class CacheInitializer
37 friend std::ostream & operator<<( std::ostream & str, const CacheInitializer & obj );
41 * Tries to initialize the source cache if it was not
42 * \throws Exception When cant initialize
44 CacheInitializer( const Pathname &root_r, const Pathname &db_file );
45 virtual ~CacheInitializer();
48 * \short Has the cache been reinitialized?
50 * only true when cache was not initialized before
51 * and was just initialized with success
53 bool justInitialized() const;
56 * \short Has the cache been reinitialized?
58 * This is true when the cache was already initialized
59 * but an old schema was detected, so the cache
60 * was reinitialized in order to get the new schema
62 bool justReinitialized() const;
65 bool tablesCreated() const;
67 /** Overload to realize stream output. */
68 virtual std::ostream & dumpOn( std::ostream & str ) const;
70 /** Implementation. */
72 /** Pointer to implementation. */
73 RW_pointer<Impl> _pimpl;
75 ///////////////////////////////////////////////////////////////////
77 /** \relates CacheInitializer Stream output */
78 inline std::ostream & operator<<( std::ostream & str, const CacheInitializer & obj )
79 { return obj.dumpOn( str ); }
82 /////////////////////////////////////////////////////////////////
84 ///////////////////////////////////////////////////////////////////
85 /////////////////////////////////////////////////////////////////
87 ///////////////////////////////////////////////////////////////////
88 #endif // ZYPP_SOURCE_CacheInitializer_H