From e00032ba6a2ddd4c08ae6f03b1982d3c099d288e Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 4 Feb 2022 09:13:52 +0000 Subject: add toId/fromId to tidy up some ugly casting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I70f34ac5e9b5d2f2d6c0375e823908eaa2e540b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129487 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- include/vcl/weld.hxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/vcl') diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 4190072690b7..d02f5b43c086 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -642,6 +642,16 @@ public: void connect_jump_page(const Link& rLink) { m_aJumpPageHdl = rLink; } }; +inline OUString toId(const void* pValue) +{ + return OUString::number(reinterpret_cast(pValue)); +} + +template T fromId(const OUString& rValue) +{ + return reinterpret_cast(rValue.toUInt64()); +} + struct VCL_DLLPUBLIC ComboBoxEntry { OUString sString; -- cgit