diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2020-12-19 15:51:12 +0000 | 
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2020-12-19 19:18:12 +0000 | 
| commit | b872786f56a64621589eab873dd7fa8d285d8c0e (patch) | |
| tree | 816d71826254184ca99445717ed474247af5aa86 | |
| parent | Constexpr typename helpers (diff) | |
| download | icespider-b872786f56a64621589eab873dd7fa8d285d8c0e.tar.bz2 icespider-b872786f56a64621589eab873dd7fa8d285d8c0e.tar.xz icespider-b872786f56a64621589eab873dd7fa8d285d8c0e.zip | |
Use constexpr TypeName to find interface property names
| -rw-r--r-- | icespider/core/core.cpp | 18 | ||||
| -rw-r--r-- | 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 <Ice/Communicator.h>  #include <c++11Helpers.h>  #include <filesystem> @@ -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<typename Interface>  		[[nodiscard]] auto  		getProxy() const  		{ -			return Ice::uncheckedCast<typename Interface::ProxyType>(getProxy(typeid(Interface).name())); +			return Ice::uncheckedCast<typename Interface::ProxyType>(getProxy(TypeName<Interface>::str()));  		}  		AllRoutes allRoutes; | 
