Skip to content

Commit

Permalink
ImGuiIntegration: Add conversion between ImStrv and StringView
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Amiard committed Jun 17, 2022
1 parent 5a6aa83 commit 8064fe3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Magnum/ImGuiIntegration/Integration.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,23 @@ Example usage:
#include "Magnum/ImGuiIntegration/visibility.h" /* defines IMGUI_API */

#include <imgui.h>
#include <Corrade/Containers/StringView.h>
#include <Magnum/Types.h>
#include <Magnum/Math/Vector.h>

#ifndef DOXYGEN_GENERATING_OUTPUT
namespace Corrade { namespace Containers { namespace Implementation {

template <> struct StringViewConverter<const char, ImStrv> {
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 {
Expand Down

0 comments on commit 8064fe3

Please sign in to comment.