diff options
author | David Robillard <d@drobilla.net> | 2020-08-01 22:41:11 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-08-02 01:48:48 +0200 |
commit | c0f567d3232cbe165e56cb2684cda52df7cfb90f (patch) | |
tree | 3ffbe6df3f2056fd579a954e00f0bea49b47104e /ingen/Forge.hpp | |
parent | 9eadae8edc7a35f87499f58c3e3b9cec68f74a80 (diff) | |
download | ingen-c0f567d3232cbe165e56cb2684cda52df7cfb90f.tar.gz ingen-c0f567d3232cbe165e56cb2684cda52df7cfb90f.tar.bz2 ingen-c0f567d3232cbe165e56cb2684cda52df7cfb90f.zip |
Move public headers to a separate include directory
This is more conventional and probably best practice (since it avoids polluting
the include path with non-headers), and is supported by the clang-tidy
llvm-header-guard check.
Diffstat (limited to 'ingen/Forge.hpp')
-rw-r--r-- | ingen/Forge.hpp | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/ingen/Forge.hpp b/ingen/Forge.hpp deleted file mode 100644 index 10b4e622..00000000 --- a/ingen/Forge.hpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2017 David Robillard <http://drobilla.net/> - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef INGEN_FORGE_HPP -#define INGEN_FORGE_HPP - -#include "ingen/Atom.hpp" -#include "ingen/ingen.h" -#include "lv2/atom/forge.h" - -#include <cstdint> -#include <cstring> -#include <string> - -namespace ingen { - -class URIMap; -class URI; - -/** Forge for Atoms. - * @ingroup IngenShared - */ -class INGEN_API Forge : public LV2_Atom_Forge { -public: - explicit Forge(URIMap& map); - - std::string str(const Atom& atom, bool quoted); - - bool is_uri(const Atom& atom) const { - return atom.type() == URI || atom.type() == URID; - } - - static Atom make() { return Atom(); } - Atom make(int32_t v) { return Atom(sizeof(v), Int, &v); } - Atom make(float v) { return Atom(sizeof(v), Float, &v); } - Atom make(bool v) { - const int32_t iv = v ? 1 : 0; - return Atom(sizeof(int32_t), Bool, &iv); - } - - Atom make_urid(int32_t v) { return Atom(sizeof(int32_t), URID, &v); } - - Atom make_urid(const ingen::URI& u); - - static Atom alloc(uint32_t size, uint32_t type, const void* val) { - return Atom(size, type, val); - } - - Atom alloc(const char* v) { - const size_t len = strlen(v); - return Atom(len + 1, String, v); - } - - Atom alloc(const std::string& v) { - 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_uri(const std::string& v) { - return Atom(v.length() + 1, URI, v.c_str()); - } - -private: - URIMap& _map; -}; - -} // namespace ingen - -#endif // INGEN_FORGE_HPP |