UAS_List<UAS_String> UAS_String::splitFields (const char separator) const { UAS_List<UAS_String> rval; UAS_Pointer<UAS_String> cur; int start = 0; for (int i = 0; i < fStringRep->fDataSize; i ++) { if (fStringRep->fData[i] == separator) { cur = new UAS_String(&(fStringRep->fData[start]), i - start, UAS_OWNER); rval.insert_item(cur); start = i + 1; } } if (i != start) { cur = new UAS_String(&(fStringRep->fData[start]), i - start, UAS_OWNER); rval.insert_item(cur); } return rval; }
UAS_List<UAS_Common> MMDB_Library::children () { UAS_List<UAS_Common> theList; info_lib &il = *(mmdb().infolib()); for (long key = il.first (); key != 0; il.next(key)) { info_base *curBase = il(key); MMDB_BookCase *newEl = new MMDB_BookCase (mmdb (), curBase); theList.insert_item (newEl); } return theList; }
UAS_List<UAS_String> UAS_Factory::getRootLocators () { UAS_List<UAS_String> rval; if (gFactoryList == 0) return rval; UAS_PtrList<FactoryEntry>&theList = *gFactoryList; for (int i = 0; i < theList.numItems(); i ++) { UAS_List<UAS_String> cur = theList[i]->factory()->rootLocators(); for (unsigned int j = 0; j < cur.length(); j ++) { rval.insert_item (cur[j]); } } return rval; }
UAS_Pointer<UAS_SearchEngine> MMDB_Library::search_engine() { UAS_List<UAS_Common> bookcases = bookcaseList(); UAS_PtrList<const char> cList; unsigned int i; #ifdef DEBUG for (i = 0; i < bookcases.length(); i++) fprintf(stderr, "(DEBUG) bookcases %d=%s\n", i, (char*)bookcases[i]->id()); #endif UAS_List<UAS_String> strings; for (i = 0; i < bookcases.length(); i++) { UAS_Pointer<UAS_String> string = new UAS_String; strings.insert_item(string); } for (i = 0; i < bookcases.length(); i++) { UAS_Pointer<UAS_Common> infolib = bookcases[i]->parent(); UAS_String str = infolib->id(); str = str + "/" + bookcases[i]->id(); *(UAS_String *)strings[i] = str; cList.append((char*)(*(UAS_String *)strings[i])); } #ifdef DTSEARCH fSearchEngine = &(DtSR_SearchEngine::search_engine (&cList)); #else fSearchEngine = &(Fulcrum_SearchEngine::search_engine (&cList)); #endif return fSearchEngine; }