diff options
Diffstat (limited to 'include')
49 files changed, 253 insertions, 314 deletions
diff --git a/include/ingen/Arc.hpp b/include/ingen/Arc.hpp index b254e3f3..d456edfb 100644 --- a/include/ingen/Arc.hpp +++ b/include/ingen/Arc.hpp @@ -17,8 +17,8 @@ #ifndef INGEN_ARC_HPP #define INGEN_ARC_HPP -#include "ingen/ingen.h" -#include "raul/Deletable.hpp" +#include <ingen/ingen.h> +#include <raul/Deletable.hpp> namespace raul { class Path; diff --git a/include/ingen/Atom.hpp b/include/ingen/Atom.hpp index 0c4ac8c5..8d9cbe7f 100644 --- a/include/ingen/Atom.hpp +++ b/include/ingen/Atom.hpp @@ -17,9 +17,9 @@ #ifndef INGEN_ATOM_HPP #define INGEN_ATOM_HPP -#include "ingen/ingen.h" -#include "lv2/atom/atom.h" -#include "lv2/urid/urid.h" +#include <ingen/ingen.h> +#include <lv2/atom/atom.h> +#include <lv2/urid/urid.h> #include <algorithm> #include <cassert> diff --git a/include/ingen/AtomForge.hpp b/include/ingen/AtomForge.hpp index cf5a759d..5d696923 100644 --- a/include/ingen/AtomForge.hpp +++ b/include/ingen/AtomForge.hpp @@ -17,55 +17,41 @@ #ifndef INGEN_ATOMFORGE_HPP #define INGEN_ATOMFORGE_HPP -#include "ingen/memory.hpp" -#include "lv2/atom/atom.h" -#include "lv2/atom/forge.h" -#include "lv2/atom/util.h" -#include "lv2/urid/urid.h" -#include "sord/sord.h" -#include "sord/sordmm.hpp" -#include "sratom/sratom.h" - -#include <cassert> +#include <ingen/ingen.h> +#include <ingen/memory.hpp> +#include <lv2/atom/atom.h> +#include <lv2/atom/forge.h> +#include <lv2/urid/urid.h> +#include <sord/sord.h> +#include <sratom/sratom.h> + #include <cstdint> #include <cstdlib> -#include <cstring> #include <memory> +namespace Sord { +class World; +} // namespace Sord + namespace ingen { /// An atom forge that writes to an automatically-resized memory buffer -class AtomForge : public LV2_Atom_Forge +class INGEN_API AtomForge : public LV2_Atom_Forge { public: - explicit AtomForge(LV2_URID_Map& map) - : LV2_Atom_Forge{} - , _sratom{sratom_new(&map)} - , _buf{static_cast<LV2_Atom*>(calloc(8, sizeof(LV2_Atom)))} - { - lv2_atom_forge_init(this, &map); - lv2_atom_forge_set_sink(this, c_append, c_deref, this); - } + explicit AtomForge(LV2_URID_Map& map); /// Forge an atom from `node` in `model` - void read(Sord::World& world, SordModel* model, const SordNode* node) - { - sratom_read(_sratom.get(), this, world.c_obj(), model, node); - } + void read(Sord::World& world, SordModel* model, const SordNode* node); /// Return the top-level atom that has been forged - const LV2_Atom* atom() const { return _buf.get(); } + const LV2_Atom* atom() const; /// Clear the atom buffer and reset the forge - void clear() - { - lv2_atom_forge_set_sink(this, c_append, c_deref, this); - _size = 0; - *_buf = {0U, 0U}; - } + void clear(); /// Return the internal atom serialiser - Sratom& sratom() { return *_sratom; } + Sratom& sratom(); private: struct SratomDeleter { void operator()(Sratom* s) { sratom_free(s); } }; @@ -74,46 +60,16 @@ private: using SratomPtr = std::unique_ptr<Sratom, SratomDeleter>; /// Append some data and return a reference to its start - intptr_t append(const void* data, uint32_t len) { - // Record offset of the start of this write (+1 to avoid null) - const auto ref = static_cast<intptr_t>(_size + 1U); - - // Update size and reallocate if necessary - if (lv2_atom_pad_size(_size + len) > _capacity) { - _capacity = lv2_atom_pad_size(_size + len); - - _buf = AtomPtr{static_cast<LV2_Atom*>( - realloc(_buf.release(), _capacity)), - FreeDeleter<LV2_Atom>{}}; - } - - // Append new data - memcpy(reinterpret_cast<uint8_t*>(_buf.get()) + _size, data, len); - _size += len; - return ref; - } + intptr_t append(const void* data, uint32_t len); /// Dereference a reference previously returned by append() - LV2_Atom* deref(intptr_t ref) { - /* Make some assumptions and do unnecessary math to appease - -Wcast-align. This is questionable at best, though the forge should - only dereference references to aligned atoms. */ - assert((ref - 1) % sizeof(LV2_Atom) == 0); - return static_cast<LV2_Atom*>(_buf.get() + (ref - 1) / sizeof(LV2_Atom)); - - // Alternatively: - // return (LV2_Atom*)((uint8_t*)_buf + ref - 1); - } + LV2_Atom* deref(intptr_t ref); static LV2_Atom_Forge_Ref - c_append(void* self, const void* data, uint32_t len) { - return static_cast<AtomForge*>(self)->append(data, len); - } + c_append(void* self, const void* data, uint32_t len); static LV2_Atom* - c_deref(void* self, LV2_Atom_Forge_Ref ref) { - return static_cast<AtomForge*>(self)->deref(ref); - } + c_deref(void* self, LV2_Atom_Forge_Ref ref); size_t _size{0}; ///< Current atom size size_t _capacity{8 * sizeof(LV2_Atom)}; ///< Allocated size of buffer diff --git a/include/ingen/AtomReader.hpp b/include/ingen/AtomReader.hpp index 6e5d83fd..b0fe5906 100644 --- a/include/ingen/AtomReader.hpp +++ b/include/ingen/AtomReader.hpp @@ -17,10 +17,10 @@ #ifndef INGEN_ATOMREADER_HPP #define INGEN_ATOMREADER_HPP -#include "ingen/AtomSink.hpp" -#include "ingen/Resource.hpp" -#include "ingen/ingen.h" -#include "lv2/atom/atom.h" +#include <ingen/AtomSink.hpp> +#include <ingen/Resource.hpp> +#include <ingen/ingen.h> +#include <lv2/atom/atom.h> #include <cstdint> #include <optional> diff --git a/include/ingen/AtomSink.hpp b/include/ingen/AtomSink.hpp index abe1c196..4c759695 100644 --- a/include/ingen/AtomSink.hpp +++ b/include/ingen/AtomSink.hpp @@ -17,8 +17,8 @@ #ifndef INGEN_ATOMSINK_HPP #define INGEN_ATOMSINK_HPP -#include "ingen/ingen.h" -#include "lv2/atom/atom.h" +#include <ingen/ingen.h> +#include <lv2/atom/atom.h> #include <cstdint> diff --git a/include/ingen/AtomWriter.hpp b/include/ingen/AtomWriter.hpp index 43ee08b1..e391870d 100644 --- a/include/ingen/AtomWriter.hpp +++ b/include/ingen/AtomWriter.hpp @@ -17,15 +17,15 @@ #ifndef INGEN_ATOMWRITER_HPP #define INGEN_ATOMWRITER_HPP -#include "ingen/AtomForge.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Message.hpp" -#include "ingen/Properties.hpp" -#include "ingen/Resource.hpp" -#include "ingen/URI.hpp" -#include "ingen/ingen.h" -#include "lv2/atom/forge.h" -#include "lv2/urid/urid.h" +#include <ingen/AtomForge.hpp> +#include <ingen/Interface.hpp> +#include <ingen/Message.hpp> +#include <ingen/Properties.hpp> +#include <ingen/Resource.hpp> +#include <ingen/URI.hpp> +#include <ingen/ingen.h> +#include <lv2/atom/forge.h> +#include <lv2/urid/urid.h> #include <cstdint> diff --git a/include/ingen/ClashAvoider.hpp b/include/ingen/ClashAvoider.hpp index c1d62754..bf6533ae 100644 --- a/include/ingen/ClashAvoider.hpp +++ b/include/ingen/ClashAvoider.hpp @@ -17,8 +17,8 @@ #ifndef INGEN_CLASHAVOIDER_HPP #define INGEN_CLASHAVOIDER_HPP -#include "ingen/ingen.h" -#include "raul/Path.hpp" +#include <ingen/ingen.h> +#include <raul/Path.hpp> #include <map> #include <string> @@ -48,9 +48,9 @@ public: * @param new_path The new path that `old_path` was mapped to * @param name The old name. */ - static std::string adjust_name(const raul::Path& old_path, - const raul::Path& new_path, - std::string name); + static std::string adjust_name(const raul::Path& old_path, + const raul::Path& new_path, + const std::string& name); private: using Offsets = std::map<raul::Path, unsigned>; diff --git a/include/ingen/Clock.hpp b/include/ingen/Clock.hpp index 75575aa5..9e20a031 100644 --- a/include/ingen/Clock.hpp +++ b/include/ingen/Clock.hpp @@ -37,7 +37,7 @@ public: uint64_t now_microseconds() const { const uint64_t now = mach_absolute_time(); - return now * _timebase.numer / _timebase.denom / 1e3; + return now * _timebase.numer / _timebase.denom / 1000U; } private: @@ -48,8 +48,8 @@ private: uint64_t now_microseconds() const { struct timespec time{}; clock_gettime(_clock, &time); - return static_cast<uint64_t>(time.tv_sec) * 1000000U + - static_cast<uint64_t>(time.tv_nsec) / 100U; + return (static_cast<uint64_t>(time.tv_sec) * 1000000U) + + (static_cast<uint64_t>(time.tv_nsec) / 1000U); } private: diff --git a/include/ingen/ColorContext.hpp b/include/ingen/ColorContext.hpp index c1486b5c..666a044e 100644 --- a/include/ingen/ColorContext.hpp +++ b/include/ingen/ColorContext.hpp @@ -17,7 +17,7 @@ #ifndef INGEN_COLORCONTEXT_HPP #define INGEN_COLORCONTEXT_HPP -#include "ingen/ingen.h" +#include <ingen/ingen.h> #include <cstdio> diff --git a/include/ingen/Configuration.hpp b/include/ingen/Configuration.hpp index ba68950c..5c4d2841 100644 --- a/include/ingen/Configuration.hpp +++ b/include/ingen/Configuration.hpp @@ -17,11 +17,11 @@ #ifndef INGEN_CONFIGURATION_HPP #define INGEN_CONFIGURATION_HPP -#include "ingen/Atom.hpp" -#include "ingen/FilePath.hpp" -#include "ingen/ingen.h" -#include "lv2/urid/urid.h" -#include "raul/Exception.hpp" +#include <ingen/Atom.hpp> +#include <ingen/FilePath.hpp> +#include <ingen/ingen.h> +#include <lv2/urid/urid.h> +#include <raul/Exception.hpp> #include <cstdio> #include <list> @@ -82,7 +82,7 @@ public: /** Parse a command line. * - * @throw OptionError + * @throw OptionError An option is unknown or an option value is invalid. */ void parse(int argc, char **argv); diff --git a/include/ingen/DataAccess.hpp b/include/ingen/DataAccess.hpp index 59bd80f9..c18c74f3 100644 --- a/include/ingen/DataAccess.hpp +++ b/include/ingen/DataAccess.hpp @@ -17,13 +17,13 @@ #ifndef INGEN_DATAACCESS_HPP #define INGEN_DATAACCESS_HPP -#include "ingen/LV2Features.hpp" -#include "ingen/Node.hpp" -#include "ingen/Store.hpp" -#include "ingen/World.hpp" -#include "lilv/lilv.h" -#include "lv2/core/lv2.h" -#include "lv2/data-access/data-access.h" +#include <ingen/LV2Features.hpp> +#include <ingen/Node.hpp> +#include <ingen/Store.hpp> +#include <ingen/World.hpp> +#include <lilv/lilv.h> +#include <lv2/core/lv2.h> +#include <lv2/data-access/data-access.h> #include <cstdlib> #include <memory> diff --git a/include/ingen/EngineBase.hpp b/include/ingen/EngineBase.hpp index 1b6b105a..35115ad4 100644 --- a/include/ingen/EngineBase.hpp +++ b/include/ingen/EngineBase.hpp @@ -17,7 +17,7 @@ #ifndef INGEN_ENGINEBASE_HPP #define INGEN_ENGINEBASE_HPP -#include "ingen/ingen.h" +#include <ingen/ingen.h> #include <chrono> #include <cstddef> @@ -46,7 +46,7 @@ public: */ virtual void init(double sample_rate, uint32_t block_length, - size_t seq_size) = 0; + uint32_t seq_size) = 0; /** Return true iff the engine and driver supports dynamic ports. diff --git a/include/ingen/Forge.hpp b/include/ingen/Forge.hpp index fdd53276..dd7ec130 100644 --- a/include/ingen/Forge.hpp +++ b/include/ingen/Forge.hpp @@ -17,9 +17,9 @@ #ifndef INGEN_FORGE_HPP #define INGEN_FORGE_HPP -#include "ingen/Atom.hpp" -#include "ingen/ingen.h" -#include "lv2/atom/forge.h" +#include <ingen/Atom.hpp> +#include <ingen/ingen.h> +#include <lv2/atom/forge.h> #include <cstdint> #include <cstring> diff --git a/include/ingen/InstanceAccess.hpp b/include/ingen/InstanceAccess.hpp index b3fcff35..66a2b5c3 100644 --- a/include/ingen/InstanceAccess.hpp +++ b/include/ingen/InstanceAccess.hpp @@ -17,12 +17,12 @@ #ifndef INGEN_INSTANCEACCESS_HPP #define INGEN_INSTANCEACCESS_HPP -#include "ingen/LV2Features.hpp" -#include "ingen/Node.hpp" -#include "ingen/Store.hpp" -#include "ingen/World.hpp" -#include "lilv/lilv.h" -#include "lv2/core/lv2.h" +#include <ingen/LV2Features.hpp> +#include <ingen/Node.hpp> +#include <ingen/Store.hpp> +#include <ingen/World.hpp> +#include <lilv/lilv.h> +#include <lv2/core/lv2.h> #include <memory> diff --git a/include/ingen/Interface.hpp b/include/ingen/Interface.hpp index 79cfad63..329dab2c 100644 --- a/include/ingen/Interface.hpp +++ b/include/ingen/Interface.hpp @@ -21,11 +21,11 @@ #ifndef INGEN_INTERFACE_HPP #define INGEN_INTERFACE_HPP -#include "ingen/Message.hpp" -#include "ingen/Properties.hpp" -#include "ingen/Resource.hpp" -#include "ingen/Status.hpp" -#include "ingen/ingen.h" +#include <ingen/Message.hpp> +#include <ingen/Properties.hpp> +#include <ingen/Resource.hpp> +#include <ingen/Status.hpp> +#include <ingen/ingen.h> #include <cstdint> #include <memory> diff --git a/include/ingen/LV2Features.hpp b/include/ingen/LV2Features.hpp index 5726feb9..41bdf848 100644 --- a/include/ingen/LV2Features.hpp +++ b/include/ingen/LV2Features.hpp @@ -17,9 +17,9 @@ #ifndef INGEN_LV2FEATURES_HPP #define INGEN_LV2FEATURES_HPP -#include "ingen/ingen.h" -#include "lv2/core/lv2.h" -#include "raul/Noncopyable.hpp" +#include <ingen/ingen.h> +#include <lv2/core/lv2.h> +#include <raul/Noncopyable.hpp> #include <memory> #include <string> diff --git a/include/ingen/Library.hpp b/include/ingen/Library.hpp index 4cee985f..99dfff4c 100644 --- a/include/ingen/Library.hpp +++ b/include/ingen/Library.hpp @@ -17,8 +17,8 @@ #ifndef INGEN_LIBRARY_HPP #define INGEN_LIBRARY_HPP -#include "ingen/FilePath.hpp" -#include "ingen/ingen.h" +#include <ingen/FilePath.hpp> +#include <ingen/ingen.h> namespace ingen { @@ -26,7 +26,7 @@ namespace ingen { class INGEN_API Library { public: - Library(const FilePath& path); + explicit Library(const FilePath& path); ~Library(); Library(const Library&) = delete; @@ -40,7 +40,7 @@ public: static const char* get_last_error(); - operator bool() const { return _lib; } + explicit operator bool() const { return _lib; } private: void* _lib; diff --git a/include/ingen/Log.hpp b/include/ingen/Log.hpp index 8d1b420c..afde276a 100644 --- a/include/ingen/Log.hpp +++ b/include/ingen/Log.hpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2016 David Robillard <http://drobilla.net/> + Copyright 2007-2024 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 @@ -17,17 +17,15 @@ #ifndef INGEN_LOG_HPP #define INGEN_LOG_HPP -#include "ingen/LV2Features.hpp" -#include "ingen/fmt.hpp" // IWYU pragma: export -#include "ingen/ingen.h" -#include "lv2/core/lv2.h" -#include "lv2/log/log.h" -#include "lv2/urid/urid.h" +#include <ingen/LV2Features.hpp> +#include <ingen/fmt.hpp> +#include <ingen/ingen.h> +#include <lv2/core/lv2.h> +#include <lv2/log/log.h> +#include <lv2/urid/urid.h> #include <cstdarg> -#include <cstdio> #include <functional> -#include <memory> #include <string> #include <utility> @@ -35,7 +33,6 @@ namespace ingen { class Node; class URIs; -class World; class INGEN_API Log { @@ -89,14 +86,13 @@ public: } int vtprintf(LV2_URID type, const char* fmt, va_list args); + int tprintf(LV2_URID type, const char* fmt, ...); void set_flush(bool f) { _flush = f; } void set_trace(bool f) { _trace = f; } void set_sink(Sink s) { _sink = std::move(s); } private: - void print(FILE* stream, const std::string& msg) const; - LV2_Log_Log* _log; URIs& _uris; Sink _sink; diff --git a/include/ingen/Message.hpp b/include/ingen/Message.hpp index de62f459..be0b5d00 100644 --- a/include/ingen/Message.hpp +++ b/include/ingen/Message.hpp @@ -17,12 +17,12 @@ #ifndef INGEN_MESSAGE_HPP #define INGEN_MESSAGE_HPP -#include "ingen/Atom.hpp" -#include "ingen/Properties.hpp" -#include "ingen/Resource.hpp" -#include "ingen/Status.hpp" -#include "ingen/URI.hpp" -#include "raul/Path.hpp" +#include <ingen/Atom.hpp> +#include <ingen/Properties.hpp> +#include <ingen/Resource.hpp> +#include <ingen/Status.hpp> +#include <ingen/URI.hpp> +#include <raul/Path.hpp> #include <cstdint> #include <string> diff --git a/include/ingen/Module.hpp b/include/ingen/Module.hpp index 90f2f930..1a12a036 100644 --- a/include/ingen/Module.hpp +++ b/include/ingen/Module.hpp @@ -17,8 +17,8 @@ #ifndef INGEN_MODULE_HPP #define INGEN_MODULE_HPP -#include "ingen/Library.hpp" -#include "ingen/ingen.h" +#include <ingen/Library.hpp> +#include <ingen/ingen.h> #include <memory> @@ -46,8 +46,8 @@ public: /** Library implementing this module. * - * This is managed by the World and not this class, since closing the library - * in this destructor could possibly reference code from the library + * This is managed by the World and not this class, since closing the + * library in this destructor could possibly reference code from the library * afterwards and cause a segfault on exit. */ std::unique_ptr<Library> library; diff --git a/include/ingen/Node.hpp b/include/ingen/Node.hpp index 3e07df2f..2370cfe7 100644 --- a/include/ingen/Node.hpp +++ b/include/ingen/Node.hpp @@ -17,11 +17,11 @@ #ifndef INGEN_NODE_HPP #define INGEN_NODE_HPP -#include "ingen/Resource.hpp" -#include "ingen/URI.hpp" -#include "ingen/ingen.h" -#include "ingen/paths.hpp" -#include "lilv/lilv.h" +#include <ingen/Resource.hpp> +#include <ingen/URI.hpp> +#include <ingen/ingen.h> +#include <ingen/paths.hpp> +#include <lilv/lilv.h> #include <cstdint> #include <filesystem> diff --git a/include/ingen/Parser.hpp b/include/ingen/Parser.hpp index 16ee4070..8db64104 100644 --- a/include/ingen/Parser.hpp +++ b/include/ingen/Parser.hpp @@ -17,12 +17,12 @@ #ifndef INGEN_PARSER_HPP #define INGEN_PARSER_HPP -#include "ingen/FilePath.hpp" -#include "ingen/Properties.hpp" // IWYU pragma: keep -#include "ingen/URI.hpp" -#include "ingen/ingen.h" -#include "raul/Path.hpp" // IWYU pragma: keep -#include "raul/Symbol.hpp" // IWYU pragma: keep +#include <ingen/FilePath.hpp> +#include <ingen/Properties.hpp> +#include <ingen/URI.hpp> +#include <ingen/ingen.h> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> #include <optional> #include <set> diff --git a/include/ingen/Properties.hpp b/include/ingen/Properties.hpp index 9151372b..5f953902 100644 --- a/include/ingen/Properties.hpp +++ b/include/ingen/Properties.hpp @@ -17,9 +17,9 @@ #ifndef INGEN_PROPERTIES_HPP #define INGEN_PROPERTIES_HPP -#include "ingen/Atom.hpp" -#include "ingen/URI.hpp" -#include "ingen/URIs.hpp" +#include <ingen/Atom.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> #include <initializer_list> #include <map> diff --git a/include/ingen/QueuedInterface.hpp b/include/ingen/QueuedInterface.hpp index 4bb6baea..ab2c2532 100644 --- a/include/ingen/QueuedInterface.hpp +++ b/include/ingen/QueuedInterface.hpp @@ -17,9 +17,9 @@ #ifndef INGEN_QUEUEDINTERFACE_HPP #define INGEN_QUEUEDINTERFACE_HPP -#include "ingen/Interface.hpp" -#include "ingen/Message.hpp" -#include "ingen/URI.hpp" +#include <ingen/Interface.hpp> +#include <ingen/Message.hpp> +#include <ingen/URI.hpp> #include <memory> #include <mutex> diff --git a/include/ingen/Resource.hpp b/include/ingen/Resource.hpp index 8b96a27b..f6a12bad 100644 --- a/include/ingen/Resource.hpp +++ b/include/ingen/Resource.hpp @@ -17,11 +17,11 @@ #ifndef INGEN_RESOURCE_HPP #define INGEN_RESOURCE_HPP -#include "ingen/Properties.hpp" -#include "ingen/URI.hpp" -#include "ingen/URIs.hpp" -#include "ingen/ingen.h" -#include "raul/Deletable.hpp" +#include <ingen/Properties.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/ingen.h> +#include <raul/Deletable.hpp> #include <cassert> #include <utility> @@ -175,8 +175,8 @@ public: /** Get the ingen type from a set of Properties. * - * If some coherent ingen type is found, true is returned and the appropriate - * output parameter set to true. Otherwise false is returned. + * If some coherent ingen type is found, true is returned and the + * appropriate output parameter set to true. Otherwise false is returned. */ static bool type(const URIs& uris, const Properties& properties, diff --git a/include/ingen/Serialiser.hpp b/include/ingen/Serialiser.hpp index f7f04317..6e9d6ad4 100644 --- a/include/ingen/Serialiser.hpp +++ b/include/ingen/Serialiser.hpp @@ -17,10 +17,10 @@ #ifndef INGEN_SERIALISER_HPP #define INGEN_SERIALISER_HPP -#include "ingen/FilePath.hpp" -#include "ingen/Properties.hpp" -#include "ingen/ingen.h" -#include "sord/sordmm.hpp" +#include <ingen/FilePath.hpp> +#include <ingen/Properties.hpp> +#include <ingen/ingen.h> +#include <sord/sordmm.hpp> #include <memory> #include <string> @@ -56,8 +56,8 @@ public: * * This must be called before any serializing methods. * - * The results of the serialization will be returned by the finish() method after - * the desired objects have been serialised. + * The results of the serialization will be returned by the finish() method + * after the desired objects have been serialised. * * All serialized paths will have the root path chopped from their prefix * (therefore all serialized paths must be descendants of the root) @@ -77,14 +77,14 @@ public: /** Serialize an object (graph, block, or port). * - * @throw std::logic_error + * @throw std::logic_error A serialization hasn't been started. */ virtual void serialise(const std::shared_ptr<const Node>& object, Property::Graph context = Property::Graph::DEFAULT); /** Serialize an arc. * - * @throw std::logic_error + * @throw std::logic_error A serialization hasn't been started. */ virtual void serialise_arc(const Sord::Node& parent, const std::shared_ptr<const Arc>& arc); diff --git a/include/ingen/SocketReader.hpp b/include/ingen/SocketReader.hpp index 5e7bc373..d0d62747 100644 --- a/include/ingen/SocketReader.hpp +++ b/include/ingen/SocketReader.hpp @@ -17,9 +17,9 @@ #ifndef INGEN_SOCKETREADER_HPP #define INGEN_SOCKETREADER_HPP -#include "ingen/ingen.h" -#include "serd/serd.h" -#include "sord/sord.h" +#include <ingen/ingen.h> +#include <serd/serd.h> +#include <sord/sord.h> #include <cstddef> #include <memory> diff --git a/include/ingen/SocketWriter.hpp b/include/ingen/SocketWriter.hpp index 7edaa13c..e564b524 100644 --- a/include/ingen/SocketWriter.hpp +++ b/include/ingen/SocketWriter.hpp @@ -17,9 +17,9 @@ #ifndef INGEN_SOCKETWRITER_HPP #define INGEN_SOCKETWRITER_HPP -#include "ingen/Message.hpp" -#include "ingen/TurtleWriter.hpp" -#include "ingen/ingen.h" +#include <ingen/Message.hpp> +#include <ingen/TurtleWriter.hpp> +#include <ingen/ingen.h> #include <cstddef> #include <memory> diff --git a/include/ingen/Store.hpp b/include/ingen/Store.hpp index a7a1ec28..d18858fb 100644 --- a/include/ingen/Store.hpp +++ b/include/ingen/Store.hpp @@ -17,10 +17,10 @@ #ifndef INGEN_STORE_HPP #define INGEN_STORE_HPP -#include "ingen/ingen.h" -#include "raul/Deletable.hpp" -#include "raul/Noncopyable.hpp" -#include "raul/Path.hpp" +#include <ingen/ingen.h> +#include <raul/Deletable.hpp> +#include <raul/Noncopyable.hpp> +#include <raul/Path.hpp> #include <map> #include <memory> diff --git a/include/ingen/StreamWriter.hpp b/include/ingen/StreamWriter.hpp index 9fafe571..5ed260ea 100644 --- a/include/ingen/StreamWriter.hpp +++ b/include/ingen/StreamWriter.hpp @@ -17,9 +17,9 @@ #ifndef INGEN_STREAMWRITER_HPP #define INGEN_STREAMWRITER_HPP -#include "ingen/ColorContext.hpp" -#include "ingen/TurtleWriter.hpp" -#include "ingen/ingen.h" +#include <ingen/ColorContext.hpp> +#include <ingen/TurtleWriter.hpp> +#include <ingen/ingen.h> #include <cstdio> diff --git a/include/ingen/Tee.hpp b/include/ingen/Tee.hpp index 562ff298..c1ac0d31 100644 --- a/include/ingen/Tee.hpp +++ b/include/ingen/Tee.hpp @@ -17,9 +17,9 @@ #ifndef INGEN_TEE_HPP #define INGEN_TEE_HPP -#include "ingen/Interface.hpp" -#include "ingen/Message.hpp" -#include "ingen/URI.hpp" +#include <ingen/Interface.hpp> +#include <ingen/Message.hpp> +#include <ingen/URI.hpp> #include <memory> #include <mutex> diff --git a/include/ingen/TurtleWriter.hpp b/include/ingen/TurtleWriter.hpp index 780d9f7b..07d4e249 100644 --- a/include/ingen/TurtleWriter.hpp +++ b/include/ingen/TurtleWriter.hpp @@ -17,13 +17,13 @@ #ifndef INGEN_TURTLEWRITER_HPP #define INGEN_TURTLEWRITER_HPP -#include "ingen/AtomSink.hpp" -#include "ingen/AtomWriter.hpp" -#include "ingen/URI.hpp" -#include "ingen/ingen.h" -#include "lv2/atom/atom.h" -#include "serd/serd.h" -#include "sratom/sratom.h" +#include <ingen/AtomSink.hpp> +#include <ingen/AtomWriter.hpp> +#include <ingen/URI.hpp> +#include <ingen/ingen.h> +#include <lv2/atom/atom.h> +#include <serd/serd.h> +#include <sratom/sratom.h> #include <cstddef> #include <cstdint> diff --git a/include/ingen/URI.hpp b/include/ingen/URI.hpp index a45fb268..53812c4b 100644 --- a/include/ingen/URI.hpp +++ b/include/ingen/URI.hpp @@ -17,10 +17,10 @@ #ifndef INGEN_URI_HPP #define INGEN_URI_HPP -#include "ingen/FilePath.hpp" -#include "ingen/ingen.h" -#include "serd/serd.h" -#include "sord/sordmm.hpp" +#include <ingen/FilePath.hpp> +#include <ingen/ingen.h> +#include <serd/serd.h> +#include <sord/sordmm.hpp> #include <cstddef> #include <cstdint> @@ -40,7 +40,7 @@ public: explicit URI(const char* str); URI(const std::string& str, const URI& base); URI(const Sord::Node& node); - URI(SerdNode node); + URI(const SerdNode& node); explicit URI(const FilePath& path); URI(const URI& uri); @@ -98,7 +98,7 @@ public: } private: - URI(SerdNode node, SerdURI uri); + URI(const SerdNode& node, const SerdURI& uri); static Chunk make_chunk(const SerdChunk& chunk) { return {reinterpret_cast<const char*>(chunk.buf), chunk.len}; diff --git a/include/ingen/URIMap.hpp b/include/ingen/URIMap.hpp index de137af2..fbb0523c 100644 --- a/include/ingen/URIMap.hpp +++ b/include/ingen/URIMap.hpp @@ -17,12 +17,12 @@ #ifndef INGEN_URIMAP_HPP #define INGEN_URIMAP_HPP -#include "ingen/LV2Features.hpp" -#include "ingen/ingen.h" -#include "ingen/memory.hpp" -#include "lv2/core/lv2.h" -#include "lv2/urid/urid.h" -#include "raul/Noncopyable.hpp" +#include <ingen/LV2Features.hpp> +#include <ingen/ingen.h> +#include <ingen/memory.hpp> +#include <lv2/core/lv2.h> +#include <lv2/urid/urid.h> +#include <raul/Noncopyable.hpp> #include <cstdint> #include <memory> @@ -34,8 +34,6 @@ namespace ingen { class Log; -class Node; -class World; /** URI to integer map and implementation of LV2 URID extension. * @ingroup IngenShared diff --git a/include/ingen/URIs.hpp b/include/ingen/URIs.hpp index 1b29bcd5..b3a4124f 100644 --- a/include/ingen/URIs.hpp +++ b/include/ingen/URIs.hpp @@ -17,12 +17,12 @@ #ifndef INGEN_URIS_HPP #define INGEN_URIS_HPP -#include "ingen/Atom.hpp" -#include "ingen/URI.hpp" -#include "ingen/ingen.h" -#include "lilv/lilv.h" -#include "lv2/urid/urid.h" -#include "raul/Noncopyable.hpp" +#include <ingen/Atom.hpp> +#include <ingen/URI.hpp> +#include <ingen/ingen.h> +#include <lilv/lilv.h> +#include <lv2/urid/urid.h> +#include <raul/Noncopyable.hpp> namespace ingen { diff --git a/include/ingen/World.hpp b/include/ingen/World.hpp index 0b8690ad..738012cd 100644 --- a/include/ingen/World.hpp +++ b/include/ingen/World.hpp @@ -17,10 +17,10 @@ #ifndef INGEN_WORLD_HPP #define INGEN_WORLD_HPP -#include "ingen/ingen.h" -#include "lv2/log/log.h" -#include "lv2/urid/urid.h" -#include "raul/Noncopyable.hpp" +#include <ingen/ingen.h> +#include <lv2/log/log.h> +#include <lv2/urid/urid.h> +#include <raul/Noncopyable.hpp> #include <memory> #include <mutex> diff --git a/include/ingen/client/ArcModel.hpp b/include/ingen/client/ArcModel.hpp index 8104b188..21238831 100644 --- a/include/ingen/client/ArcModel.hpp +++ b/include/ingen/client/ArcModel.hpp @@ -17,10 +17,10 @@ #ifndef INGEN_CLIENT_ARCMODEL_HPP #define INGEN_CLIENT_ARCMODEL_HPP -#include "ingen/Arc.hpp" -#include "ingen/client/PortModel.hpp" -#include "ingen/ingen.h" -#include "raul/Path.hpp" +#include <ingen/Arc.hpp> +#include <ingen/client/PortModel.hpp> +#include <ingen/ingen.h> +#include <raul/Path.hpp> #include <cassert> #include <memory> diff --git a/include/ingen/client/BlockModel.hpp b/include/ingen/client/BlockModel.hpp index d2641f77..db41f4ef 100644 --- a/include/ingen/client/BlockModel.hpp +++ b/include/ingen/client/BlockModel.hpp @@ -17,20 +17,18 @@ #ifndef INGEN_CLIENT_BLOCKMODEL_HPP #define INGEN_CLIENT_BLOCKMODEL_HPP -#include "ingen/Node.hpp" -#include "ingen/URI.hpp" -#include "ingen/client/ObjectModel.hpp" -#include "ingen/client/PluginModel.hpp" // IWYU pragma: keep -#include "ingen/client/signal.hpp" -#include "ingen/ingen.h" +#include <ingen/Node.hpp> +#include <ingen/URI.hpp> +#include <ingen/client/ObjectModel.hpp> +#include <ingen/client/PluginModel.hpp> +#include <ingen/client/signal.hpp> +#include <ingen/ingen.h> #include <cstdint> #include <memory> #include <string> #include <vector> -// IWYU pragma: no_include <algorithm> - namespace raul { class Path; class Symbol; diff --git a/include/ingen/client/ClientStore.hpp b/include/ingen/client/ClientStore.hpp index 83cce726..c649aab3 100644 --- a/include/ingen/client/ClientStore.hpp +++ b/include/ingen/client/ClientStore.hpp @@ -17,12 +17,12 @@ #ifndef INGEN_CLIENT_CLIENTSTORE_HPP #define INGEN_CLIENT_CLIENTSTORE_HPP -#include "ingen/Interface.hpp" -#include "ingen/Message.hpp" -#include "ingen/Store.hpp" -#include "ingen/URI.hpp" -#include "ingen/client/signal.hpp" -#include "ingen/ingen.h" +#include <ingen/Interface.hpp> +#include <ingen/Message.hpp> +#include <ingen/Store.hpp> +#include <ingen/URI.hpp> +#include <ingen/client/signal.hpp> +#include <ingen/ingen.h> #include <map> #include <memory> diff --git a/include/ingen/client/GraphModel.hpp b/include/ingen/client/GraphModel.hpp index 0ae756d8..837a28a5 100644 --- a/include/ingen/client/GraphModel.hpp +++ b/include/ingen/client/GraphModel.hpp @@ -17,11 +17,10 @@ #ifndef INGEN_CLIENT_GRAPHMODEL_HPP #define INGEN_CLIENT_GRAPHMODEL_HPP -#include "ingen/Node.hpp" -#include "ingen/URIs.hpp" -#include "ingen/client/BlockModel.hpp" -#include "ingen/client/signal.hpp" -#include "ingen/ingen.h" +#include <ingen/Node.hpp> +#include <ingen/client/BlockModel.hpp> +#include <ingen/client/signal.hpp> +#include <ingen/ingen.h> #include <cstdint> #include <memory> @@ -32,12 +31,11 @@ class Path; namespace ingen { -class URI; +class URIs; namespace client { class ArcModel; -class ObjectModel; class PortModel; /** Client's model of a graph. @@ -55,7 +53,6 @@ public: get_arc(const ingen::Node* tail, const ingen::Node* head); bool enabled() const; - bool polyphonic() const; uint32_t internal_poly() const; // Signals @@ -67,11 +64,7 @@ public: private: friend class ClientStore; - GraphModel(URIs& uris, const raul::Path& graph_path) - : BlockModel(uris, - static_cast<const URI&>(uris.ingen_Graph), - graph_path) - {} + GraphModel(URIs& uris, const raul::Path& graph_path); void clear() override; void add_child(const std::shared_ptr<ObjectModel>& c) override; diff --git a/include/ingen/client/ObjectModel.hpp b/include/ingen/client/ObjectModel.hpp index e92618f8..f9f0e041 100644 --- a/include/ingen/client/ObjectModel.hpp +++ b/include/ingen/client/ObjectModel.hpp @@ -21,19 +21,19 @@ #ifndef INGEN_CLIENT_OBJECTMODEL_HPP #define INGEN_CLIENT_OBJECTMODEL_HPP -#include "ingen/Node.hpp" -#include "ingen/URI.hpp" -#include "ingen/URIs.hpp" -#include "ingen/client/signal.hpp" -#include "ingen/ingen.h" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" +#include <ingen/Node.hpp> +#include <ingen/URIs.hpp> +#include <ingen/client/signal.hpp> +#include <ingen/ingen.h> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> #include <memory> namespace ingen { class Atom; +class URI; namespace client { diff --git a/include/ingen/client/PluginModel.hpp b/include/ingen/client/PluginModel.hpp index 7f86f680..37b71d0d 100644 --- a/include/ingen/client/PluginModel.hpp +++ b/include/ingen/client/PluginModel.hpp @@ -17,16 +17,16 @@ #ifndef INGEN_CLIENT_PLUGINMODEL_HPP #define INGEN_CLIENT_PLUGINMODEL_HPP -#include "ingen/Atom.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Properties.hpp" -#include "ingen/Resource.hpp" -#include "ingen/URI.hpp" -#include "ingen/URIs.hpp" -#include "ingen/client/signal.hpp" -#include "ingen/ingen.h" -#include "lilv/lilv.h" -#include "raul/Symbol.hpp" +#include <ingen/Atom.hpp> +#include <ingen/Forge.hpp> +#include <ingen/Properties.hpp> +#include <ingen/Resource.hpp> +#include <ingen/URI.hpp> +#include <ingen/URIs.hpp> +#include <ingen/client/signal.hpp> +#include <ingen/ingen.h> +#include <lilv/lilv.h> +#include <raul/Symbol.hpp> #include <cstdint> #include <map> diff --git a/include/ingen/client/PluginUI.hpp b/include/ingen/client/PluginUI.hpp index b291d521..6ecaed89 100644 --- a/include/ingen/client/PluginUI.hpp +++ b/include/ingen/client/PluginUI.hpp @@ -19,11 +19,11 @@ #include "signal.hpp" -#include "ingen/LV2Features.hpp" -#include "ingen/Resource.hpp" -#include "ingen/ingen.h" -#include "lilv/lilv.h" -#include "suil/suil.h" +#include <ingen/LV2Features.hpp> +#include <ingen/Resource.hpp> +#include <ingen/ingen.h> +#include <lilv/lilv.h> +#include <suil/suil.h> #include <cstdint> #include <memory> @@ -61,7 +61,7 @@ public: /** Instantiate the UI. * - * If true is returned, instantiation was successfull and the widget can be + * If true is returned, instantiation was successful and the widget can be * obtained with get_widget(). Otherwise, instantiation failed, so there is * no widget and the UI can not be used. */ diff --git a/include/ingen/client/PortModel.hpp b/include/ingen/client/PortModel.hpp index 903a435d..c87f2f03 100644 --- a/include/ingen/client/PortModel.hpp +++ b/include/ingen/client/PortModel.hpp @@ -17,16 +17,14 @@ #ifndef INGEN_CLIENT_PORTMODEL_HPP #define INGEN_CLIENT_PORTMODEL_HPP -#include "ingen/Node.hpp" -#include "ingen/URI.hpp" -#include "ingen/URIs.hpp" -#include "ingen/client/ObjectModel.hpp" -#include "ingen/client/signal.hpp" -#include "ingen/ingen.h" -#include "raul/Path.hpp" +#include <ingen/Node.hpp> +#include <ingen/URIs.hpp> +#include <ingen/client/ObjectModel.hpp> +#include <ingen/client/signal.hpp> +#include <ingen/ingen.h> +#include <raul/Path.hpp> #include <cstdint> -#include <memory> #include <string> namespace ingen { @@ -86,8 +84,8 @@ private: , _direction(dir) {} - void add_child(const std::shared_ptr<ObjectModel>& c) override { throw; } - bool remove_child(const std::shared_ptr<ObjectModel>& c) override { throw; } + void add_child(const std::shared_ptr<ObjectModel>& c) override; + bool remove_child(const std::shared_ptr<ObjectModel>& c) override; void set(const std::shared_ptr<ObjectModel>& model) override; diff --git a/include/ingen/client/SigClientInterface.hpp b/include/ingen/client/SigClientInterface.hpp index 6bff2e33..52bceacc 100644 --- a/include/ingen/client/SigClientInterface.hpp +++ b/include/ingen/client/SigClientInterface.hpp @@ -17,11 +17,11 @@ #ifndef INGEN_CLIENT_SIGCLIENTINTERFACE_HPP #define INGEN_CLIENT_SIGCLIENTINTERFACE_HPP -#include "ingen/Interface.hpp" -#include "ingen/Message.hpp" -#include "ingen/URI.hpp" -#include "ingen/client/signal.hpp" -#include "ingen/ingen.h" +#include <ingen/Interface.hpp> +#include <ingen/Message.hpp> +#include <ingen/URI.hpp> +#include <ingen/client/signal.hpp> +#include <ingen/ingen.h> namespace ingen::client { @@ -45,7 +45,7 @@ public: INGEN_SIGNAL(message, void, Message) - /** Fire pending signals. Only does anything on derived classes (that may queue) */ + /** Fire pending signals (for derived classes that may queue). */ virtual bool emit_signals() { return false; } protected: diff --git a/include/ingen/client/SocketClient.hpp b/include/ingen/client/SocketClient.hpp index 7434da90..23f8a3ff 100644 --- a/include/ingen/client/SocketClient.hpp +++ b/include/ingen/client/SocketClient.hpp @@ -17,13 +17,13 @@ #ifndef INGEN_CLIENT_SOCKETCLIENT_HPP #define INGEN_CLIENT_SOCKETCLIENT_HPP -#include "ingen/Log.hpp" -#include "ingen/SocketReader.hpp" -#include "ingen/SocketWriter.hpp" -#include "ingen/URI.hpp" -#include "ingen/World.hpp" -#include "ingen/ingen.h" -#include "raul/Socket.hpp" +#include <ingen/Log.hpp> +#include <ingen/SocketReader.hpp> +#include <ingen/SocketWriter.hpp> +#include <ingen/URI.hpp> +#include <ingen/World.hpp> +#include <ingen/ingen.h> +#include <raul/Socket.hpp> #include <cerrno> #include <cstring> diff --git a/include/ingen/fmt.hpp b/include/ingen/fmt.hpp index 7ca5de9f..bfc339e5 100644 --- a/include/ingen/fmt.hpp +++ b/include/ingen/fmt.hpp @@ -29,7 +29,7 @@ fmt(const char* fmt, Args&&... args) { boost::format f{fmt}; // NOLINT(misc-const-correctness) const std::initializer_list<char> l{ - (static_cast<void>(f % args), char{})...}; + (static_cast<void>(f % std::forward<Args>(args)), char{})...}; (void)l; return boost::str(f); diff --git a/include/ingen/paths.hpp b/include/ingen/paths.hpp index ad079390..bf8d8ecc 100644 --- a/include/ingen/paths.hpp +++ b/include/ingen/paths.hpp @@ -17,8 +17,8 @@ #ifndef INGEN_PATHS_HPP #define INGEN_PATHS_HPP -#include "ingen/URI.hpp" -#include "raul/Path.hpp" +#include <ingen/URI.hpp> +#include <raul/Path.hpp> #include <cstddef> #include <string> diff --git a/include/ingen/runtime_paths.hpp b/include/ingen/runtime_paths.hpp index 30e877fb..54bda90e 100644 --- a/include/ingen/runtime_paths.hpp +++ b/include/ingen/runtime_paths.hpp @@ -17,8 +17,8 @@ #ifndef INGEN_RUNTIME_PATHS_HPP #define INGEN_RUNTIME_PATHS_HPP -#include "ingen/FilePath.hpp" -#include "ingen/ingen.h" +#include <ingen/FilePath.hpp> +#include <ingen/ingen.h> #include <string> #include <vector> |