MCPcopy Create free account
hub / github.com/Kitware/VTK / open

Method open

ThirdParty/libproj/vtklibproj/src/filemanager.cpp:684–706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

682// ---------------------------------------------------------------------------
683
684std::unique_ptr<File> FileWin32::open(PJ_CONTEXT *ctx, const char *filename,
685 FileAccess access) {
686 DWORD dwDesiredAccess = access == FileAccess::READ_ONLY
687 ? GENERIC_READ
688 : GENERIC_READ | GENERIC_WRITE;
689 DWORD dwCreationDisposition =
690 access == FileAccess::CREATE ? CREATE_ALWAYS : OPEN_EXISTING;
691 DWORD dwFlagsAndAttributes = (dwDesiredAccess == GENERIC_READ)
692 ? FILE_ATTRIBUTE_READONLY
693 : FILE_ATTRIBUTE_NORMAL;
694 try {
695 HANDLE hFile = CreateFileW(
696 UTF8ToWString(std::string(filename)).c_str(), dwDesiredAccess,
697 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr,
698 dwCreationDisposition, dwFlagsAndAttributes, nullptr);
699 return std::unique_ptr<File>(hFile != INVALID_HANDLE_VALUE
700 ? new FileWin32(filename, ctx, hFile)
701 : nullptr);
702 } catch (const std::exception &e) {
703 pj_log(ctx, PJ_LOG_DEBUG, "%s", e.what());
704 return nullptr;
705 }
706}
707#else
708
709// ---------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 8

UTF8ToWStringFunction · 0.85
pj_logFunction · 0.85
pj_network_file_openFunction · 0.85
stringClass · 0.50
starts_withFunction · 0.50
c_strMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected