All valid modes can now be referred to with a single enumerator.
C_EXCLUSIVE alone is not valid.
case C_NONE: create_flags = OPEN_EXISTING; break;
case C_CREATE: create_flags = OPEN_ALWAYS; break;
case C_TRUNCATE: create_flags = TRUNCATE_EXISTING; break;
- case C_CREATE+C_TRUNCATE: create_flags = CREATE_ALWAYS; break;
- case C_CREATE+C_EXCLUSIVE: create_flags = CREATE_NEW; break;
+ case C_OVERWRITE: create_flags = CREATE_ALWAYS; break;
+ case C_NEW: create_flags = CREATE_NEW; break;
}
}
C_NONE = 0,
C_CREATE = 1,
C_TRUNCATE = 2,
- C_EXCLUSIVE = 4
+ C_OVERWRITE = C_CREATE+C_TRUNCATE,
+ C_EXCLUSIVE = 4,
+ C_NEW = C_CREATE+C_EXCLUSIVE
};
private:
/** Creates a new file object and opens it. If the create flag is set and
write access is requested and the file does exist, it is created. Otherwise
a missing file is an error. */
- File(const std::string &, Mode = M_READ, CreateMode = CreateMode(C_CREATE+C_TRUNCATE));
+ File(const std::string &, Mode = M_READ, CreateMode = C_OVERWRITE);
virtual ~File();
void set_block(bool);