diff options
Diffstat (limited to 'src/ingen')
-rw-r--r-- | src/ingen/.clang-tidy | 3 | ||||
-rw-r--r-- | src/ingen/ingen.cpp | 61 |
2 files changed, 34 insertions, 30 deletions
diff --git a/src/ingen/.clang-tidy b/src/ingen/.clang-tidy new file mode 100644 index 00000000..e7bf0b6a --- /dev/null +++ b/src/ingen/.clang-tidy @@ -0,0 +1,3 @@ +Checks: > + -bugprone-exception-escape, +InheritParentConfig: true diff --git a/src/ingen/ingen.cpp b/src/ingen/ingen.cpp index c7c3ef74..7f1a587e 100644 --- a/src/ingen/ingen.cpp +++ b/src/ingen/ingen.cpp @@ -14,29 +14,26 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/Atom.hpp" -#include "ingen/Configuration.hpp" -#include "ingen/EngineBase.hpp" -#include "ingen/FilePath.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Message.hpp" -#include "ingen/Parser.hpp" -#include "ingen/URI.hpp" -#include "ingen/World.hpp" -#include "ingen/fmt.hpp" -#include "ingen/paths.hpp" -#include "ingen/runtime_paths.hpp" -#include "ingen_config.h" -#include "raul/Path.hpp" -#include "raul/Symbol.hpp" -#include "serd/serd.h" - -#ifdef HAVE_SOCKET +#include <ingen/Atom.hpp> +#include <ingen/Configuration.hpp> +#include <ingen/EngineBase.hpp> +#include <ingen/Interface.hpp> +#include <ingen/Message.hpp> +#include <ingen/Parser.hpp> +#include <ingen/URI.hpp> +#include <ingen/World.hpp> +#include <ingen/fmt.hpp> +#include <ingen/paths.hpp> +#include <ingen/runtime_paths.hpp> +#include <ingen_config.h> +#include <raul/Path.hpp> +#include <raul/Symbol.hpp> +#include <serd/serd.h> + +#if USE_SOCKET #include "ingen/client/SocketClient.hpp" #endif -#include <boost/optional/optional.hpp> - #include <chrono> #include <csignal> #include <cstdint> @@ -45,6 +42,7 @@ #include <iostream> #include <memory> #include <mutex> +#include <optional> #include <string> #include <thread> @@ -99,16 +97,19 @@ run(int argc, char** argv) { // Create world try { - world = std::unique_ptr<ingen::World>( - new ingen::World(nullptr, nullptr, nullptr)); + world = std::make_unique<ingen::World>(nullptr, nullptr, nullptr); world->load_configuration(argc, argv); if (argc <= 1) { world->conf().print_usage("ingen", std::cout); return EXIT_FAILURE; - } else if (world->conf().option("help").get<int32_t>()) { + } + + if (world->conf().option("help").get<int32_t>()) { world->conf().print_usage("ingen", std::cout); return EXIT_SUCCESS; - } else if (world->conf().option("version").get<int32_t>()) { + } + + if (world->conf().option("version").get<int32_t>()) { return print_version(); } } catch (std::exception& e) { @@ -130,11 +131,11 @@ run(int argc, char** argv) ingen_try(world->load_module("server"), "Failed to load server module"); - ingen_try(bool(world->engine()), "Unable to create engine"); + ingen_try(!!world->engine(), "Unable to create engine"); world->engine()->listen(); } -#ifdef HAVE_SOCKET +#if USE_SOCKET client::SocketClient::register_factories(*world); #endif @@ -177,8 +178,8 @@ run(int argc, char** argv) // Load a graph if (conf.option("load").is_valid()) { - boost::optional<raul::Path> parent; - boost::optional<raul::Symbol> symbol; + std::optional<raul::Path> parent; + std::optional<raul::Symbol> symbol; const Atom& path_option = conf.option("path"); if (path_option.is_valid()) { @@ -194,14 +195,14 @@ run(int argc, char** argv) } } - ingen_try(bool(world->parser()), "Failed to create parser"); + ingen_try(!!world->parser(), "Failed to create parser"); const std::string graph = conf.option("load").ptr<char>(); engine_interface->get(URI("ingen:/plugins")); engine_interface->get(main_uri()); - std::lock_guard<std::mutex> lock(world->rdf_mutex()); + const std::lock_guard<std::mutex> lock{world->rdf_mutex()}; world->parser()->parse_file( *world, *engine_interface, graph, parent, symbol); } else if (conf.option("server-load").is_valid()) { |