MCPcopy Create free account
hub / github.com/Tencent/MMKV / OpenFlag2NativeFlag

Function OpenFlag2NativeFlag

Core/MemoryFile_Win32.cpp:48–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48static pair<int, int> OpenFlag2NativeFlag(OpenFlag flag) {
49 int access = 0, create = OPEN_EXISTING;
50 if ((flag & OpenFlagRWMask) == OpenFlag::ReadWrite) {
51 access = (GENERIC_READ | GENERIC_WRITE);
52 } else if (flag & OpenFlag::ReadOnly) {
53 access |= GENERIC_READ;
54 } else if (flag & OpenFlag::WriteOnly) {
55 access |= GENERIC_WRITE;
56 }
57 if (flag & OpenFlag::Create) {
58 create = OPEN_ALWAYS;
59 }
60 if (flag & OpenFlag::Excel) {
61 access = CREATE_NEW;
62 }
63 if (flag & OpenFlag::Truncate) {
64 access = CREATE_ALWAYS;
65 }
66 return {access, create};
67}
68
69bool File::open() {
70 if (isFileValid()) {

Callers 1

openMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected