libzypp  10.5.0
TmpPath.h
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_TMPPATH_H
00013 #define ZYPP_TMPPATH_H
00014 
00015 #include <iosfwd>
00016 
00017 #include "zypp/Pathname.h"
00018 #include "zypp/base/PtrTypes.h"
00019 
00020 namespace zypp {
00021   namespace filesystem {
00022 
00024     //
00025     //  CLASS NAME : TmpPath
00039     class TmpPath
00040     {
00041       public:
00045         TmpPath();
00046 
00050         explicit
00051         TmpPath( const Pathname & tmpPath_r );
00052 
00056         virtual
00057         ~TmpPath();
00058 
00063         operator const void * () const;
00064 
00068         Pathname
00069         path() const;
00070 
00074         operator Pathname() const
00075         { return path(); }
00076 
00080         bool autoCleanup() const;
00081 
00085         void autoCleanup( bool yesno_r );
00086 
00087       public:
00092         static const Pathname &
00093         defaultLocation();
00094 
00095       protected:
00096         class Impl;
00097         RW_pointer<Impl> _impl;
00098 
00099     };
00101 
00105     inline std::ostream &
00106     operator<<( std::ostream & str, const TmpPath & obj )
00107     { return str << static_cast<Pathname>(obj); }
00108 
00110 
00112     //
00113     //  CLASS NAME : TmpFile
00126     class TmpFile : public TmpPath
00127     {
00128       public:
00132         explicit
00133         TmpFile( const Pathname & inParentDir_r = defaultLocation(),
00134                  const std::string & prefix_r = defaultPrefix() );
00135 
00143         static TmpFile makeSibling( const Pathname & sibling_r );
00144 
00145       public:
00149         static const std::string &
00150         defaultPrefix();
00151 
00152     };
00154 
00156     //
00157     //  CLASS NAME : TmpDir
00170     class TmpDir : public TmpPath
00171     {
00172       public:
00176         explicit
00177         TmpDir( const Pathname & inParentDir_r = defaultLocation(),
00178                 const std::string & prefix_r = defaultPrefix() );
00179 
00187         static TmpDir makeSibling( const Pathname & sibling_r );
00188 
00189       public:
00193         static const std::string &
00194         defaultPrefix();
00195     };
00197 
00198   } // namespace filesystem
00199 } // namespace zypp
00200 
00201 #endif // ZYPP_TMPPATH_H