const TCHAR * DataFieldFileReader::GetItem(unsigned index) const { EnsureLoadedDeconst(); return files[index].path; }
const TCHAR * DataFieldFileReader::getItem(unsigned index) const { EnsureLoadedDeconst(); return files[index].mTextPathFile; }
unsigned DataFieldFileReader::size() const { EnsureLoadedDeconst(); return files.size(); }
int DataFieldFileReader::GetNumFiles(void) const { EnsureLoadedDeconst(); return files.size(); }
unsigned FileDataField::GetNumFiles() const { EnsureLoadedDeconst(); return files.size(); }
int DataFieldFileReader::GetAsInteger() const { if (!postponed_value.empty()) EnsureLoadedDeconst(); return mValue; }
int FileDataField::GetAsInteger() const { if (!postponed_value.empty()) EnsureLoadedDeconst(); return current_index; }
ComboList * DataFieldFileReader::CreateComboList() const { /* sorry for the const_cast .. this method keeps the promise of not modifying the object, given that one does not count filling the (cached) file list as "modification" */ EnsureLoadedDeconst(); ComboList *cl = new ComboList(); TCHAR buffer[MAX_PATH]; for (unsigned i = 0; i < files.size(); i++) { const TCHAR *path = files[i].mTextFile; if (path == NULL) path = _T(""); /* is a file with the same base name present in another data directory? */ bool found = false; for (unsigned j = 1; j < files.size(); j++) { if (j != i && _tcscmp(path, files[j].mTextFile) == 0) { found = true; break; } } if (found) { /* yes - append the absolute path to allow the user to see the difference */ _tcscpy(buffer, path); _tcscat(buffer, _T(" (")); _tcscat(buffer, files[i].mTextPathFile); _tcscat(buffer, _T(")")); path = buffer; } cl->Append(i, path); if (i == mValue) { cl->ComboPopupItemSavedIndex = i; } } return cl; }
ComboList FileDataField::CreateComboList(const TCHAR *reference) const { /* sorry for the const_cast .. this method keeps the promise of not modifying the object, given that one does not count filling the (cached) file list as "modification" */ EnsureLoadedDeconst(); ComboList combo_list; TCHAR buffer[MAX_PATH]; for (unsigned i = 0; i < files.size(); i++) { const TCHAR *path = files[i].filename; assert(path != nullptr); /* is a file with the same base name present in another data directory? */ bool found = false; for (unsigned j = 1; j < files.size(); j++) { if (j != i && StringIsEqual(path, files[j].filename)) { found = true; break; } } if (found) { /* yes - append the absolute path to allow the user to see the difference */ _tcscpy(buffer, path); _tcscat(buffer, _T(" (")); _tcscat(buffer, files[i].path); _tcscat(buffer, _T(")")); path = buffer; } combo_list.Append(i, path); } combo_list.current_index = current_index; return combo_list; }