X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fscoped_temporary.h;h=b78f60541089fc6ed7833e69b8c05e965f0b4720;hb=f706bbb9afd10472e81a051cd5db601d6404377c;hp=87c8e387f338b31ca7df40f1f32c23a290f6f4ca;hpb=3828baf56467224f5d44049bf1e7a7ed11f43a05;p=dcpomatic.git diff --git a/src/lib/scoped_temporary.h b/src/lib/scoped_temporary.h index 87c8e387f..b78f60541 100644 --- a/src/lib/scoped_temporary.h +++ b/src/lib/scoped_temporary.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington + Copyright (C) 2012-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,9 +18,13 @@ */ + +#include #include +#include #include + /** @class ScopedTemporary * @brief A temporary file which is deleted when the ScopedTemporary object goes out of scope. */ @@ -30,16 +34,18 @@ public: ScopedTemporary (); ~ScopedTemporary (); - /** @return temporary filename */ - boost::filesystem::path file () const { - return _file; + ScopedTemporary (ScopedTemporary const&) = delete; + ScopedTemporary& operator= (ScopedTemporary const&) = delete; + + /** @return temporary pathname */ + boost::filesystem::path path () const { + return _path; } char const * c_str () const; - FILE* open (char const *); - void close (); + dcp::File& open (char const *); private: - boost::filesystem::path _file; - FILE* _open; + boost::filesystem::path _path; + boost::optional _file; };