From 8064fe35639f62f8b036f4a091e7bbc302c6524e Mon Sep 17 00:00:00 2001 From: Hugo Amiard Date: Fri, 17 Jun 2022 12:12:38 +0200 Subject: [PATCH] ImGuiIntegration: Add conversion between ImStrv and StringView --- src/Magnum/ImGuiIntegration/Integration.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Magnum/ImGuiIntegration/Integration.h b/src/Magnum/ImGuiIntegration/Integration.h index db0795b3..f7e9de32 100644 --- a/src/Magnum/ImGuiIntegration/Integration.h +++ b/src/Magnum/ImGuiIntegration/Integration.h @@ -57,9 +57,23 @@ Example usage: #include "Magnum/ImGuiIntegration/visibility.h" /* defines IMGUI_API */ #include +#include #include #include +#ifndef DOXYGEN_GENERATING_OUTPUT +namespace Corrade { namespace Containers { namespace Implementation { + +template <> struct StringViewConverter { + static StringView from(const ImStrv& other) { + return StringView{other.Begin, other.length()}; + } + static ImStrv to(StringView other) { return ImStrv{other.begin(), other.end()}; } +}; + +}}} +#endif + /* Don't list (useless) Magnum and Math namespaces without anything else */ #ifndef DOXYGEN_GENERATING_OUTPUT namespace Magnum { namespace Math { namespace Implementation {