From fe27eb998f9e624d6756b9822887d6944692b88c Mon Sep 17 00:00:00 2001 From: Michael Migliore Date: Wed, 17 Jan 2024 15:48:19 +0100 Subject: [PATCH] Forbid short function on same line --- .clang-format | 3 ++ application/F3DOptionsParser.cxx | 5 +++- .../Applicative/vtkF3DObjectFactory.h | 5 +++- .../VTKExtensions/Readers/vtkF3DEXRReader.h | 10 +++++-- .../Rendering/vtkF3DDropZoneActor.h | 10 +++++-- .../Rendering/vtkF3DInteractorStyle.h | 8 +++-- library/plugin/plugin.h | 30 +++++++++++++++---- library/plugin/reader.h | 28 +++++++++++++---- library/private/animationManager.h | 5 +++- library/public/log.h | 4 ++- library/testing/TestSDKExternalWindowQT.cxx | 5 +++- .../Testing/TestF3DAssimpImportError.cxx | 10 +++++-- plugins/occt/module/vtkF3DOCCTReader.cxx | 5 +++- python/F3DPythonBindings.cxx | 10 +++++-- winshellext/F3DShellExtensionClassFactory.h | 10 +++++-- 15 files changed, 118 insertions(+), 30 deletions(-) diff --git a/.clang-format b/.clang-format index 8b5454a902..c57605fa61 100644 --- a/.clang-format +++ b/.clang-format @@ -3,11 +3,14 @@ BasedOnStyle: Mozilla AlignAfterOpenBracket: DontAlign AlignOperands: false +AllowShortFunctionsOnASingleLine: None AlwaysBreakAfterReturnType: None AlwaysBreakAfterDefinitionReturnType: None BreakBeforeBraces: Allman BinPackArguments: true BinPackParameters: true +BraceWrapping: + BeforeLambdaBody: true ColumnLimit: 100 # Note that on versions after 4.0 you need to specify # SpaceAfterTemplateKeyword: true diff --git a/application/F3DOptionsParser.cxx b/application/F3DOptionsParser.cxx index fedcd7dbdb..5689e60c52 100644 --- a/application/F3DOptionsParser.cxx +++ b/application/F3DOptionsParser.cxx @@ -103,7 +103,10 @@ class ConfigurationOptions return ss.str(); } - static std::string ToString(bool currValue) { return currValue ? "true" : "false"; } + static std::string ToString(bool currValue) + { + return currValue ? "true" : "false"; + } template static std::string ToString(const std::vector& currValue) diff --git a/library/VTKExtensions/Applicative/vtkF3DObjectFactory.h b/library/VTKExtensions/Applicative/vtkF3DObjectFactory.h index 169455dd78..47cdbc8b8e 100644 --- a/library/VTKExtensions/Applicative/vtkF3DObjectFactory.h +++ b/library/VTKExtensions/Applicative/vtkF3DObjectFactory.h @@ -14,7 +14,10 @@ class vtkF3DObjectFactory : public vtkObjectFactory static vtkF3DObjectFactory* New(); vtkTypeMacro(vtkF3DObjectFactory, vtkObjectFactory); - const char* GetDescription() override { return "F3D factory overrides."; } + const char* GetDescription() override + { + return "F3D factory overrides."; + } const char* GetVTKSourceVersion() override; diff --git a/library/VTKExtensions/Readers/vtkF3DEXRReader.h b/library/VTKExtensions/Readers/vtkF3DEXRReader.h index d4e2584cbd..5edabf8222 100644 --- a/library/VTKExtensions/Readers/vtkF3DEXRReader.h +++ b/library/VTKExtensions/Readers/vtkF3DEXRReader.h @@ -18,12 +18,18 @@ class vtkF3DEXRReader : public vtkImageReader /** * List of extensions supported by this reader */ - const char* GetFileExtensions() override { return ".exr"; } + const char* GetFileExtensions() override + { + return ".exr"; + } /** * Descriptive name of the reader */ - const char* GetDescriptiveName() override { return "OpenEXR"; } + const char* GetDescriptiveName() override + { + return "OpenEXR"; + } protected: vtkF3DEXRReader(); diff --git a/library/VTKExtensions/Rendering/vtkF3DDropZoneActor.h b/library/VTKExtensions/Rendering/vtkF3DDropZoneActor.h index e57559385e..4ac02d1be8 100644 --- a/library/VTKExtensions/Rendering/vtkF3DDropZoneActor.h +++ b/library/VTKExtensions/Rendering/vtkF3DDropZoneActor.h @@ -49,12 +49,18 @@ class vtkF3DDropZoneActor : public vtkActor2D /** * Reimplemented for noop */ - int RenderTranslucentPolygonalGeometry(vtkViewport* vtkNotUsed(viewport)) override { return 0; }; + int RenderTranslucentPolygonalGeometry(vtkViewport* vtkNotUsed(viewport)) override + { + return 0; + } /** * Reimplemented for noop */ - int RenderOpaqueGeometry(vtkViewport* vtkNotUsed(viewport)) override { return 0; }; + int RenderOpaqueGeometry(vtkViewport* vtkNotUsed(viewport)) override + { + return 0; + } protected: vtkF3DDropZoneActor(); diff --git a/library/VTKExtensions/Rendering/vtkF3DInteractorStyle.h b/library/VTKExtensions/Rendering/vtkF3DInteractorStyle.h index 6fcbae4d8a..6e90ffa85b 100644 --- a/library/VTKExtensions/Rendering/vtkF3DInteractorStyle.h +++ b/library/VTKExtensions/Rendering/vtkF3DInteractorStyle.h @@ -32,12 +32,16 @@ class vtkF3DInteractorStyle : public vtkInteractorStyleTrackballCamera /** * Disable base class features */ - void OnChar() override {} + void OnChar() override + { + } /** * Disable base class features */ - void OnTimer() override {} + void OnTimer() override + { + } /** * Handle drop files diff --git a/library/plugin/plugin.h b/library/plugin/plugin.h index 629149f317..5e34f3e21e 100644 --- a/library/plugin/plugin.h +++ b/library/plugin/plugin.h @@ -37,30 +37,48 @@ class plugin /** * Get the name of this plugin */ - const std::string& getName() { return this->Name; } + const std::string& getName() + { + return this->Name; + } /** * Get the description of this plugin */ - const std::string& getDescription() { return this->Description; } + const std::string& getDescription() + { + return this->Description; + } /** * Get the version of this plugin */ - const std::string& getVersion() { return this->Version; } + const std::string& getVersion() + { + return this->Version; + } /** * Get the list of readers created by this plugin */ - const std::vector >& getReaders() { return this->Readers; } + const std::vector >& getReaders() + { + return this->Readers; + } ///@{ /** * Set/Get the origin of this plugin, usually static, system or an actual path * Set by the engine. */ - const std::string& getOrigin() { return this->Origin; } - void setOrigin(const std::string& origin) { this->Origin = origin; } + const std::string& getOrigin() + { + return this->Origin; + } + void setOrigin(const std::string& origin) + { + this->Origin = origin; + } ///@} private: diff --git a/library/plugin/reader.h b/library/plugin/reader.h index 7403b9d842..15b2dd4133 100644 --- a/library/plugin/reader.h +++ b/library/plugin/reader.h @@ -45,7 +45,10 @@ class reader /** * Get the long description of this reader */ - virtual const std::string getLongDescription() const { return this->getShortDescription(); } + virtual const std::string getLongDescription() const + { + return this->getShortDescription(); + } /** * Get the extensions supported by this reader @@ -77,13 +80,19 @@ class reader * The reader having the highest score (from 0 to 100) is used to read the file. * Default is 50. */ - virtual int getScore() const { return 50; } + virtual int getScore() const + { + return 50; + } /** * Return true if this reader can create a geometry reader * false otherwise */ - virtual bool hasGeometryReader() { return false; } + virtual bool hasGeometryReader() + { + return false; + } /** * Create the geometry reader (VTK reader) for the given filename @@ -96,13 +105,18 @@ class reader /** * Apply custom code for the reader */ - virtual void applyCustomReader(vtkAlgorithm*, const std::string&) const {} + virtual void applyCustomReader(vtkAlgorithm*, const std::string&) const + { + } /** * Return true if this reader can create a scene reader * false otherwise */ - virtual bool hasSceneReader() { return false; } + virtual bool hasSceneReader() + { + return false; + } /** * Create the scene reader (VTK importer) for the given filename @@ -115,7 +129,9 @@ class reader /** * Apply custom code for the importer */ - virtual void applyCustomImporter(vtkImporter*, const std::string&) const {} + virtual void applyCustomImporter(vtkImporter*, const std::string&) const + { + } }; } diff --git a/library/private/animationManager.h b/library/private/animationManager.h index ec17cdb9b1..61ac74b917 100644 --- a/library/private/animationManager.h +++ b/library/private/animationManager.h @@ -49,7 +49,10 @@ class animationManager /** * Return true if the animation manager is playing the animation */ - bool IsPlaying() const { return Playing; } + bool IsPlaying() const + { + return Playing; + } /** * Load animation at provided time value diff --git a/library/public/log.h b/library/public/log.h index 8c8e9620a6..9641844c5a 100644 --- a/library/public/log.h +++ b/library/public/log.h @@ -112,7 +112,9 @@ class F3D_EXPORT log protected: //! @cond - static void appendArg(std::stringstream&) {} + static void appendArg(std::stringstream&) + { + } template static void appendArg(std::stringstream& ss, T value, Args... args) diff --git a/library/testing/TestSDKExternalWindowQT.cxx b/library/testing/TestSDKExternalWindowQT.cxx index ac4d6d5a99..f32e9755e5 100644 --- a/library/testing/TestSDKExternalWindowQT.cxx +++ b/library/testing/TestSDKExternalWindowQT.cxx @@ -49,7 +49,10 @@ class F3DWindow : public QOpenGLWindow this->close(); } - void paintGL() override { mEngine.getWindow().render(); } + void paintGL() override + { + mEngine.getWindow().render(); + } private: f3d::engine mEngine; diff --git a/plugins/assimp/module/Testing/TestF3DAssimpImportError.cxx b/plugins/assimp/module/Testing/TestF3DAssimpImportError.cxx index 17ec0d8bd7..0a9c913678 100644 --- a/plugins/assimp/module/Testing/TestF3DAssimpImportError.cxx +++ b/plugins/assimp/module/Testing/TestF3DAssimpImportError.cxx @@ -10,7 +10,10 @@ class WarningEventCallback : public vtkCommand { public: - static WarningEventCallback* New() { return new WarningEventCallback; } + static WarningEventCallback* New() + { + return new WarningEventCallback; + } void Execute(vtkObject* caller, unsigned long vtkNotUsed(evId), void* data) override { @@ -22,7 +25,10 @@ class WarningEventCallback : public vtkCommand } } - const std::vector& GetRecordedWarningMessages() const { return this->Messages; } + const std::vector& GetRecordedWarningMessages() const + { + return this->Messages; + } private: std::vector Messages; diff --git a/plugins/occt/module/vtkF3DOCCTReader.cxx b/plugins/occt/module/vtkF3DOCCTReader.cxx index 0267568e85..1088ceba0d 100644 --- a/plugins/occt/module/vtkF3DOCCTReader.cxx +++ b/plugins/occt/module/vtkF3DOCCTReader.cxx @@ -424,7 +424,10 @@ vtkF3DOCCTReader::~vtkF3DOCCTReader() = default; class ProgressIndicator : public Message_ProgressIndicator { public: - explicit ProgressIndicator(vtkF3DOCCTReader* reader) { this->Reader = reader; } + explicit ProgressIndicator(vtkF3DOCCTReader* reader) + { + this->Reader = reader; + } protected: void Show(const Message_ProgressScope&, const Standard_Boolean) override diff --git a/python/F3DPythonBindings.cxx b/python/F3DPythonBindings.cxx index 79f33565f5..2bb8d85c08 100644 --- a/python/F3DPythonBindings.cxx +++ b/python/F3DPythonBindings.cxx @@ -39,7 +39,10 @@ template<> class py::detail::type_caster { public: - bool load(handle src, bool convert) { return load_array(src, convert, value); } + bool load(handle src, bool convert) + { + return load_array(src, convert, value); + } static handle cast(const f3d::point3_t& src, return_value_policy, handle /* parent */) { @@ -53,7 +56,10 @@ template<> class py::detail::type_caster { public: - bool load(handle src, bool convert) { return load_array(src, convert, value); } + bool load(handle src, bool convert) + { + return load_array(src, convert, value); + } static handle cast(const f3d::vector3_t& src, return_value_policy, handle /* parent */) { diff --git a/winshellext/F3DShellExtensionClassFactory.h b/winshellext/F3DShellExtensionClassFactory.h index b7416ae378..1d781e84b4 100644 --- a/winshellext/F3DShellExtensionClassFactory.h +++ b/winshellext/F3DShellExtensionClassFactory.h @@ -31,7 +31,10 @@ class F3DShellExtensionClassFactory : public IClassFactory return QISearch(this, qit, riid, ppv); } - IFACEMETHODIMP_(ULONG) AddRef() { return ::InterlockedIncrement(&m_cRef); } + IFACEMETHODIMP_(ULONG) AddRef() + { + return ::InterlockedIncrement(&m_cRef); + } IFACEMETHODIMP_(ULONG) Release() { @@ -77,7 +80,10 @@ class F3DShellExtensionClassFactory : public IClassFactory } protected: - ~F3DShellExtensionClassFactory() { ::InterlockedDecrement(&g_cDllRef); } + ~F3DShellExtensionClassFactory() + { + ::InterlockedDecrement(&g_cDllRef); + } long m_cRef; };