diff options
Diffstat (limited to 'src/serialize.h')
-rw-r--r-- | src/serialize.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/serialize.h b/src/serialize.h index 55b6891394..b9d5f95463 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -1116,14 +1116,21 @@ public: } } + /** Get wrapped FILE* with transfer of ownership. + * @note This will invalidate the CAutoFile object, and makes it the responsibility of the caller + * of this function to clean up the returned FILE*. + */ FILE* release() { FILE* ret = file; file = NULL; return ret; } - operator FILE*() { return file; } - FILE* operator->() { return file; } - FILE& operator*() { return *file; } - FILE** operator&() { return &file; } - FILE* operator=(FILE* pnew) { return file = pnew; } - bool operator!() { return (file == NULL); } + /** Get wrapped FILE* without transfer of ownership. + * @note Ownership of the FILE* will remain with this class. Use this only if the scope of the + * CAutoFile outlives use of the passed pointer. + */ + FILE* Get() const { return file; } + + /** Return true if the wrapped FILE* is NULL, false otherwise. + */ + bool IsNull() const { return (file == NULL); } // // Stream subset |