From 3c0ed6b66b6e99c68fc01c86b5796a55d74a5977 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 9 Mar 2019 17:44:36 +0100 Subject: WIP: Port to serd1 --- ingen/Forge.hpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'ingen/Forge.hpp') diff --git a/ingen/Forge.hpp b/ingen/Forge.hpp index b414a6ab..53cae153 100644 --- a/ingen/Forge.hpp +++ b/ingen/Forge.hpp @@ -19,7 +19,9 @@ #include "ingen/Atom.hpp" #include "ingen/ingen.h" +#include "lv2/atom/atom.h" #include "lv2/atom/forge.h" +#include "serd/serd.hpp" #include #include @@ -59,8 +61,12 @@ public: return Atom(size, type, val); } + Atom alloc(const LV2_Atom* atom) { + return Atom(atom->size, atom->type, LV2_ATOM_BODY_CONST(atom)); + } + Atom alloc(const char* v) { - const size_t len = strlen(v); + const auto len = strlen(v); return Atom(len + 1, String, v); } @@ -68,12 +74,11 @@ public: return Atom(v.length() + 1, String, v.c_str()); } - Atom alloc_uri(const char* v) { - const size_t len = strlen(v); - return Atom(len + 1, URI, v); + Atom alloc(serd::StringView v) { + return Atom(v.length() + 1, String, v.c_str()); } - Atom alloc_uri(const std::string& v) { + Atom alloc_uri(serd::StringView v) { return Atom(v.length() + 1, URI, v.c_str()); } -- cgit v1.2.1