aboutsummaryrefslogtreecommitdiff
path: root/src/serialize.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-10-20 12:45:50 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-10-22 10:18:19 +0200
commita873823864a00f68772eb2b85a70e933839ca3f5 (patch)
tree851616d84523434fe11a5a47c59ca2b2606935ff /src/serialize.h
parentfef24cab1a4a13a864783dfcd6613ce8100f990d (diff)
CAutoFile: Explicit Get() and remove unused methods
Also add documentation to some methods.
Diffstat (limited to 'src/serialize.h')
-rw-r--r--src/serialize.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/serialize.h b/src/serialize.h
index d8f0b76d59..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 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