From a95952c12c5acb24c50020bcee9ecac619c42f83 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sat, 7 Sep 2024 22:36:24 +0200 Subject: [PATCH] Apply clang-format Llvm on C++ code run-clang-tidy -checks='-*,modernize-concat-nested-namespaces' -fix --- chapter01/policy_example/src/main.cpp | 2 +- chapter01/simple_executable/src/main.cpp | 2 +- .../framework/components/component1.hpp | 6 ++--- chapter02/component1/src/component1.cpp | 6 ++--- .../framework/components/component2.hpp | 6 ++--- chapter02/component2/src/component2.cpp | 6 ++--- .../components/component_interface.hpp | 6 ++--- chapter02/driver_app/src/main.cpp | 2 +- chapter02/simple_example/src/main.cpp | 2 +- .../hello_header_only/hello_header_only.hpp | 11 ++++---- .../include/hello_object/hello_object.hpp | 2 +- .../hello_object_lib/src/hello_object.cpp | 2 +- .../hello_shared_lib/include/hello/hello.hpp | 24 ++++++++--------- chapter03/hello_shared_lib/src/hello.cpp | 8 +++--- chapter03/hello_shared_lib/src/internal.cpp | 11 ++++---- chapter03/hello_shared_lib/src/internal.hpp | 10 +++---- .../include/hello/hello.hpp | 25 ++++++++--------- .../src/hello.cpp | 8 +++--- .../src/internal.cpp | 11 ++++---- .../src/internal.hpp | 10 +++---- .../hello_static_lib/include/hello/hello.hpp | 25 ++++++++--------- chapter03/hello_static_lib/src/hello.cpp | 8 +++--- chapter03/hello_static_lib/src/internal.cpp | 11 ++++---- chapter03/hello_static_lib/src/internal.hpp | 10 +++---- chapter03/hello_world_standalone/src/main.cpp | 5 +--- chapter03/src/main.cpp | 2 +- chapter04/ex01_executable/src/main.cpp | 4 +-- .../ex02_static/include/chapter4/ex02/lib.hpp | 6 ++--- chapter04/ex02_static/src/lib.cpp | 6 ++--- .../ex04_directory/dir2/chapter4_hello.hpp | 2 +- .../include/chapter4/ex05/lib.hpp | 6 ++--- .../ex05_config_file_package/src/lib.cpp | 6 ++--- chapter04/ex05_consumer/src/main.cpp | 8 +++--- chapter04/ex06_pack/executable/src/main.cpp | 8 +++--- .../library/include/chapter4/ex06/lib.hpp | 2 +- chapter04/ex06_pack/library/src/lib.cpp | 2 +- .../executable/src/main.cpp | 2 -- .../library/include/chapter4/ex07/lib.hpp | 2 +- .../library/src/lib.cpp | 2 +- chapter05/conan_example/src/main.cpp | 5 ++-- chapter05/external_project/src/main.cpp | 10 +++---- chapter05/fetch_content_example/src/main.cpp | 16 +++++------ .../dep/include/obscure/obscure.hpp | 25 ++++++++--------- chapter05/find_module/dep/src/internal.cpp | 11 ++++---- chapter05/find_module/dep/src/internal.hpp | 10 +++---- chapter05/find_module/dep/src/obscure.cpp | 8 +++--- chapter05/find_module/src/main.cpp | 10 +++---- chapter05/vcpkg_example/src/main.cpp | 18 ++++++------- .../include/chapter6/ex01/calculator.hpp | 9 +++---- .../chapter6/ex01/calculator_interface.hpp | 9 +++---- chapter06/ex01_doxdocgen/src/calculator.cpp | 6 ++--- chapter06/ex01_doxdocgen/src/main.cpp | 2 +- chapter06/ex02_doxplantuml/src/main.cpp | 2 +- chapter07/clang_tidy_example/src/main.cpp | 4 +-- .../src/coverage_example/coverage_example.cpp | 2 +- .../coverage_example/src/coverage_test.cpp | 16 +++++------ chapter07/cppcheck_example/src/main.cpp | 2 +- chapter07/cpplint_example/src/main.cpp | 2 +- .../src/coverage_example/coverage_example.cpp | 2 +- .../custom_build_type/src/coverage_test.cpp | 16 +++++------ chapter07/fixture_example/src/main.cpp | 5 +--- chapter07/fixture_example/src/server.cpp | 2 +- chapter07/iwyu_example/src/main.cpp | 4 +-- chapter07/lwyu_example/src/main.cpp | 4 +-- chapter07/pass_fail_criteria/src/main.cpp | 2 +- chapter07/resource_group_example/src/main.cpp | 11 ++++---- .../simple_sanitizer_example/src/main.cpp | 2 +- chapter07/simple_test/src/main.cpp | 5 +--- chapter07/test_labels/src/main.cpp | 6 +---- chapter07/timeout_example/src/main.cpp | 11 ++++---- .../src/main.cpp | 2 +- chapter08/configure_file_example/src/main.cpp | 2 +- chapter08/custom_command_example/src/main.cpp | 2 +- .../src/main.cpp | 2 +- .../execute_process_example/src/main.cpp | 2 +- chapter10/ex01_external_deps/src/tests.cpp | 4 +-- .../src/tests.cpp | 2 +- chapter10/ex03_simple_qt_app/main.cpp | 17 ++++++------ .../framework_example/include/hello/hello.hpp | 2 +- chapter11/framework_example/src/hello.cpp | 8 +++--- chapter11/framework_example/src/internal.cpp | 11 ++++---- chapter11/framework_example/src/internal.hpp | 10 +++---- .../android-example/include/hello/hello.hpp | 25 ++++++++--------- chapter12/android-example/src/hello.cpp | 8 +++--- chapter12/android-example/src/internal.cpp | 11 ++++---- chapter12/android-example/src/internal.hpp | 10 +++---- chapter12/check_push_pop/include/hello.hpp | 4 +-- chapter12/emulator-example/src/main.cpp | 2 +- chapter12/iOS_example/include/hello/hello.hpp | 25 ++++++++--------- chapter12/iOS_example/src/hello.cpp | 8 +++--- chapter12/iOS_example/src/internal.cpp | 11 ++++---- chapter12/iOS_example/src/internal.hpp | 10 +++---- .../test-executable/test.cpp | 5 ++-- .../ex03_external_cmake_module/src/main.cpp | 4 +-- .../precompiled_headers/src/eratosthenes.cpp | 27 +++++++++---------- .../precompiled_headers/src/fibonacci.cpp | 4 +-- chapter14/precompiled_headers/src/main.cpp | 26 +++++++++--------- chapter14/unity_build/src/eratosthenes.cpp | 27 +++++++++---------- chapter14/unity_build/src/fibonacci.cpp | 5 ++-- chapter14/unity_build/src/main.cpp | 26 +++++++++--------- .../unity_build_group/src/eratosthenes.cpp | 27 +++++++++---------- chapter14/unity_build_group/src/fibonacci.cpp | 4 +-- chapter14/unity_build_group/src/main.cpp | 26 +++++++++--------- 103 files changed, 398 insertions(+), 475 deletions(-) diff --git a/chapter01/policy_example/src/main.cpp b/chapter01/policy_example/src/main.cpp index fee593a..cf0e2bd 100644 --- a/chapter01/policy_example/src/main.cpp +++ b/chapter01/policy_example/src/main.cpp @@ -1 +1 @@ -int main(int, char **) { return 0; } \ No newline at end of file +int main(int, char **) { return 0; } diff --git a/chapter01/simple_executable/src/main.cpp b/chapter01/simple_executable/src/main.cpp index b1dae1c..0ad1424 100644 --- a/chapter01/simple_executable/src/main.cpp +++ b/chapter01/simple_executable/src/main.cpp @@ -3,4 +3,4 @@ int main(int, char **) { std::cout << "Welcome to CMake Best Practices\n"; return 0; -} \ No newline at end of file +} diff --git a/chapter02/component1/include/framework/components/component1.hpp b/chapter02/component1/include/framework/components/component1.hpp index a016a78..42f5e95 100644 --- a/chapter02/component1/include/framework/components/component1.hpp +++ b/chapter02/component1/include/framework/components/component1.hpp @@ -10,8 +10,7 @@ #include -namespace framework { -namespace components { +namespace framework::components { /** * @brief Component 1 interface @@ -43,5 +42,4 @@ class component1 : public component_interface { */ virtual int do_other_stuff(int param) override; }; // class component1 -} // namespace components -} // namespace framework \ No newline at end of file +} // namespace framework::components diff --git a/chapter02/component1/src/component1.cpp b/chapter02/component1/src/component1.cpp index 3b53b84..9570b12 100644 --- a/chapter02/component1/src/component1.cpp +++ b/chapter02/component1/src/component1.cpp @@ -10,8 +10,7 @@ #include -namespace framework { -namespace components { +namespace framework::components { component1::component1() { std::cout << "Component 1 is constructed" << std::endl; @@ -24,5 +23,4 @@ component1::~component1() { bool component1::do_stuff() const { return false; } int component1::do_other_stuff(int param) { return param; } -} // namespace components -} // namespace framework \ No newline at end of file +} // namespace framework::components diff --git a/chapter02/component2/include/framework/components/component2.hpp b/chapter02/component2/include/framework/components/component2.hpp index e04e4d2..3230f66 100644 --- a/chapter02/component2/include/framework/components/component2.hpp +++ b/chapter02/component2/include/framework/components/component2.hpp @@ -10,8 +10,7 @@ #include -namespace framework { -namespace components { +namespace framework::components { /** * @brief Component 1 interface @@ -43,5 +42,4 @@ class component2 : public component_interface { */ virtual int do_other_stuff(int param) override; }; // class component2 -} // namespace components -} // namespace framework \ No newline at end of file +} // namespace framework::components diff --git a/chapter02/component2/src/component2.cpp b/chapter02/component2/src/component2.cpp index edd38a1..0149fd4 100644 --- a/chapter02/component2/src/component2.cpp +++ b/chapter02/component2/src/component2.cpp @@ -11,8 +11,7 @@ #include #include -namespace framework { -namespace components { +namespace framework::components { component2::component2() { std::cout << "Component 2 is constructed" << std::endl; @@ -25,5 +24,4 @@ component2::~component2() { bool component2::do_stuff() const { return true; } int component2::do_other_stuff(int param) { return std::sqrt(param) * 2; } -} // namespace components -} // namespace framework \ No newline at end of file +} // namespace framework::components diff --git a/chapter02/component_interface/include/framework/components/component_interface.hpp b/chapter02/component_interface/include/framework/components/component_interface.hpp index 5581088..e08156b 100644 --- a/chapter02/component_interface/include/framework/components/component_interface.hpp +++ b/chapter02/component_interface/include/framework/components/component_interface.hpp @@ -8,8 +8,7 @@ #pragma once -namespace framework { -namespace components { +namespace framework::components { /** * @brief Component interface */ @@ -35,5 +34,4 @@ class component_interface { */ virtual int do_other_stuff(int param) = 0; }; // class component_interface -} // namespace components -} // namespace framework \ No newline at end of file +} // namespace framework::components diff --git a/chapter02/driver_app/src/main.cpp b/chapter02/driver_app/src/main.cpp index e9687bd..f706694 100644 --- a/chapter02/driver_app/src/main.cpp +++ b/chapter02/driver_app/src/main.cpp @@ -56,4 +56,4 @@ int main(void) { } return component_1->do_other_stuff(1) + component_2->do_other_stuff(3); -} \ No newline at end of file +} diff --git a/chapter02/simple_example/src/main.cpp b/chapter02/simple_example/src/main.cpp index b1dae1c..0ad1424 100644 --- a/chapter02/simple_example/src/main.cpp +++ b/chapter02/simple_example/src/main.cpp @@ -3,4 +3,4 @@ int main(int, char **) { std::cout << "Welcome to CMake Best Practices\n"; return 0; -} \ No newline at end of file +} diff --git a/chapter03/hello_header_only/include/hello_header_only/hello_header_only.hpp b/chapter03/hello_header_only/include/hello_header_only/hello_header_only.hpp index 7a1268b..c7a4ad8 100644 --- a/chapter03/hello_header_only/include/hello_header_only/hello_header_only.hpp +++ b/chapter03/hello_header_only/include/hello_header_only/hello_header_only.hpp @@ -3,9 +3,8 @@ #include #include -namespace hello_header_only -{ - void print_hello(const std::string& name) { - std::cout << "Hello " << name << " from a header only library\n"; - } -} \ No newline at end of file +namespace hello_header_only { +void print_hello(const std::string &name) { + std::cout << "Hello " << name << " from a header only library\n"; +} +} // namespace hello_header_only diff --git a/chapter03/hello_object_lib/include/hello_object/hello_object.hpp b/chapter03/hello_object_lib/include/hello_object/hello_object.hpp index a462eaa..fe066e4 100644 --- a/chapter03/hello_object_lib/include/hello_object/hello_object.hpp +++ b/chapter03/hello_object_lib/include/hello_object/hello_object.hpp @@ -13,4 +13,4 @@ class HelloObject { private: const std::string name_; }; -} // namespace hello_object \ No newline at end of file +} // namespace hello_object diff --git a/chapter03/hello_object_lib/src/hello_object.cpp b/chapter03/hello_object_lib/src/hello_object.cpp index 23ba99a..c360c66 100644 --- a/chapter03/hello_object_lib/src/hello_object.cpp +++ b/chapter03/hello_object_lib/src/hello_object.cpp @@ -6,4 +6,4 @@ namespace hello_object { void HelloObject::greet() const { std::cout << "Hello " << name_ << " From an object library\n"; } -} // namespace hello_object \ No newline at end of file +} // namespace hello_object diff --git a/chapter03/hello_shared_lib/include/hello/hello.hpp b/chapter03/hello_shared_lib/include/hello/hello.hpp index 9867549..6a00e0b 100644 --- a/chapter03/hello_shared_lib/include/hello/hello.hpp +++ b/chapter03/hello_shared_lib/include/hello/hello.hpp @@ -1,17 +1,17 @@ -#pragma once +#pragma once -#include #include "hello/export_hello.hpp" +#include +namespace hello { +/// Example class that is explicitly exported into a dll +class CH3_HELLO_SHARED_EXPORT Hello { +public: + Hello(const std::string &name) : name_{name} {} -namespace hello{ - /// Example class that is explicitly exported into a dll - class CH3_HELLO_SHARED_EXPORT Hello { - public: - Hello(const std::string& name) : name_{name} {} + void greet() const; - void greet() const; - private: - const std::string name_; - }; -} \ No newline at end of file +private: + const std::string name_; +}; +} // namespace hello diff --git a/chapter03/hello_shared_lib/src/hello.cpp b/chapter03/hello_shared_lib/src/hello.cpp index c94ad58..705564c 100644 --- a/chapter03/hello_shared_lib/src/hello.cpp +++ b/chapter03/hello_shared_lib/src/hello.cpp @@ -2,8 +2,6 @@ #include "internal.hpp" -namespace hello{ - void Hello::greet() const { - details::print_impl(name_); - } -} \ No newline at end of file +namespace hello { +void Hello::greet() const { details::print_impl(name_); } +} // namespace hello diff --git a/chapter03/hello_shared_lib/src/internal.cpp b/chapter03/hello_shared_lib/src/internal.cpp index cc8faf9..03053c3 100644 --- a/chapter03/hello_shared_lib/src/internal.cpp +++ b/chapter03/hello_shared_lib/src/internal.cpp @@ -2,9 +2,8 @@ #include -namespace hello::details{ - void print_impl(const std::string& name) - { - std::cout << "Hello " << name << " from a shared library\n"; - } -} \ No newline at end of file +namespace hello::details { +void print_impl(const std::string &name) { + std::cout << "Hello " << name << " from a shared library\n"; +} +} // namespace hello::details diff --git a/chapter03/hello_shared_lib/src/internal.hpp b/chapter03/hello_shared_lib/src/internal.hpp index 9b39759..b4b4d8e 100644 --- a/chapter03/hello_shared_lib/src/internal.hpp +++ b/chapter03/hello_shared_lib/src/internal.hpp @@ -1,9 +1,9 @@ -#pragma once +#pragma once #include -namespace hello::details{ +namespace hello::details { - void print_impl(const std::string& name); - -} \ No newline at end of file +void print_impl(const std::string &name); + +} diff --git a/chapter03/hello_simple_library_example/include/hello/hello.hpp b/chapter03/hello_simple_library_example/include/hello/hello.hpp index 84b618e..d9d9ce1 100644 --- a/chapter03/hello_simple_library_example/include/hello/hello.hpp +++ b/chapter03/hello_simple_library_example/include/hello/hello.hpp @@ -1,15 +1,16 @@ -#pragma once +#pragma once #include -namespace hello{ - /// Example class that is explicitly exported into a dll - class Hello { - public: - Hello(const std::string& name) : name_{name} {} - - void greet() const; - private: - const std::string name_; - }; -} \ No newline at end of file +namespace hello { +/// Example class that is explicitly exported into a dll +class Hello { +public: + Hello(const std::string &name) : name_{name} {} + + void greet() const; + +private: + const std::string name_; +}; +} // namespace hello diff --git a/chapter03/hello_simple_library_example/src/hello.cpp b/chapter03/hello_simple_library_example/src/hello.cpp index c94ad58..705564c 100644 --- a/chapter03/hello_simple_library_example/src/hello.cpp +++ b/chapter03/hello_simple_library_example/src/hello.cpp @@ -2,8 +2,6 @@ #include "internal.hpp" -namespace hello{ - void Hello::greet() const { - details::print_impl(name_); - } -} \ No newline at end of file +namespace hello { +void Hello::greet() const { details::print_impl(name_); } +} // namespace hello diff --git a/chapter03/hello_simple_library_example/src/internal.cpp b/chapter03/hello_simple_library_example/src/internal.cpp index cc8faf9..03053c3 100644 --- a/chapter03/hello_simple_library_example/src/internal.cpp +++ b/chapter03/hello_simple_library_example/src/internal.cpp @@ -2,9 +2,8 @@ #include -namespace hello::details{ - void print_impl(const std::string& name) - { - std::cout << "Hello " << name << " from a shared library\n"; - } -} \ No newline at end of file +namespace hello::details { +void print_impl(const std::string &name) { + std::cout << "Hello " << name << " from a shared library\n"; +} +} // namespace hello::details diff --git a/chapter03/hello_simple_library_example/src/internal.hpp b/chapter03/hello_simple_library_example/src/internal.hpp index 9b39759..b4b4d8e 100644 --- a/chapter03/hello_simple_library_example/src/internal.hpp +++ b/chapter03/hello_simple_library_example/src/internal.hpp @@ -1,9 +1,9 @@ -#pragma once +#pragma once #include -namespace hello::details{ +namespace hello::details { - void print_impl(const std::string& name); - -} \ No newline at end of file +void print_impl(const std::string &name); + +} diff --git a/chapter03/hello_static_lib/include/hello/hello.hpp b/chapter03/hello_static_lib/include/hello/hello.hpp index 84b618e..d9d9ce1 100644 --- a/chapter03/hello_static_lib/include/hello/hello.hpp +++ b/chapter03/hello_static_lib/include/hello/hello.hpp @@ -1,15 +1,16 @@ -#pragma once +#pragma once #include -namespace hello{ - /// Example class that is explicitly exported into a dll - class Hello { - public: - Hello(const std::string& name) : name_{name} {} - - void greet() const; - private: - const std::string name_; - }; -} \ No newline at end of file +namespace hello { +/// Example class that is explicitly exported into a dll +class Hello { +public: + Hello(const std::string &name) : name_{name} {} + + void greet() const; + +private: + const std::string name_; +}; +} // namespace hello diff --git a/chapter03/hello_static_lib/src/hello.cpp b/chapter03/hello_static_lib/src/hello.cpp index c94ad58..705564c 100644 --- a/chapter03/hello_static_lib/src/hello.cpp +++ b/chapter03/hello_static_lib/src/hello.cpp @@ -2,8 +2,6 @@ #include "internal.hpp" -namespace hello{ - void Hello::greet() const { - details::print_impl(name_); - } -} \ No newline at end of file +namespace hello { +void Hello::greet() const { details::print_impl(name_); } +} // namespace hello diff --git a/chapter03/hello_static_lib/src/internal.cpp b/chapter03/hello_static_lib/src/internal.cpp index cc8faf9..03053c3 100644 --- a/chapter03/hello_static_lib/src/internal.cpp +++ b/chapter03/hello_static_lib/src/internal.cpp @@ -2,9 +2,8 @@ #include -namespace hello::details{ - void print_impl(const std::string& name) - { - std::cout << "Hello " << name << " from a shared library\n"; - } -} \ No newline at end of file +namespace hello::details { +void print_impl(const std::string &name) { + std::cout << "Hello " << name << " from a shared library\n"; +} +} // namespace hello::details diff --git a/chapter03/hello_static_lib/src/internal.hpp b/chapter03/hello_static_lib/src/internal.hpp index 9b39759..b4b4d8e 100644 --- a/chapter03/hello_static_lib/src/internal.hpp +++ b/chapter03/hello_static_lib/src/internal.hpp @@ -1,9 +1,9 @@ -#pragma once +#pragma once #include -namespace hello::details{ +namespace hello::details { - void print_impl(const std::string& name); - -} \ No newline at end of file +void print_impl(const std::string &name); + +} diff --git a/chapter03/hello_world_standalone/src/main.cpp b/chapter03/hello_world_standalone/src/main.cpp index 594753c..ec8c77e 100644 --- a/chapter03/hello_world_standalone/src/main.cpp +++ b/chapter03/hello_world_standalone/src/main.cpp @@ -1,6 +1,3 @@ #include -int main(int, char**) -{ - std::cout << "Welcome to chapter 3\n"; -} \ No newline at end of file +int main(int, char **) { std::cout << "Welcome to chapter 3\n"; } diff --git a/chapter03/src/main.cpp b/chapter03/src/main.cpp index 054e2a7..d57e950 100644 --- a/chapter03/src/main.cpp +++ b/chapter03/src/main.cpp @@ -7,4 +7,4 @@ int main(int, char **) { hello::Hello hello("Jane Doe"); hello.greet(); return 0; -} \ No newline at end of file +} diff --git a/chapter04/ex01_executable/src/main.cpp b/chapter04/ex01_executable/src/main.cpp index 5ef5786..50d31b0 100644 --- a/chapter04/ex01_executable/src/main.cpp +++ b/chapter04/ex01_executable/src/main.cpp @@ -8,6 +8,4 @@ #include -int main(void) { - std::cout << "Hello from Chapter 4 executable!" << std::endl; -} \ No newline at end of file +int main(void) { std::cout << "Hello from Chapter 4 executable!" << std::endl; } diff --git a/chapter04/ex02_static/include/chapter4/ex02/lib.hpp b/chapter04/ex02_static/include/chapter4/ex02/lib.hpp index 568b848..98d4a15 100644 --- a/chapter04/ex02_static/include/chapter4/ex02/lib.hpp +++ b/chapter04/ex02_static/include/chapter4/ex02/lib.hpp @@ -8,8 +8,7 @@ #pragma once -namespace chapter4 { -namespace ex02 { +namespace chapter4::ex02 { /** * @brief The 'greeter' class interface */ @@ -20,5 +19,4 @@ class greeter { */ void greet(); }; // class greeter -} // namespace ex02 -} // namespace chapter4 \ No newline at end of file +} // namespace chapter4::ex02 diff --git a/chapter04/ex02_static/src/lib.cpp b/chapter04/ex02_static/src/lib.cpp index 994a0d0..e2c0621 100644 --- a/chapter04/ex02_static/src/lib.cpp +++ b/chapter04/ex02_static/src/lib.cpp @@ -9,10 +9,8 @@ #include #include -namespace chapter4 { -namespace ex02 { +namespace chapter4::ex02 { void greeter::greet() { std::cout << "Hello, world!" << std::endl; } -} // namespace ex02 -} // namespace chapter4 \ No newline at end of file +} // namespace chapter4::ex02 diff --git a/chapter04/ex04_directory/dir2/chapter4_hello.hpp b/chapter04/ex04_directory/dir2/chapter4_hello.hpp index 899476c..e50c7f3 100644 --- a/chapter04/ex04_directory/dir2/chapter4_hello.hpp +++ b/chapter04/ex04_directory/dir2/chapter4_hello.hpp @@ -1,3 +1,3 @@ #pragma once -// Hello! \ No newline at end of file +// Hello! diff --git a/chapter04/ex05_config_file_package/include/chapter4/ex05/lib.hpp b/chapter04/ex05_config_file_package/include/chapter4/ex05/lib.hpp index b06faa1..ef49dfe 100644 --- a/chapter04/ex05_config_file_package/include/chapter4/ex05/lib.hpp +++ b/chapter04/ex05_config_file_package/include/chapter4/ex05/lib.hpp @@ -8,8 +8,7 @@ #pragma once -namespace chapter4 { -namespace ex05 { +namespace chapter4::ex05 { /** * @brief The 'greeter' class interface */ @@ -20,5 +19,4 @@ class greeter { */ void greet(); }; // class greeter -} // namespace ex05 -} // namespace chapter4 \ No newline at end of file +} // namespace chapter4::ex05 diff --git a/chapter04/ex05_config_file_package/src/lib.cpp b/chapter04/ex05_config_file_package/src/lib.cpp index ab09123..36f5ce9 100644 --- a/chapter04/ex05_config_file_package/src/lib.cpp +++ b/chapter04/ex05_config_file_package/src/lib.cpp @@ -9,10 +9,8 @@ #include #include -namespace chapter4 { -namespace ex05 { +namespace chapter4::ex05 { void greeter::greet() { std::cout << "Hello, world!" << std::endl; } -} // namespace ex05 -} // namespace chapter4 \ No newline at end of file +} // namespace chapter4::ex05 diff --git a/chapter04/ex05_consumer/src/main.cpp b/chapter04/ex05_consumer/src/main.cpp index e1e9490..5debcf8 100644 --- a/chapter04/ex05_consumer/src/main.cpp +++ b/chapter04/ex05_consumer/src/main.cpp @@ -10,7 +10,7 @@ #include -int main(void){ - chapter4::ex05::greeter g; - g.greet(); -} \ No newline at end of file +int main(void) { + chapter4::ex05::greeter g; + g.greet(); +} diff --git a/chapter04/ex06_pack/executable/src/main.cpp b/chapter04/ex06_pack/executable/src/main.cpp index 83b6a08..83618c9 100644 --- a/chapter04/ex06_pack/executable/src/main.cpp +++ b/chapter04/ex06_pack/executable/src/main.cpp @@ -8,7 +8,7 @@ #include -int main(void){ - chapter4::ex06::greeter g; - g.greet(); -} \ No newline at end of file +int main(void) { + chapter4::ex06::greeter g; + g.greet(); +} diff --git a/chapter04/ex06_pack/library/include/chapter4/ex06/lib.hpp b/chapter04/ex06_pack/library/include/chapter4/ex06/lib.hpp index 6159a37..b0a94ad 100644 --- a/chapter04/ex06_pack/library/include/chapter4/ex06/lib.hpp +++ b/chapter04/ex06_pack/library/include/chapter4/ex06/lib.hpp @@ -21,4 +21,4 @@ class greeter { void greet(); }; // class greeter } // namespace ex06 -} // namespace chapter4 \ No newline at end of file +} // namespace chapter4 diff --git a/chapter04/ex06_pack/library/src/lib.cpp b/chapter04/ex06_pack/library/src/lib.cpp index a7963f9..2ff4ebe 100644 --- a/chapter04/ex06_pack/library/src/lib.cpp +++ b/chapter04/ex06_pack/library/src/lib.cpp @@ -15,4 +15,4 @@ namespace ex06 { void greeter::greet() { std::cout << "Hello, world!" << std::endl; } } // namespace ex06 -} // namespace chapter4 \ No newline at end of file +} // namespace chapter4 diff --git a/chapter04/ex07_pack_nsis_standalone/executable/src/main.cpp b/chapter04/ex07_pack_nsis_standalone/executable/src/main.cpp index d505a43..6118b76 100644 --- a/chapter04/ex07_pack_nsis_standalone/executable/src/main.cpp +++ b/chapter04/ex07_pack_nsis_standalone/executable/src/main.cpp @@ -13,8 +13,6 @@ #include #include - - int main(int, char **) { chapter4::ex07::greeter g; g.greet(); diff --git a/chapter04/ex07_pack_nsis_standalone/library/include/chapter4/ex07/lib.hpp b/chapter04/ex07_pack_nsis_standalone/library/include/chapter4/ex07/lib.hpp index 2eb76a8..ef7505e 100644 --- a/chapter04/ex07_pack_nsis_standalone/library/include/chapter4/ex07/lib.hpp +++ b/chapter04/ex07_pack_nsis_standalone/library/include/chapter4/ex07/lib.hpp @@ -21,4 +21,4 @@ class greeter { void greet(); }; // class greeter } // namespace ex07 -} // namespace chapter4 \ No newline at end of file +} // namespace chapter4 diff --git a/chapter04/ex07_pack_nsis_standalone/library/src/lib.cpp b/chapter04/ex07_pack_nsis_standalone/library/src/lib.cpp index 9665545..8edce0d 100644 --- a/chapter04/ex07_pack_nsis_standalone/library/src/lib.cpp +++ b/chapter04/ex07_pack_nsis_standalone/library/src/lib.cpp @@ -15,4 +15,4 @@ namespace ex07 { void greeter::greet() { std::cout << "Hello, world!" << std::endl; } } // namespace ex07 -} // namespace chapter4 \ No newline at end of file +} // namespace chapter4 diff --git a/chapter05/conan_example/src/main.cpp b/chapter05/conan_example/src/main.cpp index 723bb34..50bec24 100644 --- a/chapter05/conan_example/src/main.cpp +++ b/chapter05/conan_example/src/main.cpp @@ -1,6 +1,5 @@ #include -int main(int, char**) { +int main(int, char **) { fmt::print("Hello, world from the conanfile example!\n"); - -} \ No newline at end of file +} diff --git a/chapter05/external_project/src/main.cpp b/chapter05/external_project/src/main.cpp index 3efc142..c067c70 100644 --- a/chapter05/external_project/src/main.cpp +++ b/chapter05/external_project/src/main.cpp @@ -1,10 +1,8 @@ #include #include -int main(int argc, char**) -{ - Require(argc > 0, "Argc is bigger than 0"); +int main(int argc, char **) { + Require(argc > 0, "Argc is bigger than 0"); - std::cout << "Welcome to the fetch_content example\n"; - -} \ No newline at end of file + std::cout << "Welcome to the fetch_content example\n"; +} diff --git a/chapter05/fetch_content_example/src/main.cpp b/chapter05/fetch_content_example/src/main.cpp index c1d4021..db9889c 100644 --- a/chapter05/fetch_content_example/src/main.cpp +++ b/chapter05/fetch_content_example/src/main.cpp @@ -1,15 +1,15 @@ -#include #include +#include #include using namespace SI::literals; -int main(int argc, char**) -{ - constexpr auto speed_of_a_swallow_in_m = 11.2_m_p_s; - constexpr SI::kilometre_per_hour_t speed_in_km = speed_of_a_swallow_in_m; +int main(int argc, char **) { + constexpr auto speed_of_a_swallow_in_m = 11.2_m_p_s; + constexpr SI::kilometre_per_hour_t speed_in_km = + speed_of_a_swallow_in_m; - std::cout << "Did you know that an unladen swallow travels at approximately " << speed_of_a_swallow_in_m << " which is " << speed_in_km << "\n"; - -} \ No newline at end of file + std::cout << "Did you know that an unladen swallow travels at approximately " + << speed_of_a_swallow_in_m << " which is " << speed_in_km << "\n"; +} diff --git a/chapter05/find_module/dep/include/obscure/obscure.hpp b/chapter05/find_module/dep/include/obscure/obscure.hpp index 355e806..6500cef 100644 --- a/chapter05/find_module/dep/include/obscure/obscure.hpp +++ b/chapter05/find_module/dep/include/obscure/obscure.hpp @@ -1,15 +1,16 @@ -#pragma once +#pragma once #include -namespace obscure{ - /// Example class that is explicitly exported into a dll - class Obscure { - public: - Obscure(const std::string& name) : name_{name} {} - - void greet() const; - private: - const std::string name_; - }; -} \ No newline at end of file +namespace obscure { +/// Example class that is explicitly exported into a dll +class Obscure { +public: + Obscure(const std::string &name) : name_{name} {} + + void greet() const; + +private: + const std::string name_; +}; +} // namespace obscure diff --git a/chapter05/find_module/dep/src/internal.cpp b/chapter05/find_module/dep/src/internal.cpp index 833412e..86693d1 100644 --- a/chapter05/find_module/dep/src/internal.cpp +++ b/chapter05/find_module/dep/src/internal.cpp @@ -2,9 +2,8 @@ #include -namespace obscure::details{ - void print_impl(const std::string& name) - { - std::cout << "Hello " << name << " from an obscure library\n"; - } -} \ No newline at end of file +namespace obscure::details { +void print_impl(const std::string &name) { + std::cout << "Hello " << name << " from an obscure library\n"; +} +} // namespace obscure::details diff --git a/chapter05/find_module/dep/src/internal.hpp b/chapter05/find_module/dep/src/internal.hpp index 19b4893..c05fcef 100644 --- a/chapter05/find_module/dep/src/internal.hpp +++ b/chapter05/find_module/dep/src/internal.hpp @@ -1,9 +1,9 @@ -#pragma once +#pragma once #include -namespace obscure::details{ +namespace obscure::details { - void print_impl(const std::string& name); - -} \ No newline at end of file +void print_impl(const std::string &name); + +} diff --git a/chapter05/find_module/dep/src/obscure.cpp b/chapter05/find_module/dep/src/obscure.cpp index b6de789..3f6a5ef 100644 --- a/chapter05/find_module/dep/src/obscure.cpp +++ b/chapter05/find_module/dep/src/obscure.cpp @@ -2,8 +2,6 @@ #include "internal.hpp" -namespace obscure{ - void Obscure::greet() const { - details::print_impl(name_); - } -} \ No newline at end of file +namespace obscure { +void Obscure::greet() const { details::print_impl(name_); } +} // namespace obscure diff --git a/chapter05/find_module/src/main.cpp b/chapter05/find_module/src/main.cpp index 45f9af8..0da73d0 100644 --- a/chapter05/find_module/src/main.cpp +++ b/chapter05/find_module/src/main.cpp @@ -1,8 +1,6 @@ #include -int main(int, char**) -{ - obscure::Obscure greeter{"Arcane wizard"}; - greeter.greet(); - -} \ No newline at end of file +int main(int, char **) { + obscure::Obscure greeter{"Arcane wizard"}; + greeter.greet(); +} diff --git a/chapter05/vcpkg_example/src/main.cpp b/chapter05/vcpkg_example/src/main.cpp index 4124bab..eb45199 100644 --- a/chapter05/vcpkg_example/src/main.cpp +++ b/chapter05/vcpkg_example/src/main.cpp @@ -1,16 +1,16 @@ -#include #include +#include + +int main(int, char **) { -int main(int, char**) { + const char json[] = + " { \"hello\" : \"world\", \"t\" : true , \"f\" : false, \"n\": null, " + "\"i\":123, \"pi\": 3.1416, \"a\":[1, 2, 3, 4] } "; - const char json[] = " { \"hello\" : \"world\", \"t\" : true , \"f\" : false, \"n\": null, \"i\":123, \"pi\": 3.1416, \"a\":[1, 2, 3, 4] } "; - - rapidjson::Document document; + rapidjson::Document document; document.Parse(json); - if(document.HasMember("hello")) - { + if (document.HasMember("hello")) { std::cout << "Hello = " << document["hello"].GetString() << "\n"; } - -} \ No newline at end of file +} diff --git a/chapter06/ex01_doxdocgen/include/chapter6/ex01/calculator.hpp b/chapter06/ex01_doxdocgen/include/chapter6/ex01/calculator.hpp index 9b6e000..b8fc886 100644 --- a/chapter06/ex01_doxdocgen/include/chapter6/ex01/calculator.hpp +++ b/chapter06/ex01_doxdocgen/include/chapter6/ex01/calculator.hpp @@ -12,8 +12,7 @@ #include -namespace chapter6 { -namespace ex01 { +namespace chapter6::ex01 { /** * @brief The basic 'calculator' class * @@ -36,7 +35,8 @@ class calculator : private calculator_interface { * Calculate the difference of @p rhs from @p lhs * * @param [in] minuend The number to which @p subtrahend is subtracted - * @param [in] subtrahend The number which is to be subtracted from @p minuend + * @param [in] subtrahend The number which is to be subtracted from @p + * minuend * * @return double Difference of two numbers, @p minuend and @p subtrahend */ @@ -68,5 +68,4 @@ class calculator : private calculator_interface { */ double last_result{}; }; // class calculator -} // namespace ex01 -} // namespace chapter6 \ No newline at end of file +} // namespace chapter6::ex01 diff --git a/chapter06/ex01_doxdocgen/include/chapter6/ex01/calculator_interface.hpp b/chapter06/ex01_doxdocgen/include/chapter6/ex01/calculator_interface.hpp index d3b9d93..a38fa69 100644 --- a/chapter06/ex01_doxdocgen/include/chapter6/ex01/calculator_interface.hpp +++ b/chapter06/ex01_doxdocgen/include/chapter6/ex01/calculator_interface.hpp @@ -10,8 +10,7 @@ #pragma once -namespace chapter6 { -namespace ex01 { +namespace chapter6::ex01 { /** * @brief The 'calculator' class interface * @@ -33,7 +32,8 @@ class calculator_interface { * Calculate the difference of @p rhs from @p lhs * * @param [in] minuend The number to which @p subtrahend is subtracted - * @param [in] subtrahend The number which is to be subtracted from @p minuend + * @param [in] subtrahend The number which is to be subtracted from @p + * minuend * * @return double Difference of two numbers, @p minuend and @p subtrahend */ @@ -65,5 +65,4 @@ class calculator_interface { */ virtual ~calculator_interface() = default; }; // class calculator_interface -} // namespace ex01 -} // namespace chapter6 \ No newline at end of file +} // namespace chapter6::ex01 diff --git a/chapter06/ex01_doxdocgen/src/calculator.cpp b/chapter06/ex01_doxdocgen/src/calculator.cpp index dd330eb..dc2c307 100644 --- a/chapter06/ex01_doxdocgen/src/calculator.cpp +++ b/chapter06/ex01_doxdocgen/src/calculator.cpp @@ -10,8 +10,7 @@ #include -namespace chapter6 { -namespace ex01 { +namespace chapter6::ex01 { double calculator::sum(double augend, double addend) { return last_result = augend + addend; @@ -29,5 +28,4 @@ double calculator::div(double dividend, double divisor) { return last_result = dividend / divisor; } -} // namespace ex01 -} // namespace chapter6 \ No newline at end of file +} // namespace chapter6::ex01 diff --git a/chapter06/ex01_doxdocgen/src/main.cpp b/chapter06/ex01_doxdocgen/src/main.cpp index 8a410cf..7801601 100644 --- a/chapter06/ex01_doxdocgen/src/main.cpp +++ b/chapter06/ex01_doxdocgen/src/main.cpp @@ -25,4 +25,4 @@ int main(void) { std::cout << "5 / 6: " << calc.div(5, 6) << std::endl; // TIP OF THE DAY: return value is optional in main() function -} \ No newline at end of file +} diff --git a/chapter06/ex02_doxplantuml/src/main.cpp b/chapter06/ex02_doxplantuml/src/main.cpp index ead9118..e790fc2 100644 --- a/chapter06/ex02_doxplantuml/src/main.cpp +++ b/chapter06/ex02_doxplantuml/src/main.cpp @@ -29,4 +29,4 @@ int main(void) { while (std::getline(std::cin, input)) { std::cout << input; } -} \ No newline at end of file +} diff --git a/chapter07/clang_tidy_example/src/main.cpp b/chapter07/clang_tidy_example/src/main.cpp index 927ce1f..b0f6b53 100644 --- a/chapter07/clang_tidy_example/src/main.cpp +++ b/chapter07/clang_tidy_example/src/main.cpp @@ -2,8 +2,8 @@ #include struct SomeStruct { -int x; -int y; + int x; + int y; }; int main(int, char **) { diff --git a/chapter07/coverage_example/src/coverage_example/coverage_example.cpp b/chapter07/coverage_example/src/coverage_example/coverage_example.cpp index 7991713..0463df9 100644 --- a/chapter07/coverage_example/src/coverage_example/coverage_example.cpp +++ b/chapter07/coverage_example/src/coverage_example/coverage_example.cpp @@ -22,4 +22,4 @@ std::vector check_for_divisibilty(int i) { return result; } -} // namespace coverage_example \ No newline at end of file +} // namespace coverage_example diff --git a/chapter07/coverage_example/src/coverage_test.cpp b/chapter07/coverage_example/src/coverage_test.cpp index 361814d..20e3b1b 100644 --- a/chapter07/coverage_example/src/coverage_test.cpp +++ b/chapter07/coverage_example/src/coverage_test.cpp @@ -1,16 +1,16 @@ -#include #include +#include -#include #include +#include int main(int, char **) { - auto result = coverage_example::check_for_divisibilty(15); - assert(std::find(result.begin(), result.end(), 2) == result.end()); - assert(std::find(result.begin(), result.end(), 3) != result.end()); - assert(std::find(result.begin(), result.end(), 5) != result.end()); - assert(std::find(result.begin(), result.end(), 7) == result.end()); + auto result = coverage_example::check_for_divisibilty(15); + assert(std::find(result.begin(), result.end(), 2) == result.end()); + assert(std::find(result.begin(), result.end(), 3) != result.end()); + assert(std::find(result.begin(), result.end(), 5) != result.end()); + assert(std::find(result.begin(), result.end(), 7) == result.end()); return 0; -} \ No newline at end of file +} diff --git a/chapter07/cppcheck_example/src/main.cpp b/chapter07/cppcheck_example/src/main.cpp index 980abd4..0a45d15 100644 --- a/chapter07/cppcheck_example/src/main.cpp +++ b/chapter07/cppcheck_example/src/main.cpp @@ -5,4 +5,4 @@ int main(int, char **) { delete[] i; std::cout << i[0] << "\n"; return 0; -} \ No newline at end of file +} diff --git a/chapter07/cpplint_example/src/main.cpp b/chapter07/cpplint_example/src/main.cpp index 980abd4..0a45d15 100644 --- a/chapter07/cpplint_example/src/main.cpp +++ b/chapter07/cpplint_example/src/main.cpp @@ -5,4 +5,4 @@ int main(int, char **) { delete[] i; std::cout << i[0] << "\n"; return 0; -} \ No newline at end of file +} diff --git a/chapter07/custom_build_type/src/coverage_example/coverage_example.cpp b/chapter07/custom_build_type/src/coverage_example/coverage_example.cpp index 7991713..0463df9 100644 --- a/chapter07/custom_build_type/src/coverage_example/coverage_example.cpp +++ b/chapter07/custom_build_type/src/coverage_example/coverage_example.cpp @@ -22,4 +22,4 @@ std::vector check_for_divisibilty(int i) { return result; } -} // namespace coverage_example \ No newline at end of file +} // namespace coverage_example diff --git a/chapter07/custom_build_type/src/coverage_test.cpp b/chapter07/custom_build_type/src/coverage_test.cpp index 361814d..20e3b1b 100644 --- a/chapter07/custom_build_type/src/coverage_test.cpp +++ b/chapter07/custom_build_type/src/coverage_test.cpp @@ -1,16 +1,16 @@ -#include #include +#include -#include #include +#include int main(int, char **) { - auto result = coverage_example::check_for_divisibilty(15); - assert(std::find(result.begin(), result.end(), 2) == result.end()); - assert(std::find(result.begin(), result.end(), 3) != result.end()); - assert(std::find(result.begin(), result.end(), 5) != result.end()); - assert(std::find(result.begin(), result.end(), 7) == result.end()); + auto result = coverage_example::check_for_divisibilty(15); + assert(std::find(result.begin(), result.end(), 2) == result.end()); + assert(std::find(result.begin(), result.end(), 3) != result.end()); + assert(std::find(result.begin(), result.end(), 5) != result.end()); + assert(std::find(result.begin(), result.end(), 7) == result.end()); return 0; -} \ No newline at end of file +} diff --git a/chapter07/fixture_example/src/main.cpp b/chapter07/fixture_example/src/main.cpp index 1041beb..84388f2 100644 --- a/chapter07/fixture_example/src/main.cpp +++ b/chapter07/fixture_example/src/main.cpp @@ -1,6 +1,3 @@ #include -int main(int, char **) { - - return 0; -} \ No newline at end of file +int main(int, char **) { return 0; } diff --git a/chapter07/fixture_example/src/server.cpp b/chapter07/fixture_example/src/server.cpp index 0262a94..1468d37 100644 --- a/chapter07/fixture_example/src/server.cpp +++ b/chapter07/fixture_example/src/server.cpp @@ -8,4 +8,4 @@ int main(int argc, char **argv) { } return 0; -} \ No newline at end of file +} diff --git a/chapter07/iwyu_example/src/main.cpp b/chapter07/iwyu_example/src/main.cpp index 4017982..6df66c7 100644 --- a/chapter07/iwyu_example/src/main.cpp +++ b/chapter07/iwyu_example/src/main.cpp @@ -3,6 +3,6 @@ int main() { std::cout << "Hello World!" << std::endl; - + return 0; -} \ No newline at end of file +} diff --git a/chapter07/lwyu_example/src/main.cpp b/chapter07/lwyu_example/src/main.cpp index df58681..bb16711 100644 --- a/chapter07/lwyu_example/src/main.cpp +++ b/chapter07/lwyu_example/src/main.cpp @@ -2,6 +2,6 @@ int main() { std::cout << "Hello World!" << std::endl; - + return 0; -} \ No newline at end of file +} diff --git a/chapter07/pass_fail_criteria/src/main.cpp b/chapter07/pass_fail_criteria/src/main.cpp index ddb3b4c..ae65aa6 100644 --- a/chapter07/pass_fail_criteria/src/main.cpp +++ b/chapter07/pass_fail_criteria/src/main.cpp @@ -11,4 +11,4 @@ int main(int argc, char **) { } return argc % 2; -} \ No newline at end of file +} diff --git a/chapter07/resource_group_example/src/main.cpp b/chapter07/resource_group_example/src/main.cpp index 24fa573..3fe367d 100644 --- a/chapter07/resource_group_example/src/main.cpp +++ b/chapter07/resource_group_example/src/main.cpp @@ -1,12 +1,11 @@ +#include #include #include -#include int main(int argc, char **) { -using namespace std::literals::chrono_literals; -std::this_thread::sleep_for(0.2s); - -return 0; + using namespace std::literals::chrono_literals; + std::this_thread::sleep_for(0.2s); -} \ No newline at end of file + return 0; +} diff --git a/chapter07/simple_sanitizer_example/src/main.cpp b/chapter07/simple_sanitizer_example/src/main.cpp index 980abd4..0a45d15 100644 --- a/chapter07/simple_sanitizer_example/src/main.cpp +++ b/chapter07/simple_sanitizer_example/src/main.cpp @@ -5,4 +5,4 @@ int main(int, char **) { delete[] i; std::cout << i[0] << "\n"; return 0; -} \ No newline at end of file +} diff --git a/chapter07/simple_test/src/main.cpp b/chapter07/simple_test/src/main.cpp index 1041beb..84388f2 100644 --- a/chapter07/simple_test/src/main.cpp +++ b/chapter07/simple_test/src/main.cpp @@ -1,6 +1,3 @@ #include -int main(int, char **) { - - return 0; -} \ No newline at end of file +int main(int, char **) { return 0; } diff --git a/chapter07/test_labels/src/main.cpp b/chapter07/test_labels/src/main.cpp index 9b34a6b..133fd79 100644 --- a/chapter07/test_labels/src/main.cpp +++ b/chapter07/test_labels/src/main.cpp @@ -1,7 +1,3 @@ #include -int main(int argc, char **) { - - return argc % 2 == 0; - -} \ No newline at end of file +int main(int argc, char **) { return argc % 2 == 0; } diff --git a/chapter07/timeout_example/src/main.cpp b/chapter07/timeout_example/src/main.cpp index ea32216..39c2bbb 100644 --- a/chapter07/timeout_example/src/main.cpp +++ b/chapter07/timeout_example/src/main.cpp @@ -1,12 +1,11 @@ +#include #include #include -#include int main(int argc, char **) { -using namespace std::literals::chrono_literals; -std::this_thread::sleep_for(0.5s); - -return 0; + using namespace std::literals::chrono_literals; + std::this_thread::sleep_for(0.5s); -} \ No newline at end of file + return 0; +} diff --git a/chapter08/chaining_custom_commands_example/src/main.cpp b/chapter08/chaining_custom_commands_example/src/main.cpp index 84c0885..138eab7 100644 --- a/chapter08/chaining_custom_commands_example/src/main.cpp +++ b/chapter08/chaining_custom_commands_example/src/main.cpp @@ -3,4 +3,4 @@ int main() { std::cout << "Welcome to a the clang-format example!" << std::endl; return 0; -} \ No newline at end of file +} diff --git a/chapter08/configure_file_example/src/main.cpp b/chapter08/configure_file_example/src/main.cpp index 6915798..1baa225 100644 --- a/chapter08/configure_file_example/src/main.cpp +++ b/chapter08/configure_file_example/src/main.cpp @@ -5,4 +5,4 @@ int main() { std::cout << "This file was built on the git revision: " << CMAKE_BEST_PRACTICES_VERSION << std::endl; -} \ No newline at end of file +} diff --git a/chapter08/custom_command_example/src/main.cpp b/chapter08/custom_command_example/src/main.cpp index 84c0885..138eab7 100644 --- a/chapter08/custom_command_example/src/main.cpp +++ b/chapter08/custom_command_example/src/main.cpp @@ -3,4 +3,4 @@ int main() { std::cout << "Welcome to a the clang-format example!" << std::endl; return 0; -} \ No newline at end of file +} diff --git a/chapter08/custom_target_dependency_example/src/main.cpp b/chapter08/custom_target_dependency_example/src/main.cpp index 84c0885..138eab7 100644 --- a/chapter08/custom_target_dependency_example/src/main.cpp +++ b/chapter08/custom_target_dependency_example/src/main.cpp @@ -3,4 +3,4 @@ int main() { std::cout << "Welcome to a the clang-format example!" << std::endl; return 0; -} \ No newline at end of file +} diff --git a/chapter08/execute_process_example/src/main.cpp b/chapter08/execute_process_example/src/main.cpp index 65dd54c..8ad4ad8 100644 --- a/chapter08/execute_process_example/src/main.cpp +++ b/chapter08/execute_process_example/src/main.cpp @@ -9,4 +9,4 @@ const char git_rev[] = VERSION; int main() { std::cout << "This file was built on the git revision: " << git_rev << std::endl; -} \ No newline at end of file +} diff --git a/chapter10/ex01_external_deps/src/tests.cpp b/chapter10/ex01_external_deps/src/tests.cpp index bf24c66..1940710 100644 --- a/chapter10/ex01_external_deps/src/tests.cpp +++ b/chapter10/ex01_external_deps/src/tests.cpp @@ -10,6 +10,4 @@ #include -TEST(simple, test){ - SUCCEED(); -} \ No newline at end of file +TEST(simple, test) { SUCCEED(); } diff --git a/chapter10/ex02_external_deps_with_extproject/src/tests.cpp b/chapter10/ex02_external_deps_with_extproject/src/tests.cpp index ced76b2..7e51f6b 100644 --- a/chapter10/ex02_external_deps_with_extproject/src/tests.cpp +++ b/chapter10/ex02_external_deps_with_extproject/src/tests.cpp @@ -24,4 +24,4 @@ TEST_CASE("Factorials are computed", "[factorial]") { REQUIRE(Factorial(2) == 2); REQUIRE(Factorial(3) == 6); REQUIRE(Factorial(10) == 3628800); -} \ No newline at end of file +} diff --git a/chapter10/ex03_simple_qt_app/main.cpp b/chapter10/ex03_simple_qt_app/main.cpp index 1807c68..b913c6d 100644 --- a/chapter10/ex03_simple_qt_app/main.cpp +++ b/chapter10/ex03_simple_qt_app/main.cpp @@ -1,4 +1,4 @@ -// Example taken from +// Example taken from // https://doc.qt.io/archives/3.3/tutorial1-01.html // slightly changed to make it work with QT5 @@ -11,11 +11,10 @@ #include #include -int main( int argc, char **argv ) -{ - QApplication a( argc, argv ); - QPushButton hello( "Hello from CMake Best Practices!", 0 ); - hello.resize( 250, 30 ); - hello.show(); - return a.exec(); -} \ No newline at end of file +int main(int argc, char **argv) { + QApplication a(argc, argv); + QPushButton hello("Hello from CMake Best Practices!", 0); + hello.resize(250, 30); + hello.show(); + return a.exec(); +} diff --git a/chapter11/framework_example/include/hello/hello.hpp b/chapter11/framework_example/include/hello/hello.hpp index f769433..d9d9ce1 100644 --- a/chapter11/framework_example/include/hello/hello.hpp +++ b/chapter11/framework_example/include/hello/hello.hpp @@ -13,4 +13,4 @@ class Hello { private: const std::string name_; }; -} // namespace hello \ No newline at end of file +} // namespace hello diff --git a/chapter11/framework_example/src/hello.cpp b/chapter11/framework_example/src/hello.cpp index c94ad58..705564c 100644 --- a/chapter11/framework_example/src/hello.cpp +++ b/chapter11/framework_example/src/hello.cpp @@ -2,8 +2,6 @@ #include "internal.hpp" -namespace hello{ - void Hello::greet() const { - details::print_impl(name_); - } -} \ No newline at end of file +namespace hello { +void Hello::greet() const { details::print_impl(name_); } +} // namespace hello diff --git a/chapter11/framework_example/src/internal.cpp b/chapter11/framework_example/src/internal.cpp index cc8faf9..03053c3 100644 --- a/chapter11/framework_example/src/internal.cpp +++ b/chapter11/framework_example/src/internal.cpp @@ -2,9 +2,8 @@ #include -namespace hello::details{ - void print_impl(const std::string& name) - { - std::cout << "Hello " << name << " from a shared library\n"; - } -} \ No newline at end of file +namespace hello::details { +void print_impl(const std::string &name) { + std::cout << "Hello " << name << " from a shared library\n"; +} +} // namespace hello::details diff --git a/chapter11/framework_example/src/internal.hpp b/chapter11/framework_example/src/internal.hpp index 9b39759..b4b4d8e 100644 --- a/chapter11/framework_example/src/internal.hpp +++ b/chapter11/framework_example/src/internal.hpp @@ -1,9 +1,9 @@ -#pragma once +#pragma once #include -namespace hello::details{ +namespace hello::details { - void print_impl(const std::string& name); - -} \ No newline at end of file +void print_impl(const std::string &name); + +} diff --git a/chapter12/android-example/include/hello/hello.hpp b/chapter12/android-example/include/hello/hello.hpp index 84b618e..d9d9ce1 100644 --- a/chapter12/android-example/include/hello/hello.hpp +++ b/chapter12/android-example/include/hello/hello.hpp @@ -1,15 +1,16 @@ -#pragma once +#pragma once #include -namespace hello{ - /// Example class that is explicitly exported into a dll - class Hello { - public: - Hello(const std::string& name) : name_{name} {} - - void greet() const; - private: - const std::string name_; - }; -} \ No newline at end of file +namespace hello { +/// Example class that is explicitly exported into a dll +class Hello { +public: + Hello(const std::string &name) : name_{name} {} + + void greet() const; + +private: + const std::string name_; +}; +} // namespace hello diff --git a/chapter12/android-example/src/hello.cpp b/chapter12/android-example/src/hello.cpp index c94ad58..705564c 100644 --- a/chapter12/android-example/src/hello.cpp +++ b/chapter12/android-example/src/hello.cpp @@ -2,8 +2,6 @@ #include "internal.hpp" -namespace hello{ - void Hello::greet() const { - details::print_impl(name_); - } -} \ No newline at end of file +namespace hello { +void Hello::greet() const { details::print_impl(name_); } +} // namespace hello diff --git a/chapter12/android-example/src/internal.cpp b/chapter12/android-example/src/internal.cpp index cc8faf9..03053c3 100644 --- a/chapter12/android-example/src/internal.cpp +++ b/chapter12/android-example/src/internal.cpp @@ -2,9 +2,8 @@ #include -namespace hello::details{ - void print_impl(const std::string& name) - { - std::cout << "Hello " << name << " from a shared library\n"; - } -} \ No newline at end of file +namespace hello::details { +void print_impl(const std::string &name) { + std::cout << "Hello " << name << " from a shared library\n"; +} +} // namespace hello::details diff --git a/chapter12/android-example/src/internal.hpp b/chapter12/android-example/src/internal.hpp index 9b39759..b4b4d8e 100644 --- a/chapter12/android-example/src/internal.hpp +++ b/chapter12/android-example/src/internal.hpp @@ -1,9 +1,9 @@ -#pragma once +#pragma once #include -namespace hello::details{ +namespace hello::details { - void print_impl(const std::string& name); - -} \ No newline at end of file +void print_impl(const std::string &name); + +} diff --git a/chapter12/check_push_pop/include/hello.hpp b/chapter12/check_push_pop/include/hello.hpp index 617d41b..e5efa80 100644 --- a/chapter12/check_push_pop/include/hello.hpp +++ b/chapter12/check_push_pop/include/hello.hpp @@ -1,5 +1,5 @@ -#pragma once +#pragma once #include -void hello() { std::cout << "Greetings\n";} +void hello() { std::cout << "Greetings\n"; } diff --git a/chapter12/emulator-example/src/main.cpp b/chapter12/emulator-example/src/main.cpp index 4620460..38e9d30 100644 --- a/chapter12/emulator-example/src/main.cpp +++ b/chapter12/emulator-example/src/main.cpp @@ -3,4 +3,4 @@ int main(int, char **) { std::cout << "Welcome to CMake Best Practices (on arm)\n"; return 0; -} \ No newline at end of file +} diff --git a/chapter12/iOS_example/include/hello/hello.hpp b/chapter12/iOS_example/include/hello/hello.hpp index 84b618e..d9d9ce1 100644 --- a/chapter12/iOS_example/include/hello/hello.hpp +++ b/chapter12/iOS_example/include/hello/hello.hpp @@ -1,15 +1,16 @@ -#pragma once +#pragma once #include -namespace hello{ - /// Example class that is explicitly exported into a dll - class Hello { - public: - Hello(const std::string& name) : name_{name} {} - - void greet() const; - private: - const std::string name_; - }; -} \ No newline at end of file +namespace hello { +/// Example class that is explicitly exported into a dll +class Hello { +public: + Hello(const std::string &name) : name_{name} {} + + void greet() const; + +private: + const std::string name_; +}; +} // namespace hello diff --git a/chapter12/iOS_example/src/hello.cpp b/chapter12/iOS_example/src/hello.cpp index c94ad58..705564c 100644 --- a/chapter12/iOS_example/src/hello.cpp +++ b/chapter12/iOS_example/src/hello.cpp @@ -2,8 +2,6 @@ #include "internal.hpp" -namespace hello{ - void Hello::greet() const { - details::print_impl(name_); - } -} \ No newline at end of file +namespace hello { +void Hello::greet() const { details::print_impl(name_); } +} // namespace hello diff --git a/chapter12/iOS_example/src/internal.cpp b/chapter12/iOS_example/src/internal.cpp index cc8faf9..03053c3 100644 --- a/chapter12/iOS_example/src/internal.cpp +++ b/chapter12/iOS_example/src/internal.cpp @@ -2,9 +2,8 @@ #include -namespace hello::details{ - void print_impl(const std::string& name) - { - std::cout << "Hello " << name << " from a shared library\n"; - } -} \ No newline at end of file +namespace hello::details { +void print_impl(const std::string &name) { + std::cout << "Hello " << name << " from a shared library\n"; +} +} // namespace hello::details diff --git a/chapter12/iOS_example/src/internal.hpp b/chapter12/iOS_example/src/internal.hpp index 9b39759..b4b4d8e 100644 --- a/chapter12/iOS_example/src/internal.hpp +++ b/chapter12/iOS_example/src/internal.hpp @@ -1,9 +1,9 @@ -#pragma once +#pragma once #include -namespace hello::details{ +namespace hello::details { - void print_impl(const std::string& name); - -} \ No newline at end of file +void print_impl(const std::string &name); + +} diff --git a/chapter13/ex02_envfile_utility/test-executable/test.cpp b/chapter13/ex02_envfile_utility/test-executable/test.cpp index 323ce88..d69120b 100644 --- a/chapter13/ex02_envfile_utility/test-executable/test.cpp +++ b/chapter13/ex02_envfile_utility/test-executable/test.cpp @@ -9,5 +9,6 @@ #include int main(void) { - std::printf("Version `%s`, author `%s`\n", TEST_PROJECT_VERSION, TEST_PROJECT_AUTHOR); -} \ No newline at end of file + std::printf("Version `%s`, author `%s`\n", TEST_PROJECT_VERSION, + TEST_PROJECT_AUTHOR); +} diff --git a/chapter13/ex03_external_cmake_module/src/main.cpp b/chapter13/ex03_external_cmake_module/src/main.cpp index 6519bbf..2bc8e18 100644 --- a/chapter13/ex03_external_cmake_module/src/main.cpp +++ b/chapter13/ex03_external_cmake_module/src/main.cpp @@ -1,5 +1,3 @@ #include -int main(void){ - std::printf("Hello!\n"); -} \ No newline at end of file +int main(void) { std::printf("Hello!\n"); } diff --git a/chapter14/precompiled_headers/src/eratosthenes.cpp b/chapter14/precompiled_headers/src/eratosthenes.cpp index 35c8e64..297cbe5 100644 --- a/chapter14/precompiled_headers/src/eratosthenes.cpp +++ b/chapter14/precompiled_headers/src/eratosthenes.cpp @@ -1,17 +1,16 @@ #include "eratosthenes.h" -std::vector eratosthenes(int n) -{ - std::vector primes; - std::vector is_prime(n + 1, true); - is_prime[0] = is_prime[1] = false; - for (int i = 2; i <= n; ++i) { - if (is_prime[i]) { - primes.push_back(i); - for (int j = i * i; j <= n; j += i) { - is_prime[j] = false; - } - } +std::vector eratosthenes(int n) { + std::vector primes; + std::vector is_prime(n + 1, true); + is_prime[0] = is_prime[1] = false; + for (int i = 2; i <= n; ++i) { + if (is_prime[i]) { + primes.push_back(i); + for (int j = i * i; j <= n; j += i) { + is_prime[j] = false; + } } - return primes; -} \ No newline at end of file + } + return primes; +} diff --git a/chapter14/precompiled_headers/src/fibonacci.cpp b/chapter14/precompiled_headers/src/fibonacci.cpp index 6144a35..d243945 100644 --- a/chapter14/precompiled_headers/src/fibonacci.cpp +++ b/chapter14/precompiled_headers/src/fibonacci.cpp @@ -1,5 +1,5 @@ #include "fibonacci.h" uint64_t Fibonacci(uint64_t number) { - return number < 2 ? 1 : Fibonacci(number - 1) + Fibonacci(number - 2); -} \ No newline at end of file + return number < 2 ? 1 : Fibonacci(number - 1) + Fibonacci(number - 2); +} diff --git a/chapter14/precompiled_headers/src/main.cpp b/chapter14/precompiled_headers/src/main.cpp index 1168ccf..227664c 100644 --- a/chapter14/precompiled_headers/src/main.cpp +++ b/chapter14/precompiled_headers/src/main.cpp @@ -1,16 +1,14 @@ -#include -#include "fibonacci.h" #include "eratosthenes.h" +#include "fibonacci.h" +#include -int main(int, char**) -{ - std::cout << "Welcome to chapter 14\n"; - std::cout << "Fibonacci(3) = " << Fibonacci(3) << "\n"; - std::cout << "Primes before 10:\n"; - const auto primes = eratosthenes(10); - for (const auto& i : primes) - { - std::cout << i << " "; - } - std::cout << "\n"; -} \ No newline at end of file +int main(int, char **) { + std::cout << "Welcome to chapter 14\n"; + std::cout << "Fibonacci(3) = " << Fibonacci(3) << "\n"; + std::cout << "Primes before 10:\n"; + const auto primes = eratosthenes(10); + for (const auto &i : primes) { + std::cout << i << " "; + } + std::cout << "\n"; +} diff --git a/chapter14/unity_build/src/eratosthenes.cpp b/chapter14/unity_build/src/eratosthenes.cpp index 35c8e64..297cbe5 100644 --- a/chapter14/unity_build/src/eratosthenes.cpp +++ b/chapter14/unity_build/src/eratosthenes.cpp @@ -1,17 +1,16 @@ #include "eratosthenes.h" -std::vector eratosthenes(int n) -{ - std::vector primes; - std::vector is_prime(n + 1, true); - is_prime[0] = is_prime[1] = false; - for (int i = 2; i <= n; ++i) { - if (is_prime[i]) { - primes.push_back(i); - for (int j = i * i; j <= n; j += i) { - is_prime[j] = false; - } - } +std::vector eratosthenes(int n) { + std::vector primes; + std::vector is_prime(n + 1, true); + is_prime[0] = is_prime[1] = false; + for (int i = 2; i <= n; ++i) { + if (is_prime[i]) { + primes.push_back(i); + for (int j = i * i; j <= n; j += i) { + is_prime[j] = false; + } } - return primes; -} \ No newline at end of file + } + return primes; +} diff --git a/chapter14/unity_build/src/fibonacci.cpp b/chapter14/unity_build/src/fibonacci.cpp index 65778ab..d243945 100644 --- a/chapter14/unity_build/src/fibonacci.cpp +++ b/chapter14/unity_build/src/fibonacci.cpp @@ -1,6 +1,5 @@ #include "fibonacci.h" - uint64_t Fibonacci(uint64_t number) { - return number < 2 ? 1 : Fibonacci(number - 1) + Fibonacci(number - 2); -} \ No newline at end of file + return number < 2 ? 1 : Fibonacci(number - 1) + Fibonacci(number - 2); +} diff --git a/chapter14/unity_build/src/main.cpp b/chapter14/unity_build/src/main.cpp index 1168ccf..227664c 100644 --- a/chapter14/unity_build/src/main.cpp +++ b/chapter14/unity_build/src/main.cpp @@ -1,16 +1,14 @@ -#include -#include "fibonacci.h" #include "eratosthenes.h" +#include "fibonacci.h" +#include -int main(int, char**) -{ - std::cout << "Welcome to chapter 14\n"; - std::cout << "Fibonacci(3) = " << Fibonacci(3) << "\n"; - std::cout << "Primes before 10:\n"; - const auto primes = eratosthenes(10); - for (const auto& i : primes) - { - std::cout << i << " "; - } - std::cout << "\n"; -} \ No newline at end of file +int main(int, char **) { + std::cout << "Welcome to chapter 14\n"; + std::cout << "Fibonacci(3) = " << Fibonacci(3) << "\n"; + std::cout << "Primes before 10:\n"; + const auto primes = eratosthenes(10); + for (const auto &i : primes) { + std::cout << i << " "; + } + std::cout << "\n"; +} diff --git a/chapter14/unity_build_group/src/eratosthenes.cpp b/chapter14/unity_build_group/src/eratosthenes.cpp index 35c8e64..297cbe5 100644 --- a/chapter14/unity_build_group/src/eratosthenes.cpp +++ b/chapter14/unity_build_group/src/eratosthenes.cpp @@ -1,17 +1,16 @@ #include "eratosthenes.h" -std::vector eratosthenes(int n) -{ - std::vector primes; - std::vector is_prime(n + 1, true); - is_prime[0] = is_prime[1] = false; - for (int i = 2; i <= n; ++i) { - if (is_prime[i]) { - primes.push_back(i); - for (int j = i * i; j <= n; j += i) { - is_prime[j] = false; - } - } +std::vector eratosthenes(int n) { + std::vector primes; + std::vector is_prime(n + 1, true); + is_prime[0] = is_prime[1] = false; + for (int i = 2; i <= n; ++i) { + if (is_prime[i]) { + primes.push_back(i); + for (int j = i * i; j <= n; j += i) { + is_prime[j] = false; + } } - return primes; -} \ No newline at end of file + } + return primes; +} diff --git a/chapter14/unity_build_group/src/fibonacci.cpp b/chapter14/unity_build_group/src/fibonacci.cpp index 6144a35..d243945 100644 --- a/chapter14/unity_build_group/src/fibonacci.cpp +++ b/chapter14/unity_build_group/src/fibonacci.cpp @@ -1,5 +1,5 @@ #include "fibonacci.h" uint64_t Fibonacci(uint64_t number) { - return number < 2 ? 1 : Fibonacci(number - 1) + Fibonacci(number - 2); -} \ No newline at end of file + return number < 2 ? 1 : Fibonacci(number - 1) + Fibonacci(number - 2); +} diff --git a/chapter14/unity_build_group/src/main.cpp b/chapter14/unity_build_group/src/main.cpp index 1168ccf..227664c 100644 --- a/chapter14/unity_build_group/src/main.cpp +++ b/chapter14/unity_build_group/src/main.cpp @@ -1,16 +1,14 @@ -#include -#include "fibonacci.h" #include "eratosthenes.h" +#include "fibonacci.h" +#include -int main(int, char**) -{ - std::cout << "Welcome to chapter 14\n"; - std::cout << "Fibonacci(3) = " << Fibonacci(3) << "\n"; - std::cout << "Primes before 10:\n"; - const auto primes = eratosthenes(10); - for (const auto& i : primes) - { - std::cout << i << " "; - } - std::cout << "\n"; -} \ No newline at end of file +int main(int, char **) { + std::cout << "Welcome to chapter 14\n"; + std::cout << "Fibonacci(3) = " << Fibonacci(3) << "\n"; + std::cout << "Primes before 10:\n"; + const auto primes = eratosthenes(10); + for (const auto &i : primes) { + std::cout << i << " "; + } + std::cout << "\n"; +}