summaryrefslogtreecommitdiffstats
path: root/include/ingen
diff options
context:
space:
mode:
Diffstat (limited to 'include/ingen')
-rw-r--r--include/ingen/Arc.hpp8
-rw-r--r--include/ingen/Atom.hpp41
-rw-r--r--include/ingen/AtomForge.hpp104
-rw-r--r--include/ingen/AtomReader.hpp17
-rw-r--r--include/ingen/AtomSink.hpp7
-rw-r--r--include/ingen/AtomWriter.hpp22
-rw-r--r--include/ingen/ClashAvoider.hpp10
-rw-r--r--include/ingen/Clock.hpp13
-rw-r--r--include/ingen/ColorContext.hpp14
-rw-r--r--include/ingen/Configuration.hpp25
-rw-r--r--include/ingen/DataAccess.hpp17
-rw-r--r--include/ingen/EngineBase.hpp4
-rw-r--r--include/ingen/FilePath.hpp103
-rw-r--r--include/ingen/Forge.hpp33
-rw-r--r--include/ingen/InstanceAccess.hpp15
-rw-r--r--include/ingen/Interface.hpp62
-rw-r--r--include/ingen/LV2Features.hpp20
-rw-r--r--include/ingen/Library.hpp15
-rw-r--r--include/ingen/Log.hpp29
-rw-r--r--include/ingen/Message.hpp103
-rw-r--r--include/ingen/Module.hpp22
-rw-r--r--include/ingen/Node.hpp24
-rw-r--r--include/ingen/Parser.hpp62
-rw-r--r--include/ingen/Properties.hpp21
-rw-r--r--include/ingen/QueuedInterface.hpp14
-rw-r--r--include/ingen/Resource.hpp19
-rw-r--r--include/ingen/Serialiser.hpp21
-rw-r--r--include/ingen/SocketReader.hpp24
-rw-r--r--include/ingen/SocketWriter.hpp10
-rw-r--r--include/ingen/Status.hpp2
-rw-r--r--include/ingen/Store.hpp14
-rw-r--r--include/ingen/StreamWriter.hpp10
-rw-r--r--include/ingen/Tee.hpp10
-rw-r--r--include/ingen/TurtleWriter.hpp22
-rw-r--r--include/ingen/URI.hpp25
-rw-r--r--include/ingen/URIMap.hpp32
-rw-r--r--include/ingen/URIs.hpp293
-rw-r--r--include/ingen/World.hpp20
-rw-r--r--include/ingen/client/ArcModel.hpp14
-rw-r--r--include/ingen/client/BlockModel.hpp12
-rw-r--r--include/ingen/client/ClientStore.hpp26
-rw-r--r--include/ingen/client/GraphModel.hpp20
-rw-r--r--include/ingen/client/ObjectModel.hpp14
-rw-r--r--include/ingen/client/PluginModel.hpp22
-rw-r--r--include/ingen/client/PluginUI.hpp36
-rw-r--r--include/ingen/client/PortModel.hpp28
-rw-r--r--include/ingen/client/SigClientInterface.hpp18
-rw-r--r--include/ingen/client/SocketClient.hpp27
-rw-r--r--include/ingen/client/client.h31
-rw-r--r--include/ingen/filesystem.hpp87
-rw-r--r--include/ingen/fmt.hpp8
-rw-r--r--include/ingen/ingen.h21
-rw-r--r--include/ingen/memory.hpp6
-rw-r--r--include/ingen/paths.hpp10
-rw-r--r--include/ingen/runtime_paths.hpp4
55 files changed, 756 insertions, 935 deletions
diff --git a/include/ingen/Arc.hpp b/include/ingen/Arc.hpp
index 1d21b65e..d456edfb 100644
--- a/include/ingen/Arc.hpp
+++ b/include/ingen/Arc.hpp
@@ -17,10 +17,12 @@
#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; }
+namespace raul {
+class Path;
+} // namespace raul
namespace ingen {
diff --git a/include/ingen/Atom.hpp b/include/ingen/Atom.hpp
index 3fb8f091..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>
@@ -41,7 +41,8 @@ namespace ingen {
In either case, the data is stored in a binary compatible format to LV2_Atom
(i.e., if the value is dynamically allocated, the header is repeated there).
*/
-class INGEN_API Atom {
+class INGEN_API Atom
+{
public:
Atom() noexcept = default;
@@ -93,21 +94,22 @@ public:
return *this;
}
- inline bool operator==(const Atom& other) const {
+ bool operator==(const Atom& other) const {
if (_atom.type != other._atom.type ||
_atom.size != other._atom.size) {
return false;
}
+
return is_reference()
? !memcmp(_body.ptr, other._body.ptr, sizeof(LV2_Atom) + _atom.size)
: _body.val == other._body.val;
}
- inline bool operator!=(const Atom& other) const {
+ bool operator!=(const Atom& other) const {
return !operator==(other);
}
- inline bool operator<(const Atom& other) const {
+ bool operator<(const Atom& other) const {
if (_atom.type == other._atom.type) {
const uint32_t min_size = std::min(_atom.size, other._atom.size);
const int cmp = is_reference()
@@ -115,6 +117,7 @@ public:
: memcmp(&_body.val, &other._body.val, min_size);
return cmp < 0 || (cmp == 0 && _atom.size < other._atom.size);
}
+
return type() < other.type();
}
@@ -122,25 +125,25 @@ public:
* Always real-time safe.
* @return true iff set succeeded.
*/
- inline bool set_rt(const Atom& other) {
+ bool set_rt(const Atom& other) {
if (is_reference()) {
return false;
- } else {
- _atom = other._atom;
- _body.val = other._body.val;
- return true;
}
+
+ _atom = other._atom;
+ _body.val = other._body.val;
+ return true;
}
- inline uint32_t size() const { return _atom.size; }
- inline LV2_URID type() const { return _atom.type; }
- inline bool is_valid() const { return _atom.type; }
+ uint32_t size() const { return _atom.size; }
+ LV2_URID type() const { return _atom.type; }
+ bool is_valid() const { return _atom.type; }
- inline const void* get_body() const {
+ const void* get_body() const {
return is_reference() ? static_cast<void*>(_body.ptr + 1) : &_body.val;
}
- inline void* get_body() {
+ void* get_body() {
return is_reference() ? static_cast<void*>(_body.ptr + 1) : &_body.val;
}
@@ -159,14 +162,14 @@ public:
private:
/** Free dynamically allocated value, if applicable. */
- inline void dealloc() {
+ void dealloc() {
if (is_reference()) {
free(_body.ptr);
}
}
/** Return true iff this value is dynamically allocated. */
- inline bool is_reference() const {
+ bool is_reference() const {
return _atom.size > sizeof(_body.val);
}
diff --git a/include/ingen/AtomForge.hpp b/include/ingen/AtomForge.hpp
index bc44b698..5d696923 100644
--- a/include/ingen/AtomForge.hpp
+++ b/include/ingen/AtomForge.hpp
@@ -17,57 +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{}
- , _size{0}
- , _capacity{8 * sizeof(LV2_Atom)}
- , _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); } };
@@ -76,53 +60,23 @@ 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);
- }
-
- size_t _size; ///< Current atom size
- size_t _capacity; ///< Allocated size of atom buffer
- SratomPtr _sratom; ///< Atom serialiser
- AtomPtr _buf; ///< Atom buffer
+ 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
+ SratomPtr _sratom; ///< Atom serialiser
+ AtomPtr _buf; ///< Atom buffer
};
-} // namespace ingen
+} // namespace ingen
-#endif // INGEN_ATOMFORGE_HPP
+#endif // INGEN_ATOMFORGE_HPP
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 395eba54..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>
@@ -27,7 +27,8 @@ namespace ingen {
/** A sink for LV2 Atoms.
* @ingroup IngenShared
*/
-class INGEN_API AtomSink {
+class INGEN_API AtomSink
+{
public:
virtual ~AtomSink() = default;
diff --git a/include/ingen/AtomWriter.hpp b/include/ingen/AtomWriter.hpp
index 492e7ff6..e391870d 100644
--- a/include/ingen/AtomWriter.hpp
+++ b/include/ingen/AtomWriter.hpp
@@ -17,19 +17,21 @@
#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>
-namespace raul { class Path; }
+namespace raul {
+class Path;
+} // namespace raul
namespace ingen {
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 deea0495..9e20a031 100644
--- a/include/ingen/Clock.hpp
+++ b/include/ingen/Clock.hpp
@@ -28,15 +28,16 @@
namespace ingen {
-class Clock {
+class Clock
+{
public:
#ifdef __MACH__
Clock() { mach_timebase_info(&_timebase); }
- inline uint64_t now_microseconds() const {
+ 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:
@@ -44,11 +45,11 @@ private:
#else
- inline uint64_t now_microseconds() const {
+ 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 aadb2980..666a044e 100644
--- a/include/ingen/ColorContext.hpp
+++ b/include/ingen/ColorContext.hpp
@@ -17,23 +17,29 @@
#ifndef INGEN_COLORCONTEXT_HPP
#define INGEN_COLORCONTEXT_HPP
-#include "ingen/ingen.h"
+#include <ingen/ingen.h>
#include <cstdio>
namespace ingen {
-class INGEN_API ColorContext {
+class INGEN_API ColorContext
+{
public:
enum class Color { RED = 31, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE };
ColorContext(FILE* stream, Color color);
~ColorContext();
+ ColorContext(const ColorContext&) = delete;
+ ColorContext& operator=(const ColorContext&) = delete;
+ ColorContext(ColorContext&&) = delete;
+ ColorContext& operator=(ColorContext&&) = delete;
+
private:
FILE* _stream;
};
-} // namespace ingen
+} // namespace ingen
-#endif // INGEN_COLORCONTEXT_HPP
+#endif // INGEN_COLORCONTEXT_HPP
diff --git a/include/ingen/Configuration.hpp b/include/ingen/Configuration.hpp
index 16c20811..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>
@@ -37,7 +37,8 @@ class URIMap;
/** Ingen configuration (command line options and/or configuration file).
* @ingroup IngenShared
*/
-class INGEN_API Configuration {
+class INGEN_API Configuration
+{
public:
explicit Configuration(Forge& forge);
@@ -46,9 +47,9 @@ public:
* This controls when and where an option will be saved or restored.
*/
enum Scope {
- GLOBAL = 1, ///< Applies to any Ingen instance
- SESSION = 1<<1, ///< Applies to this Ingen instance only
- GUI = 1<<2 ///< Persistent GUI settings saved at exit
+ GLOBAL = 1, ///< Applies to any Ingen instance
+ SESSION = 1 << 1, ///< Applies to this Ingen instance only
+ GUI = 1 << 2 ///< Persistent GUI settings saved at exit
};
/** Add a configuration option.
@@ -81,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);
@@ -132,7 +133,7 @@ private:
};
struct OptionNameOrder {
- inline bool operator()(const Option& a, const Option& b) {
+ bool operator()(const Option& a, const Option& b) {
return a.name < b.name;
}
};
@@ -152,7 +153,7 @@ private:
Options _options;
Keys _keys;
ShortNames _short_names;
- size_t _max_name_length;
+ size_t _max_name_length{0};
};
} // namespace ingen
diff --git a/include/ingen/DataAccess.hpp b/include/ingen/DataAccess.hpp
index 3ea70eff..c18c74f3 100644
--- a/include/ingen/DataAccess.hpp
+++ b/include/ingen/DataAccess.hpp
@@ -17,21 +17,20 @@
#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>
namespace ingen {
-struct DataAccess : public ingen::LV2Features::Feature
-{
+struct DataAccess : public ingen::LV2Features::Feature {
static void delete_feature(LV2_Feature* feature) {
free(feature->data);
delete feature;
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 3d077266..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,108 +17,11 @@
#ifndef INGEN_FILEPATH_HPP
#define INGEN_FILEPATH_HPP
-#include "ingen/ingen.h"
-
-#include <boost/utility/string_view.hpp> // IWYU pragma: export
-
-#include <ostream>
-#include <string>
-#include <utility>
-
-#if defined(_WIN32) && !defined(__CYGWIN__)
-#define USE_WINDOWS_FILE_PATHS 1
-#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:
-#ifdef 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 54f5d3a9..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>
@@ -33,7 +33,8 @@ class URI;
/** Forge for Atoms.
* @ingroup IngenShared
*/
-class INGEN_API Forge : public LV2_Atom_Forge {
+class INGEN_API Forge : public LV2_Atom_Forge
+{
public:
explicit Forge(URIMap& map);
@@ -43,38 +44,38 @@ public:
return atom.type() == URI || atom.type() == URID;
}
- static Atom make() { return Atom(); }
- Atom make(int32_t v) { return Atom(sizeof(v), Int, &v); }
- Atom make(float v) { return Atom(sizeof(v), Float, &v); }
+ static Atom make() { return {}; }
+ Atom make(int32_t v) { return {sizeof(v), Int, &v}; }
+ Atom make(float v) { return {sizeof(v), Float, &v}; }
Atom make(bool v) {
const int32_t iv = v ? 1 : 0;
- return Atom(sizeof(int32_t), Bool, &iv);
+ return {sizeof(int32_t), Bool, &iv};
}
- Atom make_urid(int32_t v) { return Atom(sizeof(int32_t), URID, &v); }
+ Atom make_urid(int32_t v) { return {sizeof(int32_t), URID, &v}; }
Atom make_urid(const ingen::URI& u);
static Atom alloc(uint32_t s, uint32_t t, const void* v) {
- return Atom(s, t, v);
+ return {s, t, v};
}
Atom alloc(const char* v) {
- const size_t len = strlen(v);
- return Atom(len + 1, String, v);
+ const auto len = static_cast<uint32_t>(strlen(v));
+ return {len + 1U, String, v};
}
Atom alloc(const std::string& v) {
- return Atom(v.length() + 1, String, v.c_str());
+ return {static_cast<uint32_t>(v.length()) + 1U, String, v.c_str()};
}
Atom alloc_uri(const char* v) {
- const size_t len = strlen(v);
- return Atom(len + 1, URI, v);
+ const auto len = static_cast<uint32_t>(strlen(v));
+ return {len + 1U, URI, v};
}
Atom alloc_uri(const std::string& v) {
- return Atom(v.length() + 1, URI, v.c_str());
+ return {static_cast<uint32_t>(v.length()) + 1U, URI, v.c_str()};
}
private:
diff --git a/include/ingen/InstanceAccess.hpp b/include/ingen/InstanceAccess.hpp
index e108d7d5..66a2b5c3 100644
--- a/include/ingen/InstanceAccess.hpp
+++ b/include/ingen/InstanceAccess.hpp
@@ -17,19 +17,18 @@
#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>
namespace ingen {
-struct InstanceAccess : public ingen::LV2Features::Feature
-{
+struct InstanceAccess : public ingen::LV2Features::Feature {
const char* uri() const override { return "http://lv2plug.in/ns/ext/instance-access"; }
std::shared_ptr<LV2_Feature> feature(World& world, Node* node) override {
diff --git a/include/ingen/Interface.hpp b/include/ingen/Interface.hpp
index cb17039e..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>
@@ -65,75 +65,75 @@ public:
* @{
*/
- inline void operator()(const Message& msg) { message(msg); }
+ void operator()(const Message& msg) { message(msg); }
- inline void set_response_id(int32_t id) { _seq = id; }
+ void set_response_id(int32_t id) { _seq = id; }
- inline void bundle_begin() { message(BundleBegin{_seq++}); }
- inline void bundle_end() { message(BundleEnd{_seq++}); }
+ void bundle_begin() { message(BundleBegin{_seq++}); }
+ void bundle_end() { message(BundleEnd{_seq++}); }
- inline void put(const URI& uri,
- const Properties& properties,
- Resource::Graph ctx = Resource::Graph::DEFAULT)
+ void put(const URI& uri,
+ const Properties& properties,
+ Resource::Graph ctx = Resource::Graph::DEFAULT)
{
message(Put{_seq++, uri, properties, ctx});
}
- inline void delta(const URI& uri,
- const Properties& remove,
- const Properties& add,
- Resource::Graph ctx = Resource::Graph::DEFAULT)
+ void delta(const URI& uri,
+ const Properties& remove,
+ const Properties& add,
+ Resource::Graph ctx = Resource::Graph::DEFAULT)
{
message(Delta{_seq++, uri, remove, add, ctx});
}
- inline void copy(const URI& old_uri, const URI& new_uri)
+ void copy(const URI& old_uri, const URI& new_uri)
{
message(Copy{_seq++, old_uri, new_uri});
}
- inline void move(const raul::Path& old_path, const raul::Path& new_path)
+ void move(const raul::Path& old_path, const raul::Path& new_path)
{
message(Move{_seq++, old_path, new_path});
}
- inline void del(const URI& uri) { message(Del{_seq++, uri}); }
+ void del(const URI& uri) { message(Del{_seq++, uri}); }
- inline void connect(const raul::Path& tail, const raul::Path& head)
+ void connect(const raul::Path& tail, const raul::Path& head)
{
message(Connect{_seq++, tail, head});
}
- inline void disconnect(const raul::Path& tail, const raul::Path& head)
+ void disconnect(const raul::Path& tail, const raul::Path& head)
{
message(Disconnect{_seq++, tail, head});
}
- inline void disconnect_all(const raul::Path& graph, const raul::Path& path)
+ void disconnect_all(const raul::Path& graph, const raul::Path& path)
{
message(DisconnectAll{_seq++, graph, path});
}
- inline void set_property(const URI& subject,
- const URI& predicate,
- const Atom& value,
- Resource::Graph ctx = Resource::Graph::DEFAULT)
+ void set_property(const URI& subject,
+ const URI& predicate,
+ const Atom& value,
+ Resource::Graph ctx = Resource::Graph::DEFAULT)
{
message(SetProperty{_seq++, subject, predicate, value, ctx});
}
- inline void undo() { message(Undo{_seq++}); }
+ void undo() { message(Undo{_seq++}); }
- inline void redo() { message(Redo{_seq++}); }
+ void redo() { message(Redo{_seq++}); }
- inline void get(const URI& uri) { message(Get{_seq++, uri}); }
+ void get(const URI& uri) { message(Get{_seq++, uri}); }
- inline void response(int32_t id, Status status, const std::string& subject)
+ void response(int32_t id, Status status, const std::string& subject)
{
message(Response{id, status, subject});
}
- inline void error(const std::string& error_message)
+ void error(const std::string& error_message)
{
message(Error{_seq++, error_message});
}
diff --git a/include/ingen/LV2Features.hpp b/include/ingen/LV2Features.hpp
index f61b9b85..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>
@@ -33,11 +33,13 @@ class World;
/** Features for use by LV2 plugins.
* @ingroup IngenShared
*/
-class INGEN_API LV2Features {
+class INGEN_API LV2Features
+{
public:
LV2Features() = default;
- class Feature {
+ class Feature
+ {
public:
virtual ~Feature() = default;
@@ -50,9 +52,10 @@ public:
static void free_feature(LV2_Feature* feature);
};
- class EmptyFeature : public Feature {
+ class EmptyFeature : public Feature
+ {
public:
- explicit EmptyFeature(const char* uri) : _uri(uri) {}
+ explicit EmptyFeature(const char* uri) noexcept : _uri(uri) {}
const char* uri() const override { return _uri; }
@@ -64,7 +67,8 @@ public:
const char* _uri;
};
- class FeatureArray : public raul::Noncopyable {
+ class FeatureArray : public raul::Noncopyable
+ {
public:
using FeatureVector = std::vector<std::shared_ptr<LV2_Feature>>;
diff --git a/include/ingen/Library.hpp b/include/ingen/Library.hpp
index fd4f4260..99dfff4c 100644
--- a/include/ingen/Library.hpp
+++ b/include/ingen/Library.hpp
@@ -17,19 +17,22 @@
#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 {
/** A dynamically loaded library (module, plugin). */
-class INGEN_API Library {
+class INGEN_API Library
+{
public:
- Library(const FilePath& path);
+ explicit Library(const FilePath& path);
~Library();
- Library(const Library&) = delete;
+ Library(const Library&) = delete;
Library& operator=(const Library&) = delete;
+ Library(Library&&) = delete;
+ Library& operator=(Library&&) = delete;
using VoidFuncPtr = void (*)();
@@ -37,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 5310c768..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,9 +33,9 @@ namespace ingen {
class Node;
class URIs;
-class World;
-class INGEN_API Log {
+class INGEN_API Log
+{
public:
using Sink = std::function<int(LV2_URID, const char*, va_list)>;
@@ -88,21 +86,20 @@ 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;
- bool _flush;
- bool _trace;
+ bool _flush{false};
+ bool _trace{false};
};
} // namespace ingen
-#endif // INGEN_LOG_HPP
+#endif // INGEN_LOG_HPP
diff --git a/include/ingen/Message.hpp b/include/ingen/Message.hpp
index b7342eba..be0b5d00 100644
--- a/include/ingen/Message.hpp
+++ b/include/ingen/Message.hpp
@@ -17,52 +17,45 @@
#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 {
-struct BundleBegin
-{
+struct BundleBegin {
int32_t seq;
};
-struct BundleEnd
-{
+struct BundleEnd {
int32_t seq;
};
-struct Connect
-{
+struct Connect {
int32_t seq;
raul::Path tail;
raul::Path head;
};
-struct Copy
-{
+struct Copy {
int32_t seq;
URI old_uri;
URI new_uri;
};
-struct Del
-{
+struct Del {
int32_t seq;
URI uri;
};
-struct Delta
-{
+struct Delta {
int32_t seq;
URI uri;
Properties remove;
@@ -70,61 +63,52 @@ struct Delta
Resource::Graph ctx;
};
-struct Disconnect
-{
+struct Disconnect {
int32_t seq;
raul::Path tail;
raul::Path head;
};
-struct DisconnectAll
-{
+struct DisconnectAll {
int32_t seq;
raul::Path graph;
raul::Path path;
};
-struct Error
-{
+struct Error {
int32_t seq;
std::string message;
};
-struct Get
-{
+struct Get {
int32_t seq;
URI subject;
};
-struct Move
-{
+struct Move {
int32_t seq;
raul::Path old_path;
raul::Path new_path;
};
-struct Put
-{
+struct Put {
int32_t seq;
URI uri;
Properties properties;
Resource::Graph ctx;
};
-struct Redo
-{
+struct Redo {
int32_t seq;
};
-struct Response
-{
+struct Response {
int32_t id;
Status status;
std::string subject;
};
-struct SetProperty
-{
+struct SetProperty {
int32_t seq;
URI subject;
URI predicate;
@@ -132,28 +116,27 @@ struct SetProperty
Resource::Graph ctx;
};
-struct Undo
-{
+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>;
-
-} // namespace ingen
-
-#endif // INGEN_MESSAGE_HPP
+using Message = std::variant<BundleBegin,
+ BundleEnd,
+ Connect,
+ Copy,
+ Del,
+ Delta,
+ Disconnect,
+ DisconnectAll,
+ Error,
+ Get,
+ Move,
+ Put,
+ Redo,
+ Response,
+ SetProperty,
+ Undo>;
+
+} // namespace ingen
+
+#endif // INGEN_MESSAGE_HPP
diff --git a/include/ingen/Module.hpp b/include/ingen/Module.hpp
index b540fe7d..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>
@@ -31,9 +31,11 @@ class World;
* All components of Ingen reside in one of these.
* @ingroup IngenShared
*/
-class INGEN_API Module {
+class INGEN_API Module
+{
public:
- Module() : library(nullptr) {}
+ Module() noexcept : library(nullptr) {}
+
virtual ~Module() = default;
Module(const Module&) = delete;
@@ -44,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;
@@ -55,8 +57,14 @@ public:
extern "C" {
+#ifdef _WIN32
+# define INGEN_MODULE_EXPORT __declspec(dllexport)
+#else
+# define INGEN_MODULE_EXPORT __attribute__((visibility("default")))
+#endif
+
/** Prototype for the ingen_module_load() entry point in an ingen module. */
-INGEN_API ingen::Module* ingen_module_load();
+INGEN_MODULE_EXPORT ingen::Module* ingen_module_load();
}
diff --git a/include/ingen/Node.hpp b/include/ingen/Node.hpp
index 3733b51e..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.
@@ -65,8 +65,8 @@ public:
using Arcs = std::map<ArcsKey, std::shared_ptr<Arc>>;
// Graphs only
- Arcs& arcs() { return _arcs; }
- const Arcs& arcs() const { return _arcs; }
+ Arcs& arcs() { return _graph_arcs; }
+ const Arcs& arcs() const { return _graph_arcs; }
// Blocks and graphs only
virtual uint32_t num_ports() const { return 0; }
@@ -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;
@@ -98,7 +102,7 @@ protected:
: Resource(uris, path_to_uri(path))
{}
- Arcs _arcs; ///< Graphs only
+ Arcs _graph_arcs; ///< Graphs only
};
} // namespace ingen
diff --git a/include/ingen/Parser.hpp b/include/ingen/Parser.hpp
index f2cd951f..8db64104 100644
--- a/include/ingen/Parser.hpp
+++ b/include/ingen/Parser.hpp
@@ -17,20 +17,21 @@
#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>
-namespace Sord { class World; }
+namespace Sord {
+class World;
+} // namespace Sord
namespace ingen {
@@ -42,7 +43,8 @@ class World;
@ingroup Ingen
*/
-class INGEN_API Parser {
+class INGEN_API Parser
+{
public:
explicit Parser() = default;
@@ -50,16 +52,16 @@ public:
/** Record of a resource listed in a bundle manifest. */
struct ResourceRecord {
- inline ResourceRecord(URI u, FilePath f)
+ ResourceRecord(URI u, FilePath f)
: uri(std::move(u)), filename(std::move(f))
{}
- inline bool operator<(const ResourceRecord& r) const {
+ bool operator<(const ResourceRecord& r) const {
return uri < r.uri;
}
- URI uri; ///< URI of resource (e.g. a Graph)
- FilePath filename; ///< Path of describing file (seeAlso)
+ URI uri; ///< URI of resource (e.g. a Graph)
+ FilePath filename; ///< Path of describing file (seeAlso)
};
/** Find all resources of a given type listed in a manifest file. */
@@ -77,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 1a80d0af..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>
@@ -28,7 +28,8 @@
namespace ingen {
/** A property value (an Atom with a context). */
-class Property : public Atom {
+class Property : public Atom
+{
public:
enum class Graph {
DEFAULT, ///< Default context for "universal" properties
@@ -53,12 +54,18 @@ private:
Graph _ctx;
};
-class Properties : public std::multimap<URI, Property> {
+class Properties : public std::multimap<URI, Property>
+{
public:
using Graph = Property::Graph;
Properties() = default;
- Properties(const Properties& copy) = default;
+
+ Properties(const Properties&) = default;
+ Properties& operator=(const Properties&) = default;
+
+ Properties(Properties&&) = default;
+ Properties& operator=(Properties&&) = default;
Properties(std::initializer_list<value_type> l)
: std::multimap<URI, Property>(l)
@@ -77,7 +84,7 @@ public:
}
bool contains(const URI& key, const Atom& value) {
- for (const_iterator i = find(key); i != end() && i->first == key; ++i) {
+ for (auto i = find(key); i != end() && i->first == key; ++i) {
if (i->second == value) {
return true;
}
diff --git a/include/ingen/QueuedInterface.hpp b/include/ingen/QueuedInterface.hpp
index 97fbb731..ab2c2532 100644
--- a/include/ingen/QueuedInterface.hpp
+++ b/include/ingen/QueuedInterface.hpp
@@ -17,11 +17,10 @@
#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 <algorithm>
#include <memory>
#include <mutex>
#include <utility>
@@ -38,20 +37,19 @@ class QueuedInterface : public Interface
public:
explicit QueuedInterface(std::shared_ptr<Interface> sink)
: _sink(std::move(sink))
- {
- }
+ {}
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 577e8cc0..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>
@@ -69,9 +69,12 @@ public:
static Graph uri_to_graph(const URI& uri) {
if (uri == INGEN_NS "externalContext") {
return Graph::EXTERNAL;
- } else if (uri == INGEN_NS "internalContext") {
+ }
+
+ if (uri == INGEN_NS "internalContext") {
return Graph::INTERNAL;
}
+
return Graph::DEFAULT;
}
@@ -172,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 37eda462..6e9d6ad4 100644
--- a/include/ingen/Serialiser.hpp
+++ b/include/ingen/Serialiser.hpp
@@ -17,15 +17,17 @@
#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>
-namespace raul { class Path; }
+namespace raul {
+class Path;
+} // namespace raul
namespace ingen {
@@ -54,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)
@@ -75,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);
@@ -98,6 +100,7 @@ public:
private:
struct Impl;
+
std::unique_ptr<Impl> me;
};
diff --git a/include/ingen/SocketReader.hpp b/include/ingen/SocketReader.hpp
index f86a9bd6..d0d62747 100644
--- a/include/ingen/SocketReader.hpp
+++ b/include/ingen/SocketReader.hpp
@@ -17,15 +17,17 @@
#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>
#include <thread>
-namespace raul { class Socket; }
+namespace raul {
+class Socket;
+} // namespace raul
namespace ingen {
@@ -72,15 +74,15 @@ private:
World& _world;
Interface& _iface;
- SerdEnv* _env;
- SordInserter* _inserter;
- SordNode* _msg_node;
+ SerdEnv* _env{nullptr};
+ SordInserter* _inserter{nullptr};
+ SordNode* _msg_node{nullptr};
std::shared_ptr<raul::Socket> _socket;
- int _socket_error;
- bool _exit_flag;
+ int _socket_error{0};
+ bool _exit_flag{false};
std::thread _thread;
};
-} // namespace ingen
+} // namespace ingen
-#endif // INGEN_SOCKETREADER_HPP
+#endif // INGEN_SOCKETREADER_HPP
diff --git a/include/ingen/SocketWriter.hpp b/include/ingen/SocketWriter.hpp
index a0896ad9..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>
@@ -52,6 +52,6 @@ protected:
std::shared_ptr<raul::Socket> _socket;
};
-} // namespace ingen
+} // namespace ingen
-#endif // INGEN_SOCKETWRITER_HPP
+#endif // INGEN_SOCKETWRITER_HPP
diff --git a/include/ingen/Status.hpp b/include/ingen/Status.hpp
index c4ffd4c9..fbd23dc0 100644
--- a/include/ingen/Status.hpp
+++ b/include/ingen/Status.hpp
@@ -50,7 +50,7 @@ enum class Status {
COMPILATION_FAILED
};
-static inline const char*
+inline const char*
ingen_status_string(Status st)
{
switch (st) {
diff --git a/include/ingen/Store.hpp b/include/ingen/Store.hpp
index 67ea16fa..d18858fb 100644
--- a/include/ingen/Store.hpp
+++ b/include/ingen/Store.hpp
@@ -17,17 +17,19 @@
#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>
#include <mutex>
#include <utility>
-namespace raul { class Symbol; }
+namespace raul {
+class Symbol;
+} // namespace raul
namespace ingen {
@@ -44,7 +46,7 @@ public:
void add(Node* o);
Node* get(const raul::Path& path) {
- const iterator i = find(path);
+ const auto i = find(path);
return (i == end()) ? nullptr : i->second.get();
}
diff --git a/include/ingen/StreamWriter.hpp b/include/ingen/StreamWriter.hpp
index 620497f8..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>
@@ -47,6 +47,6 @@ protected:
ColorContext::Color _color;
};
-} // namespace ingen
+} // namespace ingen
-#endif // INGEN_STREAMWRITER_HPP
+#endif // INGEN_STREAMWRITER_HPP
diff --git a/include/ingen/Tee.hpp b/include/ingen/Tee.hpp
index 1e6805cc..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>
@@ -34,7 +34,7 @@ class Tee : public Interface
public:
using Sinks = std::vector<std::shared_ptr<Interface>>;
- explicit Tee(Sinks sinks) : _sinks(std::move(sinks)) {}
+ explicit Tee(Sinks sinks) noexcept : _sinks(std::move(sinks)) {}
std::shared_ptr<Interface> respondee() const override {
return _sinks.front()->respondee();
@@ -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 d9aa13d3..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>
@@ -57,13 +57,13 @@ protected:
URIMap& _map;
Sratom* _sratom;
SerdNode _base;
- SerdURI _base_uri;
+ SerdURI _base_uri{SERD_URI_NULL};
SerdEnv* _env;
SerdWriter* _writer;
URI _uri;
- bool _wrote_prefixes;
+ bool _wrote_prefixes{false};
};
-} // namespace ingen
+} // namespace ingen
-#endif // INGEN_TURTLEWRITER_HPP
+#endif // INGEN_TURTLEWRITER_HPP
diff --git a/include/ingen/URI.hpp b/include/ingen/URI.hpp
index b8108224..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,10 +52,11 @@ 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; }
- std::string string() const { return std::string(c_str(), _node.n_bytes); }
+ std::string string() const { return {c_str(), _node.n_bytes}; }
size_t length() const { return _node.n_bytes; }
const char* c_str() const
@@ -99,10 +98,10 @@ public:
}
private:
- URI(SerdNode node, SerdURI uri);
+ URI(const SerdNode& node, const SerdURI& uri);
static Chunk make_chunk(const SerdChunk& chunk) {
- return Chunk(reinterpret_cast<const char*>(chunk.buf), chunk.len);
+ return {reinterpret_cast<const char*>(chunk.buf), chunk.len};
}
SerdURI _uri;
@@ -173,4 +172,4 @@ operator<<(std::basic_ostream<Char, Traits>& os, const URI& uri)
} // namespace ingen
-#endif // INGEN_URI_HPP
+#endif // INGEN_URI_HPP
diff --git a/include/ingen/URIMap.hpp b/include/ingen/URIMap.hpp
index 465f87f1..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,13 +34,12 @@
namespace ingen {
class Log;
-class Node;
-class World;
/** URI to integer map and implementation of LV2 URID extension.
* @ingroup IngenShared
*/
-class INGEN_API URIMap : public raul::Noncopyable {
+class INGEN_API URIMap : public raul::Noncopyable
+{
public:
URIMap(Log& log, LV2_URID_Map* map, LV2_URID_Unmap* unmap);
@@ -48,7 +47,8 @@ public:
uint32_t map_uri(const std::string& uri) { return map_uri(uri.c_str()); }
const char* unmap_uri(uint32_t urid) const;
- class Feature : public LV2Features::Feature {
+ class Feature : public LV2Features::Feature
+ {
public:
Feature(const char* URI, void* data) : _feature{URI, data} {}
@@ -56,8 +56,7 @@ public:
std::shared_ptr<LV2_Feature> feature(World&, Node*) override
{
- return std::shared_ptr<LV2_Feature>(&_feature,
- NullDeleter<LV2_Feature>);
+ return {&_feature, NullDeleter<LV2_Feature>};
}
private:
@@ -93,8 +92,13 @@ public:
const LV2_URID_Map& urid_map() const { return _urid_map_feature->data(); }
LV2_URID_Map& urid_map() { return _urid_map_feature->data(); }
- const LV2_URID_Unmap& urid_unmap() const { return _urid_unmap_feature->data(); }
- LV2_URID_Unmap& urid_unmap() { return _urid_unmap_feature->data(); }
+
+ const LV2_URID_Unmap& urid_unmap() const
+ {
+ return _urid_unmap_feature->data();
+ }
+
+ LV2_URID_Unmap& urid_unmap() { return _urid_unmap_feature->data(); }
std::shared_ptr<URIDMapFeature> urid_map_feature()
{
diff --git a/include/ingen/URIs.hpp b/include/ingen/URIs.hpp
index cfa00f73..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 {
@@ -37,7 +37,8 @@ class URIMap;
*
* @ingroup ingen
*/
-class INGEN_API URIs : public raul::Noncopyable {
+class INGEN_API URIs : public raul::Noncopyable
+{
public:
URIs(ingen::Forge& ingen_forge, URIMap* map, LilvWorld* lworld);
@@ -69,142 +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 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
@@ -212,9 +214,12 @@ operator==(const URIs::Quark& lhs, const Atom& rhs)
{
if (rhs.type() == lhs.urid_atom().type()) {
return rhs == lhs.urid_atom();
- } else if (rhs.type() == lhs.uri_atom().type()) {
+ }
+
+ if (rhs.type() == lhs.uri_atom().type()) {
return rhs == lhs.uri_atom();
}
+
return false;
}
diff --git a/include/ingen/World.hpp b/include/ingen/World.hpp
index ecf1d45a..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>
@@ -29,7 +28,9 @@
using LilvWorld = struct LilvWorldImpl;
-namespace Sord { class World; }
+namespace Sord {
+class World;
+} // namespace Sord
namespace ingen {
@@ -62,7 +63,8 @@ class URIs;
*
* @ingroup IngenShared
*/
-class INGEN_API World : public raul::Noncopyable {
+class INGEN_API World : public raul::Noncopyable
+{
public:
/** Construct a new Ingen world.
* @param map LV2 URID map implementation, or null to use internal.
@@ -148,6 +150,6 @@ private:
Impl* _impl;
};
-} // namespace ingen
+} // namespace ingen
-#endif // INGEN_WORLD_HPP
+#endif // INGEN_WORLD_HPP
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 060d454f..db41f4ef 100644
--- a/include/ingen/client/BlockModel.hpp
+++ b/include/ingen/client/BlockModel.hpp
@@ -17,12 +17,12 @@
#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>
diff --git a/include/ingen/client/ClientStore.hpp b/include/ingen/client/ClientStore.hpp
index 3aec363f..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>
@@ -78,22 +78,22 @@ public:
void message(const Message& msg) override;
- void operator()(const BundleBegin&) {}
- void operator()(const BundleEnd&) {}
+ void operator()(const BundleBegin&) noexcept {}
+ void operator()(const BundleEnd&) noexcept {}
void operator()(const Connect&);
void operator()(const Copy&);
void operator()(const Del&);
void operator()(const Delta&);
void operator()(const Disconnect&);
void operator()(const DisconnectAll&);
- void operator()(const Error&) {}
- void operator()(const Get&) {}
+ void operator()(const Error&) noexcept {}
+ void operator()(const Get&) noexcept {}
void operator()(const Move&);
void operator()(const Put&);
- void operator()(const Redo&) {}
- void operator()(const Response&) {}
+ void operator()(const Redo&) noexcept {}
+ void operator()(const Response&) noexcept {}
void operator()(const SetProperty&);
- void operator()(const Undo&) {}
+ void operator()(const Undo&) noexcept {}
INGEN_SIGNAL(new_object, void, std::shared_ptr<ObjectModel>)
INGEN_SIGNAL(new_plugin, void, std::shared_ptr<PluginModel>)
diff --git a/include/ingen/client/GraphModel.hpp b/include/ingen/client/GraphModel.hpp
index 59d1bb65..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,12 +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 b0a61e94..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>
@@ -124,7 +124,7 @@ private:
Atom _type;
const LilvPlugin* _lilv_plugin;
Presets _presets;
- bool _fetched;
+ bool _fetched{false};
};
} // namespace client
diff --git a/include/ingen/client/PluginUI.hpp b/include/ingen/client/PluginUI.hpp
index 35a14bd2..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>
@@ -43,7 +43,8 @@ class BlockModel;
*
* @ingroup IngenClient
*/
-class INGEN_API PluginUI {
+class INGEN_API PluginUI
+{
public:
~PluginUI();
@@ -60,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.
*/
@@ -81,11 +82,12 @@ public:
* The application must connect to this signal to communicate with the
* engine and/or update itself as necessary.
*/
- INGEN_SIGNAL(property_changed, void,
- const URI&, // Subject
- const URI&, // Predicate
- const Atom&, // Object
- Resource::Graph) // Context
+ INGEN_SIGNAL(property_changed,
+ void,
+ const URI&, // Subject
+ const URI&, // Predicate
+ const Atom&, // Object
+ Resource::Graph) // Context
ingen::World& world() const { return _world; }
std::shared_ptr<const BlockModel> block() const { return _block; }
@@ -99,11 +101,11 @@ private:
ingen::World& _world;
std::shared_ptr<const BlockModel> _block;
- SuilInstance* _instance;
- LilvUIs* _uis;
- const LilvUI* _ui;
- LilvNode* _ui_node;
- LilvNode* _ui_type;
+ SuilInstance* _instance{nullptr};
+ LilvUIs* _uis{nullptr};
+ const LilvUI* _ui{nullptr};
+ LilvNode* _ui_node{nullptr};
+ LilvNode* _ui_type{nullptr};
std::set<uint32_t> _subscribed_ports;
static SuilHost* ui_host;
diff --git a/include/ingen/client/PortModel.hpp b/include/ingen/client/PortModel.hpp
index 9323b84b..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 {
@@ -48,10 +46,10 @@ public:
bool supports(const URIs::Quark& value_type) const;
- inline uint32_t index() const { return _index; }
- inline const Atom& value() const { return get_property(_uris.ingen_value); }
- inline bool is_input() const { return (_direction == Direction::INPUT); }
- inline bool is_output() const { return (_direction == Direction::OUTPUT); }
+ uint32_t index() const { return _index; }
+ const Atom& value() const { return get_property(_uris.ingen_value); }
+ bool is_input() const { return (_direction == Direction::INPUT); }
+ bool is_output() const { return (_direction == Direction::OUTPUT); }
bool port_property(const URIs::Quark& uri) const;
@@ -65,7 +63,7 @@ public:
}
bool is_uri() const;
- inline bool operator==(const PortModel& pm) const { return (path() == pm.path()); }
+ bool operator==(const PortModel& pm) const { return (path() == pm.path()); }
void on_property(const URI& uri, const Atom& value) override;
@@ -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 1e75ae80..23f8a3ff 100644
--- a/include/ingen/client/SocketClient.hpp
+++ b/include/ingen/client/SocketClient.hpp
@@ -14,21 +14,20 @@
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>
#include <memory>
-#include <string>
namespace ingen {
@@ -67,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));
@@ -87,7 +86,7 @@ private:
SocketReader _reader;
};
-} // namespace client
-} // namespace ingen
+} // namespace client
+} // namespace ingen
-#endif // INGEN_CLIENT_SOCKET_CLIENT_HPP
+#endif // INGEN_CLIENT_SOCKETCLIENT_HPP
diff --git a/include/ingen/client/client.h b/include/ingen/client/client.h
new file mode 100644
index 00000000..6f7ac9b5
--- /dev/null
+++ b/include/ingen/client/client.h
@@ -0,0 +1,31 @@
+/*
+ This file is part of Ingen.
+ Copyright 2014-2022 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_CLIENT_CLIENT_H
+#define INGEN_CLIENT_CLIENT_H
+
+#if defined(_WIN32) && !defined(INGEN_CLIENT_STATIC) && \
+ defined(INGEN_CLIENT_INTERNAL)
+# define INGEN_CLIENT_API __declspec(dllexport)
+#elif defined(_WIN32) && !defined(INGEN_CLIENT_STATIC)
+# define INGEN_CLIENT_API __declspec(dllimport)
+#elif defined(__GNUC__)
+# define INGEN_CLIENT_API __attribute__((visibility("default")))
+#else
+# define INGEN_CLIENT_API
+#endif
+
+#endif // INGEN_CLIENT_CLIENT_H
diff --git a/include/ingen/filesystem.hpp b/include/ingen/filesystem.hpp
deleted file mode 100644
index abe7684e..00000000
--- a/include/ingen/filesystem.hpp
+++ /dev/null
@@ -1,87 +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
-
-#define _BSD_SOURCE 1
-#define _DEFAULT_SOURCE 1
-
-#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 FilePath(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/ingen.h b/include/ingen/ingen.h
index ccdb5596..9292de46 100644
--- a/include/ingen/ingen.h
+++ b/include/ingen/ingen.h
@@ -17,21 +17,14 @@
#ifndef INGEN_INGEN_H
#define INGEN_INGEN_H
-#ifdef INGEN_SHARED
-# ifdef _WIN32
-# define INGEN_LIB_IMPORT __declspec(dllimport)
-# define INGEN_LIB_EXPORT __declspec(dllexport)
-# else
-# define INGEN_LIB_IMPORT __attribute__((visibility("default")))
-# define INGEN_LIB_EXPORT __attribute__((visibility("default")))
-# endif
-# ifdef INGEN_INTERNAL
-# define INGEN_API INGEN_LIB_EXPORT
-# else
-# define INGEN_API INGEN_LIB_IMPORT
-# endif
+#if defined(_WIN32) && !defined(INGEN_STATIC) && defined(INGEN_INTERNAL)
+# define INGEN_API __declspec(dllexport)
+#elif defined(_WIN32) && !defined(INGEN_STATIC)
+# define INGEN_API __declspec(dllimport)
+#elif defined(__GNUC__)
+# define INGEN_API __attribute__((visibility("default")))
#else
-# define INGEN_API
+# define INGEN_API
#endif
#define INGEN_NS "http://drobilla.net/ns/ingen#"
diff --git a/include/ingen/memory.hpp b/include/ingen/memory.hpp
index 6a62d317..a1dba436 100644
--- a/include/ingen/memory.hpp
+++ b/include/ingen/memory.hpp
@@ -18,16 +18,14 @@
#define INGEN_MEMORY_HPP
#include <cstdlib>
-#include <memory>
-#include <utility>
namespace ingen {
template <class T>
-void NullDeleter(T* ptr) {}
+void NullDeleter(T* ptr) noexcept {}
template <class T>
-struct FreeDeleter { void operator()(T* const ptr) { free(ptr); } };
+struct FreeDeleter { void operator()(T* const ptr) noexcept { free(ptr); } };
} // namespace ingen
diff --git a/include/ingen/paths.hpp b/include/ingen/paths.hpp
index fefdf364..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>
@@ -32,10 +32,10 @@ inline bool uri_is_path(const URI& uri)
const size_t root_len = main_uri().string().length();
if (uri == main_uri()) {
return true;
- } else {
- return uri.string().substr(0, root_len + 1) ==
- main_uri().string() + "/";
}
+
+ return uri.string().substr(0, root_len + 1) ==
+ main_uri().string() + "/";
}
inline raul::Path uri_to_path(const URI& uri)
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>