From b872786f56a64621589eab873dd7fa8d285d8c0e Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 19 Dec 2020 15:51:12 +0000 Subject: Use constexpr TypeName to find interface property names --- icespider/core/core.cpp | 18 ++---------------- icespider/core/core.h | 5 +++-- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/icespider/core/core.cpp b/icespider/core/core.cpp index 6bf8ad3..aa1f02a 100644 --- a/icespider/core/core.cpp +++ b/icespider/core/core.cpp @@ -125,23 +125,9 @@ namespace IceSpider { } Ice::ObjectPrxPtr - Core::getProxy(const char * type) const + Core::getProxy(const std::string_view type) const { - auto buf = demangle(type); - char * c = buf.get(); - int off = 0; - while (*c) { - if (*(c + 1) == ':' && *c == ':') { - *c = '.'; - off += 1; - } - else if (off) { - *c = *(c + off); - } - c += 1; - } - auto i = communicator->propertyToProxy(buf.get()); - return i; + return communicator->propertyToProxy(std::string {type}); } static bool diff --git a/icespider/core/core.h b/icespider/core/core.h index d60b20f..a77ce1a 100644 --- a/icespider/core/core.h +++ b/icespider/core/core.h @@ -2,6 +2,7 @@ #define ICESPIDER_CORE_CORE_H #include "irouteHandler.h" +#include "util.h" #include #include #include @@ -22,13 +23,13 @@ namespace IceSpider { void process(IHttpRequest *, const IRouteHandler * = nullptr) const; void handleError(IHttpRequest *, const std::exception &) const; - [[nodiscard]] Ice::ObjectPrxPtr getProxy(const char * type) const; + [[nodiscard]] Ice::ObjectPrxPtr getProxy(std::string_view type) const; template [[nodiscard]] auto getProxy() const { - return Ice::uncheckedCast(getProxy(typeid(Interface).name())); + return Ice::uncheckedCast(getProxy(TypeName::str())); } AllRoutes allRoutes; -- cgit v1.2.3