From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/replicant/nswasabi/ServiceName.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Src/replicant/nswasabi/ServiceName.h (limited to 'Src/replicant/nswasabi/ServiceName.h') diff --git a/Src/replicant/nswasabi/ServiceName.h b/Src/replicant/nswasabi/ServiceName.h new file mode 100644 index 00000000..27b1cf2a --- /dev/null +++ b/Src/replicant/nswasabi/ServiceName.h @@ -0,0 +1,21 @@ +#pragma once +#include "../nx/nxstring.h" + +/* +this is a helper class to implement GetServiceName +just put WASABI_SERVICE_NAME("Your Service Name"); in the public section of your class declaration. +this implementation does leak memory, but I don't think it's that big of a deal (services can't be unloaded at run-time anyway) +if we ever implement the NXSTR() macro, we can eliminate this leak + +e.g. +class MyAPI : public api_whatever +{ +public: + WASABI_SERVICE_NAME("My API"); +}; + */ + +#define WASABI_SERVICE_NAME(x) static nx_string_t GetServiceName(){ static nx_string_t service_name=0; if (!service_name) NXStringCreateWithUTF8(&service_name, x); return NXStringRetain(service_name); } +#define WASABI_SERVICE_GUID(x) static GUID GetServiceGUID() { return x; } + + -- cgit