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/svcenumt.h | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/Wasabi/api/service/svcenumt.h')
-rw-r--r-- | Src/Wasabi/api/service/svcenumt.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Src/Wasabi/api/service/svcenumt.h b/Src/Wasabi/api/service/svcenumt.h new file mode 100644 index 00000000..e423b542 --- /dev/null +++ b/Src/Wasabi/api/service/svcenumt.h @@ -0,0 +1,30 @@ +#ifndef _SVCENUMT_H +#define _SVCENUMT_H + +#include "svcenum.h" + +template <class T> +class SvcEnumT : private SvcEnum { +protected: + SvcEnumT() { type = T::getServiceType(); } + +public: + void reset() { SvcEnum::reset(); } + T *getFirst(int global_lock = TRUE) { reset(); return getNext(global_lock); } + T *getNext(int global_lock = TRUE) { return static_cast<T*>(_getNext(global_lock)); } + + // these would just be 'using' but msvc.net sucks butt + inline int release(void *ptr) { return SvcEnum::release(ptr); } + inline waServiceFactory *getLastFactory() { return SvcEnum::getLastFactory(); } + +protected: + // override this one (or don't if you want to return all of them) + virtual int testService(T *svc) { return TRUE; } + +private: + virtual int _testService(void *svc) { + return testService(static_cast<T *>(svc)); + } +}; + +#endif // _SVCENUMT_H |