MCPcopy Create free account
hub / github.com/aiekick/ImGuiFileDialog / IGFD_Selection IGFD_GetSelection

Function IGFD_Selection IGFD_GetSelection

ImGuiFileDialog.cpp:4983–5025  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4981}
4982
4983IGFD_C_API IGFD_Selection IGFD_GetSelection(ImGuiFileDialog* vContextPtr, IGFD_ResultMode vMode) {
4984 IGFD_Selection res = IGFD_Selection_Get();
4985 if (vContextPtr != nullptr) {
4986 auto sel = vContextPtr->GetSelection(vMode);
4987 if (!sel.empty()) {
4988 res.count = sel.size();
4989 res.table = new IGFD_Selection_Pair[res.count];
4990
4991 size_t idx = 0U;
4992 for (const auto& s : sel) {
4993 IGFD_Selection_Pair* pair = res.table + idx++;
4994
4995 // fileNameExt
4996 if (!s.first.empty()) {
4997 size_t siz = s.first.size() + 1U;
4998 pair->fileName = new char[siz];
4999#ifndef _MSC_VER
5000 strncpy(pair->fileName, s.first.c_str(), siz);
5001#else // _MSC_VER
5002 strncpy_s(pair->fileName, siz, s.first.c_str(), siz);
5003#endif // _MSC_VER
5004 pair->fileName[siz - 1U] = '\0';
5005 }
5006
5007 // filePathName
5008 if (!s.second.empty()) {
5009 size_t siz = s.second.size() + 1U;
5010 pair->filePathName = new char[siz];
5011#ifndef _MSC_VER
5012 strncpy(pair->filePathName, s.second.c_str(), siz);
5013#else // _MSC_VER
5014 strncpy_s(pair->filePathName, siz, s.second.c_str(), siz);
5015#endif // _MSC_VER
5016 pair->filePathName[siz - 1U] = '\0';
5017 }
5018 }
5019
5020 return res;
5021 }
5022 }
5023
5024 return res;
5025}
5026
5027IGFD_C_API char* IGFD_GetFilePathName(ImGuiFileDialog* vContextPtr, IGFD_ResultMode vMode) {
5028 char* res = nullptr;

Callers

nothing calls this directly

Calls 3

GetSelectionMethod · 0.80
emptyMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected