diff options
Diffstat (limited to 'include')
51 files changed, 457 insertions, 710 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 81f36b5b..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 intptr_t ref = _size + 1; - - // 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 c83e7e4a..b0fe5906 100644 --- a/include/ingen/AtomReader.hpp +++ b/include/ingen/AtomReader.hpp @@ -17,14 +17,13 @@ #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 <boost/optional/optional.hpp> +#include <ingen/AtomSink.hpp> +#include <ingen/Resource.hpp> +#include <ingen/ingen.h> +#include <lv2/atom/atom.h> #include <cstdint> +#include <optional> namespace raul { class Path; @@ -58,9 +57,9 @@ public: private: void get_atom(const LV2_Atom* in, Atom& out); - boost::optional<URI> atom_to_uri(const LV2_Atom* atom); - boost::optional<raul::Path> atom_to_path(const LV2_Atom* atom); - Resource::Graph atom_to_context(const LV2_Atom* atom); + std::optional<URI> atom_to_uri(const LV2_Atom* atom); + std::optional<raul::Path> atom_to_path(const LV2_Atom* atom); + Resource::Graph atom_to_context(const LV2_Atom* atom); void get_props(const LV2_Atom_Object* obj, ingen::Properties& props); 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 551202a7..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) * 1e6 + - static_cast<uint64_t>(time.tv_nsec) / 1e3; + 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 251812b8..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> @@ -34,7 +34,7 @@ public: ColorContext(const ColorContext&) = delete; ColorContext& operator=(const ColorContext&) = delete; ColorContext(ColorContext&&) = delete; - ColorContext& operator=(ColorContext&) = delete; + ColorContext& operator=(ColorContext&&) = delete; private: FILE* _stream; 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/FilePath.hpp b/include/ingen/FilePath.hpp index 6f0266a7..ce157d90 100644 --- a/include/ingen/FilePath.hpp +++ b/include/ingen/FilePath.hpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2018 David Robillard <http://drobilla.net/> + Copyright 2018-2020 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,113 +17,11 @@ #ifndef INGEN_FILEPATH_HPP #define INGEN_FILEPATH_HPP -#include "ingen/ingen.h" - -#include <boost/utility/string_view.hpp> // IWYU pragma: export - -#include <cstddef> -#include <ostream> -#include <string> -#include <utility> - -#ifndef USE_WINDOWS_FILE_PATHS -# if defined(_WIN32) && !defined(__CYGWIN__) -# define USE_WINDOWS_FILE_PATHS 1 -# else -# define USE_WINDOWS_FILE_PATHS 0 -# endif -#endif +#include <filesystem> namespace ingen { -/** A path to a file. - * - * This is a minimal subset of the std::filesystem::path interface in C++17. - * Support for Windows paths is only partial and there is no support for - * character encoding conversion at all. - */ -class INGEN_API FilePath -{ -public: -#if USE_WINDOWS_FILE_PATHS - using value_type = wchar_t; - static constexpr value_type preferred_separator = L'\\'; -#else - using value_type = char; - static constexpr value_type preferred_separator = '/'; -#endif - - using string_type = std::basic_string<value_type>; - - FilePath() = default; - FilePath(const FilePath&) = default; - FilePath(FilePath&&) = default; - - FilePath(string_type str) : _str(std::move(str)) {} - FilePath(const value_type* str) : _str(str) {} - FilePath(const boost::basic_string_view<value_type>& sv) - : _str(sv.data(), sv.length()) - {} - - ~FilePath() = default; - - FilePath& operator=(const FilePath& path) = default; - FilePath& operator=(FilePath&& path) noexcept; - FilePath& operator=(string_type&& str); - - FilePath& operator/=(const FilePath& path); - - FilePath& operator+=(const FilePath& path); - FilePath& operator+=(const string_type& str); - FilePath& operator+=(const value_type* str); - FilePath& operator+=(value_type chr); - FilePath& operator+=(boost::basic_string_view<value_type> sv); - - void clear() noexcept { _str.clear(); } - - const string_type& native() const noexcept { return _str; } - const string_type& string() const noexcept { return _str; } - const value_type* c_str() const noexcept { return _str.c_str(); } - - operator string_type() const { return _str; } - - static FilePath root_name(); - - FilePath root_directory() const; - FilePath root_path() const; - FilePath relative_path() const; - FilePath parent_path() const; - FilePath filename() const; - FilePath stem() const; - FilePath extension() const; - - bool empty() const noexcept { return _str.empty(); } - - bool is_absolute() const; - bool is_relative() const { return !is_absolute(); } - -private: - std::size_t find_first_sep() const; - std::size_t find_last_sep() const; - - string_type _str; -}; - -INGEN_API bool operator==(const FilePath& lhs, const FilePath& rhs) noexcept; -INGEN_API bool operator!=(const FilePath& lhs, const FilePath& rhs) noexcept; -INGEN_API bool operator<(const FilePath& lhs, const FilePath& rhs) noexcept; -INGEN_API bool operator<=(const FilePath& lhs, const FilePath& rhs) noexcept; -INGEN_API bool operator>(const FilePath& lhs, const FilePath& rhs) noexcept; -INGEN_API bool operator>=(const FilePath& lhs, const FilePath& rhs) noexcept; - -INGEN_API FilePath operator/(const FilePath& lhs, const FilePath& rhs); - -template <typename Char, typename Traits> -std::basic_ostream<Char, Traits>& -operator<<(std::basic_ostream<Char, Traits>& os, const FilePath& path) -{ - return os << path.string(); -} +using FilePath = std::filesystem::path; } // namespace ingen 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..fe6fd707 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> @@ -59,10 +59,7 @@ public: const char* uri() const override { return _uri; } - std::shared_ptr<LV2_Feature> feature(World& world, Node* block) override - { - return nullptr; - } + std::shared_ptr<LV2_Feature> feature(World& world, Node* block) override; const char* _uri; }; 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 ca618514..be0b5d00 100644 --- a/include/ingen/Message.hpp +++ b/include/ingen/Message.hpp @@ -17,17 +17,16 @@ #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 <boost/variant/variant.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> +#include <variant> namespace ingen { @@ -121,22 +120,22 @@ struct Undo { int32_t seq; }; -using Message = boost::variant<BundleBegin, - BundleEnd, - Connect, - Copy, - Del, - Delta, - Disconnect, - DisconnectAll, - Error, - Get, - Move, - Put, - Redo, - Response, - SetProperty, - Undo>; +using Message = std::variant<BundleBegin, + BundleEnd, + Connect, + Copy, + Del, + Delta, + Disconnect, + DisconnectAll, + Error, + Get, + Move, + Put, + Redo, + Response, + SetProperty, + Undo>; } // namespace ingen 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 c8006a8e..2370cfe7 100644 --- a/include/ingen/Node.hpp +++ b/include/ingen/Node.hpp @@ -17,13 +17,14 @@ #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> #include <map> #include <memory> #include <string> @@ -37,7 +38,6 @@ class Symbol; namespace ingen { class Arc; -class FilePath; class URIs; /** A node in the audio graph. @@ -75,7 +75,11 @@ public: // Plugin blocks only virtual LilvInstance* instance() { return nullptr; } - virtual bool save_state(const FilePath& dir) const { return false; } + + virtual bool save_state(const std::filesystem::path& dir) const + { + return false; + } // All objects virtual GraphType graph_type() const = 0; diff --git a/include/ingen/Parser.hpp b/include/ingen/Parser.hpp index 485a5fa8..8db64104 100644 --- a/include/ingen/Parser.hpp +++ b/include/ingen/Parser.hpp @@ -17,15 +17,14 @@ #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 <boost/optional/optional.hpp> - +#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> #include <string> #include <utility> @@ -80,21 +79,21 @@ public: * @return whether or not load was successful. */ virtual bool parse_file( - World& world, - Interface& target, - const FilePath& path, - const boost::optional<raul::Path>& parent = boost::optional<raul::Path>(), - const boost::optional<raul::Symbol>& symbol = boost::optional<raul::Symbol>(), - const boost::optional<Properties>& data = boost::optional<Properties>()); - - virtual boost::optional<URI> parse_string( - World& world, - Interface& target, - const std::string& str, - const URI& base_uri, - const boost::optional<raul::Path>& parent = boost::optional<raul::Path>(), - const boost::optional<raul::Symbol>& symbol = boost::optional<raul::Symbol>(), - const boost::optional<Properties>& data = boost::optional<Properties>()); + World& world, + Interface& target, + const FilePath& path, + const std::optional<raul::Path>& parent = std::optional<raul::Path>(), + const std::optional<raul::Symbol>& symbol = std::optional<raul::Symbol>(), + const std::optional<Properties>& data = std::optional<Properties>()); + + virtual std::optional<URI> parse_string( + World& world, + Interface& target, + const std::string& str, + const URI& base_uri, + const std::optional<raul::Path>& parent = std::optional<raul::Path>(), + const std::optional<raul::Symbol>& symbol = std::optional<raul::Symbol>(), + const std::optional<Properties>& data = std::optional<Properties>()); }; } // namespace ingen 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 fc3e539c..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> @@ -42,14 +42,14 @@ public: URI uri() const override { return URI("ingen:/QueuedInterface"); } void message(const Message& message) override { - std::lock_guard<std::mutex> lock(_mutex); + const std::lock_guard<std::mutex> lock{_mutex}; _messages.emplace_back(message); } void emit() { std::vector<Message> messages; { - std::lock_guard<std::mutex> lock(_mutex); + const std::lock_guard<std::mutex> lock{_mutex}; _messages.swap(messages); } 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 2158190f..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> @@ -46,7 +46,7 @@ public: } void message(const Message& message) override { - std::lock_guard<std::mutex> lock(_sinks_mutex); + const std::lock_guard<std::mutex> lock{_sinks_mutex}; for (const auto& s : _sinks) { s->message(message); } 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 0c8d23ef..53812c4b 100644 --- a/include/ingen/URI.hpp +++ b/include/ingen/URI.hpp @@ -17,32 +17,30 @@ #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 <boost/utility/string_view.hpp> // IWYU pragma: export -#include <boost/utility/string_view_fwd.hpp> // IWYU pragma: export +#include <ingen/FilePath.hpp> +#include <ingen/ingen.h> +#include <serd/serd.h> +#include <sord/sordmm.hpp> #include <cstddef> #include <cstdint> #include <ostream> #include <string> +#include <string_view> namespace ingen { class INGEN_API URI { public: - using Chunk = boost::string_view; + using Chunk = std::string_view; URI(); explicit URI(const std::string& str); 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); @@ -54,6 +52,7 @@ public: ~URI(); URI make_relative(const URI& base) const; + URI make_relative(const URI& base, const URI& root) const; bool empty() const { return !_node.buf; } @@ -99,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 c555cbf9..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 { @@ -70,143 +70,143 @@ public: ingen::Forge& forge; - const Quark atom_AtomPort; - const Quark atom_Bool; - const Quark atom_Chunk; - const Quark atom_Float; - const Quark atom_Int; - const Quark atom_Object; - const Quark atom_Path; - const Quark atom_Sequence; - const Quark atom_Sound; - const Quark atom_String; - const Quark atom_URI; - const Quark atom_URID; - const Quark atom_bufferType; - const Quark atom_eventTransfer; - const Quark atom_supports; - const Quark bufsz_maxBlockLength; - const Quark bufsz_minBlockLength; - const Quark bufsz_sequenceSize; - const Quark doap_name; - const Quark ingen_Arc; - const Quark ingen_Block; - const Quark ingen_BundleEnd; - const Quark ingen_BundleStart; - const Quark ingen_Graph; - const Quark ingen_GraphPrototype; - const Quark ingen_Internal; - const Quark ingen_Redo; - const Quark ingen_Undo; - const Quark ingen_activity; - const Quark ingen_arc; - const Quark ingen_block; - const Quark ingen_broadcast; - const Quark ingen_canvasX; - const Quark ingen_canvasY; - const Quark ingen_enabled; - const Quark ingen_externalContext; - const Quark ingen_file; - const Quark ingen_head; - const Quark ingen_incidentTo; - const Quark ingen_internalContext; - const Quark ingen_loadedBundle; - const Quark ingen_maxRunLoad; - const Quark ingen_meanRunLoad; - const Quark ingen_minRunLoad; - const Quark ingen_numThreads; - const Quark ingen_polyphonic; - const Quark ingen_polyphony; - const Quark ingen_prototype; - const Quark ingen_sprungLayout; - const Quark ingen_tail; - const Quark ingen_uiEmbedded; - const Quark ingen_value; - const Quark log_Error; - const Quark log_Note; - const Quark log_Trace; - const Quark log_Warning; - const Quark lv2_AudioPort; - const Quark lv2_CVPort; - const Quark lv2_ControlPort; - const Quark lv2_InputPort; - const Quark lv2_OutputPort; - const Quark lv2_Plugin; - const Quark lv2_appliesTo; - const Quark lv2_binary; - const Quark lv2_connectionOptional; - const Quark lv2_control; - const Quark lv2_default; - const Quark lv2_designation; - const Quark lv2_enumeration; - const Quark lv2_extensionData; - const Quark lv2_index; - const Quark lv2_integer; - const Quark lv2_maximum; - const Quark lv2_microVersion; - const Quark lv2_minimum; - const Quark lv2_minorVersion; - const Quark lv2_name; - const Quark lv2_port; - const Quark lv2_portProperty; - const Quark lv2_prototype; - const Quark lv2_sampleRate; - const Quark lv2_scalePoint; - const Quark lv2_symbol; - const Quark lv2_toggled; - const Quark midi_Bender; - const Quark midi_ChannelPressure; - const Quark midi_Controller; - const Quark midi_MidiEvent; - const Quark midi_NoteOn; - const Quark midi_binding; - const Quark midi_controllerNumber; - const Quark midi_noteNumber; - const Quark midi_channel; - const Quark morph_AutoMorphPort; - const Quark morph_MorphPort; - const Quark morph_currentType; - const Quark morph_supportsType; - const Quark opt_interface; - const Quark param_sampleRate; - const Quark patch_Copy; - const Quark patch_Delete; - const Quark patch_Get; - const Quark patch_Message; - const Quark patch_Move; - const Quark patch_Patch; - const Quark patch_Put; - const Quark patch_Response; - const Quark patch_Set; - const Quark patch_add; - const Quark patch_body; - const Quark patch_context; - const Quark patch_destination; - const Quark patch_property; - const Quark patch_remove; - const Quark patch_sequenceNumber; - const Quark patch_subject; - const Quark patch_value; - const Quark patch_wildcard; - const Quark pprops_logarithmic; - const Quark pset_Preset; - const Quark pset_preset; - const Quark rdf_type; - const Quark rdfs_Class; - const Quark rdfs_label; - const Quark rdfs_seeAlso; - const Quark rsz_minimumSize; - const Quark state_loadDefaultState; - const Quark state_state; - const Quark time_Position; - const Quark time_bar; - const Quark time_barBeat; - const Quark time_beatUnit; - const Quark time_beatsPerBar; - const Quark time_beatsPerMinute; - const Quark time_frame; - const Quark time_speed; - const Quark work_schedule; + Quark atom_AtomPort; + Quark atom_Bool; + Quark atom_Chunk; + Quark atom_Float; + Quark atom_Int; + Quark atom_Object; + Quark atom_Path; + Quark atom_Sequence; + Quark atom_Sound; + Quark atom_String; + Quark atom_URI; + Quark atom_URID; + Quark atom_bufferType; + Quark atom_eventTransfer; + Quark atom_supports; + Quark bufsz_maxBlockLength; + Quark bufsz_minBlockLength; + Quark bufsz_sequenceSize; + Quark doap_name; + Quark ingen_Arc; + Quark ingen_Block; + Quark ingen_BundleEnd; + Quark ingen_BundleStart; + Quark ingen_Graph; + Quark ingen_GraphPrototype; + Quark ingen_Internal; + Quark ingen_Redo; + Quark ingen_Undo; + Quark ingen_activity; + Quark ingen_arc; + Quark ingen_block; + Quark ingen_broadcast; + Quark ingen_canvasX; + Quark ingen_canvasY; + Quark ingen_enabled; + Quark ingen_externalContext; + Quark ingen_file; + Quark ingen_head; + Quark ingen_incidentTo; + Quark ingen_internalContext; + Quark ingen_loadedBundle; + Quark ingen_maxRunLoad; + Quark ingen_meanRunLoad; + Quark ingen_minRunLoad; + Quark ingen_numThreads; + Quark ingen_polyphonic; + Quark ingen_polyphony; + Quark ingen_prototype; + Quark ingen_sprungLayout; + Quark ingen_tail; + Quark ingen_uiEmbedded; + Quark ingen_value; + Quark log_Error; + Quark log_Note; + Quark log_Trace; + Quark log_Warning; + Quark lv2_AudioPort; + Quark lv2_CVPort; + Quark lv2_ControlPort; + Quark lv2_InputPort; + Quark lv2_OutputPort; + Quark lv2_Plugin; + Quark lv2_appliesTo; + Quark lv2_binary; + Quark lv2_connectionOptional; + Quark lv2_control; + Quark lv2_default; + Quark lv2_designation; + Quark lv2_enumeration; + Quark lv2_extensionData; + Quark lv2_index; + Quark lv2_integer; + Quark lv2_maximum; + Quark lv2_microVersion; + Quark lv2_minimum; + Quark lv2_minorVersion; + Quark lv2_name; + Quark lv2_port; + Quark lv2_portProperty; + Quark lv2_prototype; + Quark lv2_sampleRate; + Quark lv2_scalePoint; + Quark lv2_symbol; + Quark lv2_toggled; + Quark midi_Bender; + Quark midi_ChannelPressure; + Quark midi_Controller; + Quark midi_MidiEvent; + Quark midi_NoteOn; + Quark midi_binding; + Quark midi_controllerNumber; + Quark midi_noteNumber; + Quark midi_channel; + Quark morph_AutoMorphPort; + Quark morph_MorphPort; + Quark morph_currentType; + Quark morph_supportsType; + Quark opt_interface; + Quark param_sampleRate; + Quark patch_Copy; + Quark patch_Delete; + Quark patch_Get; + Quark patch_Message; + Quark patch_Move; + Quark patch_Patch; + Quark patch_Put; + Quark patch_Response; + Quark patch_Set; + Quark patch_add; + Quark patch_body; + Quark patch_context; + Quark patch_destination; + Quark patch_property; + Quark patch_remove; + Quark patch_sequenceNumber; + Quark patch_subject; + Quark patch_value; + Quark patch_wildcard; + Quark pprops_logarithmic; + Quark pset_Preset; + Quark pset_preset; + Quark rdf_type; + Quark rdfs_Class; + Quark rdfs_label; + Quark rdfs_seeAlso; + Quark rsz_minimumSize; + Quark state_loadDefaultState; + Quark state_state; + Quark time_Position; + Quark time_bar; + Quark time_barBeat; + Quark time_beatUnit; + Quark time_beatsPerBar; + Quark time_beatsPerMinute; + Quark time_frame; + Quark time_speed; + Quark work_schedule; }; inline bool diff --git a/include/ingen/World.hpp b/include/ingen/World.hpp index 8c1bef12..738012cd 100644 --- a/include/ingen/World.hpp +++ b/include/ingen/World.hpp @@ -17,11 +17,10 @@ #ifndef INGEN_WORLD_HPP #define INGEN_WORLD_HPP -#include "ingen/ingen.h" -#include "lilv/lilv.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 a76f274f..21238831 100644 --- a/include/ingen/client/ArcModel.hpp +++ b/include/ingen/client/ArcModel.hpp @@ -17,18 +17,17 @@ #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> #include <string> #include <utility> -namespace ingen { -namespace client { +namespace ingen::client { /** Class to represent a port->port connections in the engine. * @@ -61,7 +60,6 @@ private: const std::shared_ptr<PortModel> _head; }; -} // namespace client -} // namespace ingen +} // namespace ingen::client #endif // INGEN_CLIENT_ARCMODEL_HPP 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 51e05b50..52bceacc 100644 --- a/include/ingen/client/SigClientInterface.hpp +++ b/include/ingen/client/SigClientInterface.hpp @@ -17,14 +17,13 @@ #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 { -namespace client { +namespace ingen::client { /** A LibSigC++ signal emitting interface for clients to use. * @@ -46,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: @@ -55,7 +54,6 @@ protected: } }; -} // namespace client -} // namespace ingen +} // namespace ingen::client #endif diff --git a/include/ingen/client/SocketClient.hpp b/include/ingen/client/SocketClient.hpp index 0002c795..23f8a3ff 100644 --- a/include/ingen/client/SocketClient.hpp +++ b/include/ingen/client/SocketClient.hpp @@ -14,16 +14,16 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef INGEN_CLIENT_SOCKET_CLIENT_HPP -#define INGEN_CLIENT_SOCKET_CLIENT_HPP +#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> @@ -66,7 +66,7 @@ public: ? raul::Socket::Type::UNIX : raul::Socket::Type::TCP); - std::shared_ptr<raul::Socket> sock(new raul::Socket(type)); + const std::shared_ptr<raul::Socket> sock{new raul::Socket(type)}; if (!sock->connect(uri)) { world.log().error("Failed to connect <%1%> (%2%)\n", sock->uri(), strerror(errno)); @@ -89,4 +89,4 @@ private: } // namespace client } // namespace ingen -#endif // INGEN_CLIENT_SOCKET_CLIENT_HPP +#endif // INGEN_CLIENT_SOCKETCLIENT_HPP diff --git a/include/ingen/filesystem.hpp b/include/ingen/filesystem.hpp deleted file mode 100644 index 5a90e7b7..00000000 --- a/include/ingen/filesystem.hpp +++ /dev/null @@ -1,84 +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_FILESYSTEM_HPP -#define INGEN_FILESYSTEM_HPP - -#include "ingen/FilePath.hpp" - -#ifdef _WIN32 -# include <windows.h> -# include <io.h> -# define F_OK 0 -# define mkdir(path, flags) _mkdir(path) -#else -# include <unistd.h> -#endif - -#include <sys/stat.h> - -#include <algorithm> -#include <cerrno> -#include <cstdlib> -#include <memory> -#include <vector> - -/* A minimal subset of the std::filesystem API from C++17. */ - -namespace ingen { -namespace filesystem { - -inline bool exists(const FilePath& path) -{ - return !access(path.c_str(), F_OK); -} - -inline bool is_directory(const FilePath& path) -{ - struct stat info{}; - stat(path.c_str(), &info); - return S_ISDIR(info.st_mode); -} - -inline bool create_directories(const FilePath& path) -{ - std::vector<FilePath> paths; - for (FilePath p = path; p != path.root_directory(); p = p.parent_path()) { - paths.emplace_back(p); - } - - for (auto p = paths.rbegin(); p != paths.rend(); ++p) { - if (mkdir(p->c_str(), 0755) && errno != EEXIST) { - return false; - } - } - - return true; -} - -inline FilePath current_path() -{ - struct Freer { void operator()(char* const ptr) { free(ptr); } }; - - std::unique_ptr<char, Freer> cpath(realpath(".", nullptr)); - - return {cpath.get()}; -} - -} // namespace filesystem -} // namespace ingen - -#endif // INGEN_FILESYSTEM_HPP diff --git a/include/ingen/fmt.hpp b/include/ingen/fmt.hpp index b2924d29..bfc339e5 100644 --- a/include/ingen/fmt.hpp +++ b/include/ingen/fmt.hpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2016 David Robillard <http://drobilla.net/> + Copyright 2007-2023 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 @@ -27,8 +27,10 @@ template <typename... Args> std::string fmt(const char* fmt, Args&&... args) { - boost::format f(fmt); - std::initializer_list<char> l{(static_cast<void>(f % args), char{})...}; + boost::format f{fmt}; // NOLINT(misc-const-correctness) + const std::initializer_list<char> l{ + (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> |