aboutsummaryrefslogtreecommitdiff
path: root/Src/replicant/nswasabi/ServiceName.h
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/replicant/nswasabi/ServiceName.h
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/replicant/nswasabi/ServiceName.h')
-rw-r--r--Src/replicant/nswasabi/ServiceName.h21
1 files changed, 21 insertions, 0 deletions
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; }
+
+