CAutoFile: Explicit Get() and remove unused methods

Also add documentation to some methods.
This commit is contained in:
Wladimir J. van der Laan
2014-10-20 12:45:50 +02:00
parent fef24cab1a
commit a873823864
5 changed files with 25 additions and 18 deletions

View File

@@ -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 IsNull() const { 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