Archived
1
0
This repository has been archived on 2024-10-17. You can view files and clone it, but cannot push or open issues or pull requests.
winamp/Src/Wasabi/api/service/svcs/svc_redir.h

64 lines
1.4 KiB
C
Raw Normal View History

2024-09-24 12:54:57 +00:00
#ifndef _SVC_REDIR_H
#define _SVC_REDIR_H
#include <bfc/dispatch.h>
#include <api/service/services.h>
/* Domains:
"Filename"
"Url"
*/
// if you want to redirect a string easily, look at RedirString in
// bfc/util/redirstr.h
class svc_redirect : public Dispatchable
{
public:
static FOURCC getServiceType() { return WaSvc::REDIRECT; }
int isMine(const wchar_t *str, const wchar_t *domain);
int redirect(const wchar_t *orig_str, const wchar_t *domain, wchar_t *buf, int buflen);
protected:
enum {
ISMINE=100,
REDIRECT=200,
};
};
inline int svc_redirect::isMine(const wchar_t *str, const wchar_t *domain) {
return _call(ISMINE, 0, str, domain);
}
inline int svc_redirect::redirect(const wchar_t *orig_str, const wchar_t *domain, wchar_t *buf, int buflen) {
return _call(REDIRECT, 0, orig_str, domain, buf, buflen);
}
class svc_redirectI : public svc_redirect {
public:
virtual int isMine(const wchar_t *str, const wchar_t *domain)=0;
virtual int redirect(const wchar_t *orig_str, const wchar_t *domain, wchar_t *buf, int buflen)=0;
protected:
RECVS_DISPATCH;
};
#include <api/service/svc_enum.h>
class RedirectEnum : public SvcEnumT<svc_redirect> {
public:
RedirectEnum(const wchar_t *filename, const wchar_t *domain=L"Filename") :
fn(filename), dom(domain) {
}
virtual int testService(svc_redirect *svc) {
if (svc->isMine(fn, dom)) return 1;
return 0;
}
private:
const wchar_t *fn, *dom;
};
#endif