diff options
author | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
---|---|---|
committer | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
commit | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/api/service/svcenum.cpp | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/Wasabi/api/service/svcenum.cpp')
-rw-r--r-- | Src/Wasabi/api/service/svcenum.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Src/Wasabi/api/service/svcenum.cpp b/Src/Wasabi/api/service/svcenum.cpp new file mode 100644 index 00000000..f9219654 --- /dev/null +++ b/Src/Wasabi/api/service/svcenum.cpp @@ -0,0 +1,45 @@ +#include <precomp.h> + +//<?#include "<class data="implementationheader"/>" +#include "svcenum.h" +//?> + + +#include <api/service/services.h> +#include <api/service/waservicefactory.h> +#include <bfc/bfc_assert.h> + +SvcEnum::SvcEnum() : type(WaSvc::NONE), factory(NULL) { + reset(); +} + +void *SvcEnum::_getNext(int global_lock) { + if (WASABI_API_SVC == NULL) return NULL; + for (;;) { + factory = WASABI_API_SVC->service_enumService(type, pos++); + if (factory == NULL) return NULL; + void *s = factory->getInterface(FALSE);// get but don't lock + if (s) + { + if (_testService(s)) { + if (global_lock) + WASABI_API_SVC->service_lock(factory, s); // lock in sys tables + return s; + } + factory->releaseInterface(s); + } + } +} + +void SvcEnum::reset() { + pos = 0; + factory = NULL; +} + +int SvcEnum::release(void *ptr) { + return WASABI_API_SVC->service_release(ptr); +} + +waServiceFactory *SvcEnum::getLastFactory() { + return factory; +} |