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
00038     class TmpPath
00039     {
00040       public:
00044         TmpPath();
00045 
00049         explicit
00050         TmpPath( const Pathname & tmpPath_r );
00051 
00055         virtual
00056         ~TmpPath();
00057 
00062         operator const void * () const;
00063 
00067         Pathname
00068         path() const;
00069 
00073         operator Pathname() const
00074         { return path(); }
00075 
00076       public:
00081         static const Pathname &
00082         defaultLocation();
00083 
00084       protected:
00085         class Impl;
00086         RW_pointer<Impl> _impl;
00087 
00088     };
00090 
00094     inline std::ostream &
00095     operator<<( std::ostream & str, const TmpPath & obj )
00096     { return str << static_cast<Pathname>(obj); }
00097 
00099 
00101     //
00102     //  CLASS NAME : TmpFile
00115     class TmpFile : public TmpPath
00116     {
00117       public:
00121         explicit
00122         TmpFile( const Pathname & inParentDir_r = defaultLocation(),
00123                  const std::string & prefix_r = defaultPrefix() );
00124 
00132         static TmpFile makeSibling( const Pathname & sibling_r );
00133 
00134       public:
00138         static const std::string &
00139         defaultPrefix();
00140 
00141     };
00143 
00145     //
00146     //  CLASS NAME : TmpDir
00159     class TmpDir : public TmpPath
00160     {
00161       public:
00165         explicit
00166         TmpDir( const Pathname & inParentDir_r = defaultLocation(),
00167                 const std::string & prefix_r = defaultPrefix() );
00168 
00176         static TmpDir makeSibling( const Pathname & sibling_r );
00177 
00178       public:
00182         static const std::string &
00183         defaultPrefix();
00184     };
00186 
00187   } // namespace filesystem
00188 } // namespace zypp
00189 
00190 #endif // ZYPP_TMPPATH_H

doxygen