1
0

svccache.cpp 998 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <precomp.h>
  2. #include "svccache.h"
  3. #include <bfc/string/bfcstring.h>
  4. #if !defined(WASABI_API_SVC)
  5. #error no no
  6. #endif
  7. SvcCache::SvcCache(FOURCC type) {
  8. int p = 0;
  9. list.setAutoSort(FALSE);
  10. for (;;) {
  11. waServiceFactory *svc = WASABI_API_SVC->service_enumService(type, p++);
  12. if (svc == NULL) break;
  13. const wchar_t *teststr = svc->getTestString();
  14. if (teststr == NULL || *teststr == '\0') continue;
  15. //CUT DebugString("cachin %s\n", teststr);
  16. list.addItem(svc);
  17. }
  18. list.setAutoSort(TRUE);
  19. }
  20. waServiceFactory *SvcCache::findServiceFactory(const wchar_t *searchval) {
  21. return list.findItem(searchval);
  22. }
  23. int SvcCache::waServiceFactoryCompare::compareItem(waServiceFactory *p1, waServiceFactory* p2) {
  24. int r = WCSICMP(p1->getTestString(), p2->getTestString());
  25. if (r == 0) return CMP3(p1, p2);
  26. return r;
  27. }
  28. int SvcCache::waServiceFactoryCompare::compareAttrib(const wchar_t *attrib, waServiceFactory *item) {
  29. return WCSICMP(attrib, item->getTestString());
  30. }