aboutsummaryrefslogtreecommitdiff
path: root/include/cru/common/io/OpenFileFlag.h
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2023-10-05 20:56:07 +0800
committercrupest <crupest@outlook.com>2023-10-05 20:56:07 +0800
commit6cd1d68baf219b5d3c742ba5fb3a9ee04e830999 (patch)
tree523c97530f235139ef89f9137997ca4b70b32237 /include/cru/common/io/OpenFileFlag.h
parentb09a5c7cea5b4eb32b3318c97b046f018b297d8c (diff)
downloadcru-6cd1d68baf219b5d3c742ba5fb3a9ee04e830999.tar.gz
cru-6cd1d68baf219b5d3c742ba5fb3a9ee04e830999.tar.bz2
cru-6cd1d68baf219b5d3c742ba5fb3a9ee04e830999.zip
...
Diffstat (limited to 'include/cru/common/io/OpenFileFlag.h')
-rw-r--r--include/cru/common/io/OpenFileFlag.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/cru/common/io/OpenFileFlag.h b/include/cru/common/io/OpenFileFlag.h
index fd8b6e2c..4a5789fb 100644
--- a/include/cru/common/io/OpenFileFlag.h
+++ b/include/cru/common/io/OpenFileFlag.h
@@ -11,11 +11,14 @@ using OpenFileFlag = Bitmask<details::OpenFileFlagTag>;
struct OpenFileFlags {
/**
* \brief for reading
+ * If the file does not exist, FileNotExistException should be thrown.
*/
static constexpr OpenFileFlag Read{0x1};
/**
* \brief for writing
+ * If the file does not exist and Create is not specified,
+ * FileNotExistException should be thrown.
*/
static constexpr OpenFileFlag Write{0x2};
@@ -34,7 +37,8 @@ struct OpenFileFlags {
/**
* \brief when writing, if the file does not exist, create one
- * Only effective for writing.
+ * Only effective for writing. When file does not exist, FileNotExistException
+ * will NOT be thrown and a new file will be created.
*/
static constexpr OpenFileFlag Create{0x10};
@@ -43,4 +47,10 @@ struct OpenFileFlags {
*/
static constexpr OpenFileFlag Exclusive{0x20};
};
+
+/**
+ * Append, Truncate, Create must be used with Write.
+ * Append and Truncate must not be used together.
+ */
+bool CheckOpenFileFlag(OpenFileFlag flags);
} // namespace cru::io