// Recursive routine to copy all groups and entries from one wxConfig object to another void CopyEntriesRecursive(wxString path, wxConfigBase *src, wxConfigBase *dst) { wxString entryName; long entryIndex; bool entryKeepGoing; entryKeepGoing = src->GetFirstEntry(entryName, entryIndex); while (entryKeepGoing) { CopyEntry(path, src, dst, entryName); entryKeepGoing = src->GetNextEntry(entryName, entryIndex); } wxString groupName; long groupIndex; bool groupKeepGoing; groupKeepGoing = src->GetFirstGroup(groupName, groupIndex); while (groupKeepGoing) { wxString subPath = path+groupName+wxT("/"); src->SetPath(subPath); CopyEntriesRecursive(subPath, src, dst); src->SetPath(path); groupKeepGoing = src->GetNextGroup(groupName, groupIndex); } }
// FindFirst / FindNext bool DOS_Drive_Cache::FindFirst(char* path, Bit16u& id) { Bit16u dirID; // Cache directory in if (!OpenDir(path,dirID)) return false; //Find a free slot. //If the next one isn't free, move on to the next, if none is free => reset and assume the worst Bit16u local_findcounter = 0; while ( local_findcounter < MAX_OPENDIRS ) { if (dirFindFirst[this->nextFreeFindFirst] == 0) break; if (++this->nextFreeFindFirst >= MAX_OPENDIRS) this->nextFreeFindFirst = 0; //Wrap around local_findcounter++; } Bit16u dirFindFirstID = this->nextFreeFindFirst++; if (this->nextFreeFindFirst >= MAX_OPENDIRS) this->nextFreeFindFirst = 0; //Increase and wrap around for the next search. if (local_findcounter == MAX_OPENDIRS) { //Here is the reset from above. // no free slot found... LOG(LOG_MISC,LOG_ERROR)("DIRCACHE: FindFirst/Next: All slots full. Resetting"); // Clear the internal list then. dirFindFirstID = 0; this->nextFreeFindFirst = 1; //the next free one after this search for(Bitu n=0; n<MAX_OPENDIRS;n++) { // Clear and reuse slot DeleteFileInfo(dirFindFirst[n]); dirFindFirst[n]=0; } } dirFindFirst[dirFindFirstID] = new CFileInfo(); dirFindFirst[dirFindFirstID]-> nextEntry = 0; // Copy entries to use with FindNext for (Bitu i=0; i<dirSearch[dirID]->fileList.size(); i++) { CopyEntry(dirFindFirst[dirFindFirstID],dirSearch[dirID]->fileList[i]); } // Now re-sort the fileList accordingly to output switch (sortDirType) { case ALPHABETICAL : break; // case ALPHABETICAL : std::sort(dirFindFirst[dirFindFirstID]->fileList.begin(), dirFindFirst[dirFindFirstID]->fileList.end(), SortByName); break; case DIRALPHABETICAL : std::sort(dirFindFirst[dirFindFirstID]->fileList.begin(), dirFindFirst[dirFindFirstID]->fileList.end(), SortByDirName); break; case ALPHABETICALREV : std::sort(dirFindFirst[dirFindFirstID]->fileList.begin(), dirFindFirst[dirFindFirstID]->fileList.end(), SortByNameRev); break; case DIRALPHABETICALREV : std::sort(dirFindFirst[dirFindFirstID]->fileList.begin(), dirFindFirst[dirFindFirstID]->fileList.end(), SortByDirNameRev); break; case NOSORT : break; } // LOG(LOG_MISC,LOG_ERROR)("DIRCACHE: FindFirst : %s (ID:%02X)",path,dirFindFirstID); id = dirFindFirstID; return true; }
GmUifRootEntry & GmUifRootEntry::operator = (const GmUifRootEntry &entry) { if (this == &entry) return *this; CopyEntry (entry); return *this; }
GmUifRootEntry::GmUifRootEntry (const GmUifRootEntry &entry) { CopyEntry (entry); }
GmDataSetEntry::GmDataSetEntry (const GmDataSetEntry & entry) { CopyEntry (entry); }