Skip to content

Commit

Permalink
Apply some fixes found by Resharper
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkewley committed Nov 21, 2024
1 parent 8996d95 commit 279a0b0
Show file tree
Hide file tree
Showing 91 changed files with 433 additions and 479 deletions.
4 changes: 2 additions & 2 deletions src/OpenSimCreator/Documents/MeshImporter/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
#include <OpenSimCreator/Utils/OpenSimHelpers.h>

#include <oscar/Maths/AABB.h>
#include <oscar/Maths/MathHelpers.h>
#include <oscar/Maths/AABBFunctions.h>
#include <oscar/Platform/IconCodepoints.h>
#include <oscar/Utils/UID.h>

#include <filesystem>
#include <iostream>
#include <ostream>
#include <utility>
#include <vector>

Expand Down
1 change: 1 addition & 0 deletions src/OpenSimCreator/Graphics/OpenSimDecorationGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <oscar/Graphics/Scene/SceneDecoration.h>
#include <oscar/Graphics/Scene/SceneHelpers.h>
#include <oscar/Maths/AABB.h>
#include <oscar/Maths/AABBFunctions.h>
#include <oscar/Maths/ClosedInterval.h>
#include <oscar/Maths/GeometricFunctions.h>
#include <oscar/Maths/LineSegment.h>
Expand Down
1 change: 1 addition & 0 deletions src/OpenSimCreator/Graphics/OpenSimGraphicsHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <oscar/Graphics/Scene/SceneHelpers.h>
#include <oscar/Maths/Line.h>
#include <oscar/Maths/MathHelpers.h>
#include <oscar/Maths/RectFunctions.h>
#include <oscar/Maths/PolarPerspectiveCamera.h>
#include <oscar/Maths/Vec2.h>
#include <oscar/Utils/Perf.h>
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSimCreator/UI/LoadingTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

#include <oscar/Maths/MathHelpers.h>
#include <oscar/Maths/Rect.h>
#include <oscar/Maths/RectFunctions.h>
#include <oscar/Maths/Vec2.h>
#include <oscar/Platform/App.h>
#include <oscar/Platform/Log.h>
#include <oscar/UI/Events/OpenTabEvent.h>
#include <oscar/UI/Events/CloseTabEvent.h>
#include <oscar/UI/oscimgui.h>
#include <oscar/UI/Tabs/TabPrivate.h>
#include <oscar/Utils/LifetimedPtr.h>

#include <chrono>
#include <exception>
Expand Down
1 change: 1 addition & 0 deletions src/OpenSimCreator/UI/MeshHittestTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <oscar/Maths/Line.h>
#include <oscar/Maths/MathHelpers.h>
#include <oscar/Maths/PolarPerspectiveCamera.h>
#include <oscar/Maths/RectFunctions.h>
#include <oscar/Maths/Transform.h>
#include <oscar/Maths/Triangle.h>
#include <oscar/Maths/Vec2.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
#include <oscar/Maths/Angle.h>
#include <oscar/Maths/CollisionTests.h>
#include <oscar/Maths/Line.h>
#include <oscar/Maths/MathHelpers.h>
#include <oscar/Maths/PolarPerspectiveCamera.h>
#include <oscar/Maths/QuaternionFunctions.h>
#include <oscar/Maths/RayCollision.h>
#include <oscar/Maths/Rect.h>
#include <oscar/Maths/RectFunctions.h>
#include <oscar/Maths/Sphere.h>
#include <oscar/Maths/Transform.h>
#include <oscar/Maths/Vec2.h>
Expand Down
1 change: 1 addition & 0 deletions src/OpenSimCreator/UI/MeshImporter/MeshImporterTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <oscar/Maths/MathHelpers.h>
#include <oscar/Maths/Quat.h>
#include <oscar/Maths/Rect.h>
#include <oscar/Maths/RectFunctions.h>
#include <oscar/Maths/Transform.h>
#include <oscar/Maths/TransformFunctions.h>
#include <oscar/Maths/Vec2.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <oscar/Maths/PolarPerspectiveCamera.h>
#include <oscar/Maths/RayCollision.h>
#include <oscar/Maths/Rect.h>
#include <oscar/Maths/RectFunctions.h>
#include <oscar/Maths/Transform.h>
#include <oscar/Maths/Vec2.h>
#include <oscar/Maths/Vec3.h>
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSimCreator/UI/Shared/BasicWidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <oscar/Graphics/Scene/SceneDecoration.h>
#include <oscar/Maths/MathHelpers.h>
#include <oscar/Maths/Rect.h>
#include <oscar/Maths/VecFunctions.h>
#include <oscar/Maths/RectFunctions.h>
#include <oscar/Maths/Vec2.h>
#include <oscar/Maths/Vec3.h>
#include <oscar/Platform/App.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <oscar/Graphics/Scene/SceneRenderer.h>
#include <oscar/Maths/BVH.h>
#include <oscar/Maths/MathHelpers.h>
#include <oscar/Maths/RectFunctions.h>
#include <oscar/Maths/Vec2.h>
#include <oscar/Platform/App.h>
#include <oscar/Platform/IconCodepoints.h>
Expand Down
1 change: 1 addition & 0 deletions src/OpenSimCreator/UI/Shared/ModelSelectionGizmo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <oscar/Maths/Quat.h>
#include <oscar/Maths/QuaternionFunctions.h>
#include <oscar/Maths/Rect.h>
#include <oscar/Maths/RectFunctions.h>
#include <oscar/Maths/Vec.h>
#include <oscar/Maths/Vec3.h>
#include <oscar/Maths/Vec4.h>
Expand Down
1 change: 1 addition & 0 deletions src/OpenSimCreator/UI/Shared/ModelViewerPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <OpenSim/Simulation/Model/Model.h>
#include <oscar/Maths/MathHelpers.h>
#include <oscar/Maths/Rect.h>
#include <oscar/Maths/RectFunctions.h>
#include <oscar/Maths/Vec3.h>
#include <oscar/Platform/App.h>
#include <oscar/Platform/Log.h>
Expand Down
1 change: 1 addition & 0 deletions src/OpenSimCreator/UI/Simulation/SimulationOutputPlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <OpenSim/Simulation/Model/Model.h>
#include <oscar/Graphics/Color.h>
#include <oscar/Maths/MathHelpers.h>
#include <oscar/Maths/RectFunctions.h>
#include <oscar/Maths/Vec2.h>
#include <oscar/Platform/IconCodepoints.h>
#include <oscar/Platform/Log.h>
Expand Down
1 change: 1 addition & 0 deletions src/OpenSimCreator/UI/SplashTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <oscar/Maths/MathHelpers.h>
#include <oscar/Maths/PolarPerspectiveCamera.h>
#include <oscar/Maths/Rect.h>
#include <oscar/Maths/RectFunctions.h>
#include <oscar/Maths/Vec2.h>
#include <oscar/Platform/App.h>
#include <oscar/Platform/AppMetadata.h>
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSimCreator/UI/TPS2DTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include <oscar/Maths/Mat4.h>
#include <oscar/Maths/MatFunctions.h>
#include <oscar/Maths/MathHelpers.h>
#include <oscar/Maths/RectFunctions.h>
#include <oscar/Maths/Vec2.h>
#include <oscar/Maths/Vec3.h>
#include <oscar/Maths/VecFunctions.h>
#include <oscar/Platform/App.h>
#include <oscar/Platform/IconCodepoints.h>
#include <oscar/UI/oscimgui.h>
Expand Down
1 change: 1 addition & 0 deletions src/OpenSimCreator/Utils/ShapeFitters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <oscar/Maths/GeometricFunctions.h>
#include <oscar/Maths/MathHelpers.h>
#include <oscar/Maths/Rect.h>
#include <oscar/Maths/RectFunctions.h>
#include <oscar/Maths/Sphere.h>
#include <oscar/Maths/Vec2.h>
#include <oscar/Maths/Vec3.h>
Expand Down
12 changes: 7 additions & 5 deletions src/oscar/DOM/Class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ using namespace osc;

namespace
{
const StringName& validate_as_classname(const StringName& str)
template<typename StringLike>
StringLike&& validate_as_classname(StringLike&& str)
requires std::constructible_from<std::string_view, StringLike&&>
{
if (is_valid_identifier(str)) {
return str;
return std::forward<StringLike>(str);
}
else {
std::stringstream ss;
Expand Down Expand Up @@ -69,7 +71,7 @@ class osc::Class::Impl final {
const Class& parent_class,
std::span<const PropertyInfo> properties) :

name_{validate_as_classname(StringName{name})},
name_{validate_as_classname(name)},
parent_class_{parent_class},
properties_{concat_into_vector(parent_class.properties(), properties)},
property_name_to_index_lookup_{create_index_lookup_throw_if_dupes(properties_)}
Expand All @@ -95,8 +97,8 @@ class osc::Class::Impl final {

osc::Class::Class()
{
static const std::shared_ptr<Impl> s_ObjectClassImpl = std::make_shared<Impl>();
impl_ = s_ObjectClassImpl;
static const auto s_object_class_impl = std::make_shared<Impl>();
impl_ = s_object_class_impl;
}

osc::Class::Class(
Expand Down
2 changes: 1 addition & 1 deletion src/oscar/DOM/Class.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace osc
public:
Class();

Class(
explicit Class(
std::string_view name,
const Class& parent_class = Class{},
std::span<const PropertyInfo> properties = std::span<const PropertyInfo>{}
Expand Down
2 changes: 1 addition & 1 deletion src/oscar/DOM/NodePath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace
// `path` quite a bit. The test suite is heavily relied on for
// developing this kind of tricky code.
//
// the reason it's done this way is because ths path is used in
// the reason it's done this way is because the path is used in
// performance-critical contexts

// assert that `path` contains no invalid chars
Expand Down
4 changes: 2 additions & 2 deletions src/oscar/DOM/NodePath.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace osc

Iterator() = default;

Iterator(std::string_view path) :
explicit Iterator(std::string_view path) :
current_{path.substr(0, path.find(separator))},
remaining_{current_.size() == path.size() ? std::string_view{} : path.substr(current_.size()+1)}
{}
Expand Down Expand Up @@ -99,7 +99,7 @@ namespace osc

template<>
struct std::hash<osc::NodePath> final {
size_t operator()(const osc::NodePath& node_path) const
size_t operator()(const osc::NodePath& node_path) const noexcept
{
return std::hash<std::string_view>{}(node_path);
}
Expand Down
4 changes: 2 additions & 2 deletions src/oscar/DOM/PropertyInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ namespace osc
public:
PropertyInfo() = default;

PropertyInfo(
explicit PropertyInfo(
std::string_view name,
Variant default_value) :

PropertyInfo{StringName{name}, std::move(default_value)}
{}

PropertyInfo(
explicit PropertyInfo(
StringName name,
Variant default_value
);
Expand Down
6 changes: 3 additions & 3 deletions src/oscar/Formats/CSV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ void osc::write_csv_row(
std::ostream& out,
std::span<const std::string> columns)
{
std::string_view delimeter;
std::string_view delimiter;
for (const auto& column : columns) {
const bool quoted = should_be_quoted(column);

out << delimeter;
out << delimiter;
if (quoted) {
out << '"';
}
Expand All @@ -131,7 +131,7 @@ void osc::write_csv_row(
out << '"';
}

delimeter = ",";
delimiter = ",";
}
out << '\n';
}
Loading

0 comments on commit 279a0b0

Please sign in to comment.