Skip to content

Commit

Permalink
Forbid short function on same line
Browse files Browse the repository at this point in the history
  • Loading branch information
Meakk committed Jan 17, 2024
1 parent b909482 commit fe27eb9
Show file tree
Hide file tree
Showing 15 changed files with 118 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion application/F3DOptionsParser.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<class T>
static std::string ToString(const std::vector<T>& currValue)
Expand Down
5 changes: 4 additions & 1 deletion library/VTKExtensions/Applicative/vtkF3DObjectFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 8 additions & 2 deletions library/VTKExtensions/Readers/vtkF3DEXRReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 21 in library/VTKExtensions/Readers/vtkF3DEXRReader.h

View check run for this annotation

Codecov / codecov/patch

library/VTKExtensions/Readers/vtkF3DEXRReader.h#L21

Added line #L21 was not covered by tests
{
return ".exr";

Check warning on line 23 in library/VTKExtensions/Readers/vtkF3DEXRReader.h

View check run for this annotation

Codecov / codecov/patch

library/VTKExtensions/Readers/vtkF3DEXRReader.h#L23

Added line #L23 was not covered by tests
}

/**
* Descriptive name of the reader
*/
const char* GetDescriptiveName() override { return "OpenEXR"; }
const char* GetDescriptiveName() override

Check warning on line 29 in library/VTKExtensions/Readers/vtkF3DEXRReader.h

View check run for this annotation

Codecov / codecov/patch

library/VTKExtensions/Readers/vtkF3DEXRReader.h#L29

Added line #L29 was not covered by tests
{
return "OpenEXR";

Check warning on line 31 in library/VTKExtensions/Readers/vtkF3DEXRReader.h

View check run for this annotation

Codecov / codecov/patch

library/VTKExtensions/Readers/vtkF3DEXRReader.h#L31

Added line #L31 was not covered by tests
}

protected:
vtkF3DEXRReader();
Expand Down
10 changes: 8 additions & 2 deletions library/VTKExtensions/Rendering/vtkF3DDropZoneActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 6 additions & 2 deletions library/VTKExtensions/Rendering/vtkF3DInteractorStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 42 in library/VTKExtensions/Rendering/vtkF3DInteractorStyle.h

View check run for this annotation

Codecov / codecov/patch

library/VTKExtensions/Rendering/vtkF3DInteractorStyle.h#L42

Added line #L42 was not covered by tests
{
}

Check warning on line 44 in library/VTKExtensions/Rendering/vtkF3DInteractorStyle.h

View check run for this annotation

Codecov / codecov/patch

library/VTKExtensions/Rendering/vtkF3DInteractorStyle.h#L44

Added line #L44 was not covered by tests

/**
* Handle drop files
Expand Down
30 changes: 24 additions & 6 deletions library/plugin/plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::shared_ptr<reader> >& getReaders() { return this->Readers; }
const std::vector<std::shared_ptr<reader> >& 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:
Expand Down
28 changes: 22 additions & 6 deletions library/plugin/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
{
}
};
}

Expand Down
5 changes: 4 additions & 1 deletion library/private/animationManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion library/public/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ class F3D_EXPORT log

protected:
//! @cond
static void appendArg(std::stringstream&) {}
static void appendArg(std::stringstream&)
{
}

template<typename T, typename... Args>
static void appendArg(std::stringstream& ss, T value, Args... args)
Expand Down
5 changes: 4 additions & 1 deletion library/testing/TestSDKExternalWindowQT.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 8 additions & 2 deletions plugins/assimp/module/Testing/TestF3DAssimpImportError.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -22,7 +25,10 @@ class WarningEventCallback : public vtkCommand
}
}

const std::vector<std::string>& GetRecordedWarningMessages() const { return this->Messages; }
const std::vector<std::string>& GetRecordedWarningMessages() const
{
return this->Messages;
}

private:
std::vector<std::string> Messages;
Expand Down
5 changes: 4 additions & 1 deletion plugins/occt/module/vtkF3DOCCTReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions python/F3DPythonBindings.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ template<>
class py::detail::type_caster<f3d::point3_t>
{
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 */)
{
Expand All @@ -53,7 +56,10 @@ template<>
class py::detail::type_caster<f3d::vector3_t>
{
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 */)
{
Expand Down
10 changes: 8 additions & 2 deletions winshellext/F3DShellExtensionClassFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -77,7 +80,10 @@ class F3DShellExtensionClassFactory : public IClassFactory
}

protected:
~F3DShellExtensionClassFactory() { ::InterlockedDecrement(&g_cDllRef); }
~F3DShellExtensionClassFactory()
{
::InterlockedDecrement(&g_cDllRef);
}

long m_cRef;
};

0 comments on commit fe27eb9

Please sign in to comment.