diff options
Diffstat (limited to 'Src/Wasabi/api/service/svccache.cpp')
-rw-r--r-- | Src/Wasabi/api/service/svccache.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Src/Wasabi/api/service/svccache.cpp b/Src/Wasabi/api/service/svccache.cpp new file mode 100644 index 00000000..af3e47cf --- /dev/null +++ b/Src/Wasabi/api/service/svccache.cpp @@ -0,0 +1,35 @@ +#include <precomp.h> +#include "svccache.h" +#include <bfc/string/bfcstring.h> + +#if !defined(WASABI_API_SVC) +#error no no +#endif + +SvcCache::SvcCache(FOURCC type) { + int p = 0; + list.setAutoSort(FALSE); + for (;;) { + waServiceFactory *svc = WASABI_API_SVC->service_enumService(type, p++); + if (svc == NULL) break; + const wchar_t *teststr = svc->getTestString(); + if (teststr == NULL || *teststr == '\0') continue; +//CUT DebugString("cachin %s\n", teststr); + list.addItem(svc); + } + list.setAutoSort(TRUE); +} + +waServiceFactory *SvcCache::findServiceFactory(const wchar_t *searchval) { + return list.findItem(searchval); +} + +int SvcCache::waServiceFactoryCompare::compareItem(waServiceFactory *p1, waServiceFactory* p2) { + int r = WCSICMP(p1->getTestString(), p2->getTestString()); + if (r == 0) return CMP3(p1, p2); + return r; +} + +int SvcCache::waServiceFactoryCompare::compareAttrib(const wchar_t *attrib, waServiceFactory *item) { + return WCSICMP(attrib, item->getTestString()); +} |