|
enum : unsigned { |
|
/// Open flag: Read only access |
|
ReadOnly = 0x00u, |
|
/// Open flag: Read Write access |
|
ReadWrite = 0x01u, |
|
/// Open flag: Truncate a file if already existing |
|
Truncate = 0x02u, |
|
/// Open flag: Open will fail if file already exist |
|
Excl = 0x04u, |
|
/// Open flag: Open in debug mode |
|
Debug = 0x08u, |
|
/// Open flag: Create non existing file |
|
Create = 0x10u, |
|
/// Derived open flag: common write mode (=ReadWrite|Create|Truncate) |
|
Overwrite = Truncate, |
|
/// Derived open flag: Opens RW or exclusively creates |
|
OpenOrCreate = ReadWrite | Create |
|
}; |
and then here:
|
explicit File(const std::string& filename, |
|
unsigned openFlags = ReadOnly, |
|
const FileAccessProps& fileAccessProps = FileAccessProps::Default()); |
isn't particularly type safe. One option is:
class File {
enum class FileMode {
ReadOnly,
};
static constexpr ReadOnly = FileMode::ReadOnly;
};
and a lot of boiler plate to allow it to work properly as a bitset. Or use:
using FileMode = std::bitset<?>;
class File {
static constexpr FileMode ReadOnly = {...};
};
HighFive/include/highfive/H5File.hpp
Lines 28 to 45 in 7638232
and then here:
HighFive/include/highfive/H5File.hpp
Lines 54 to 56 in 7638232
isn't particularly type safe. One option is:
and a lot of boiler plate to allow it to work properly as a bitset. Or use: