summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-03-03 14:30:27 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2019-03-03 14:30:27 +0000
commit04f6fcd34b4744e2303262db3136c3097e0091b6 (patch)
tree5dadebad64efc33f0c23bcc492acda3cca29e2be
parentFix test code pulling in implementation header (diff)
downloadslicer-04f6fcd34b4744e2303262db3136c3097e0091b6.tar.bz2
slicer-04f6fcd34b4744e2303262db3136c3097e0091b6.tar.xz
slicer-04f6fcd34b4744e2303262db3136c3097e0091b6.zip
More clang tidy fixes
-rw-r--r--slicer/slicer/modelParts.h53
-rw-r--r--slicer/slicer/modelPartsTypes.cpp2
-rw-r--r--slicer/slicer/modelPartsTypes.h2
-rw-r--r--slicer/slicer/serializer.h26
-rw-r--r--slicer/slicer/slicer.h4
5 files changed, 53 insertions, 34 deletions
diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h
index 9b7d886..9d6384e 100644
--- a/slicer/slicer/modelParts.h
+++ b/slicer/slicer/modelParts.h
@@ -65,16 +65,14 @@ namespace Slicer {
class ModelPartForRootBase;
class HookCommon;
- typedef std::shared_ptr<ModelPart> ModelPartPtr;
- typedef std::shared_ptr<ModelPartForRootBase> ModelPartForRootPtr;
- typedef std::unique_ptr<HookCommon> HookCommonPtr;
- typedef Ice::optional<std::string> TypeId;
-
- typedef std::function<void(const std::string &, ModelPartPtr, const HookCommon *)> ChildHandler;
-
- typedef std::function<ModelPartPtr(void *)> ClassRef;
- typedef std::function<bool(const HookCommon *)> HookFilter;
- typedef std::list<std::string> Metadata;
+ using ModelPartPtr = std::shared_ptr<ModelPart>;
+ using ModelPartForRootPtr = std::shared_ptr<ModelPartForRootBase>;
+ using HookCommonPtr = std::unique_ptr<HookCommon>;
+ using TypeId = Ice::optional<std::string>;
+ using ChildHandler = std::function<void(const std::string &, ModelPartPtr, const HookCommon *)>;
+ using ClassRef = std::function<ModelPartPtr(void *)>;
+ using HookFilter = std::function<bool(const HookCommon *)>;
+ using Metadata = std::list<std::string>;
DLL_PUBLIC extern const Metadata emptyMetadata;
enum ModelPartType {
@@ -93,13 +91,13 @@ namespace Slicer {
class DLL_PUBLIC ChildRef {
public:
- ChildRef();
- ChildRef(ModelPartPtr);
- ChildRef(ModelPartPtr, const Metadata &);
+ explicit ChildRef();
+ explicit ChildRef(ModelPartPtr);
+ explicit ChildRef(ModelPartPtr, const Metadata &);
ModelPartPtr Child() const;
const Metadata & ChildMetaData() const;
- operator bool() const;
+ explicit operator bool() const;
private:
ModelPartPtr mpp;
@@ -108,7 +106,7 @@ namespace Slicer {
class DLL_PUBLIC HookCommon {
public:
- HookCommon(std::string);
+ explicit HookCommon(std::string);
bool filter(const HookFilter & flt);
void apply(const ChildHandler & ch, const ModelPartPtr & modelPart);
@@ -124,8 +122,15 @@ namespace Slicer {
class DLL_PUBLIC ModelPart : public std::enable_shared_from_this<ModelPart> {
public:
+ ModelPart() = default;
+ ModelPart(const ModelPart &) = delete;
+ ModelPart(ModelPart &&) = delete;
+
virtual ~ModelPart() = default;
+ ModelPart & operator=(const ModelPart &) = delete;
+ ModelPart & operator=(ModelPart &&) = delete;
+
template<typename T>
static ModelPartPtr CreateFor();
template<typename T>
@@ -155,24 +160,24 @@ namespace Slicer {
template<typename T>
class DLL_PUBLIC ModelPartModel {
protected:
- ModelPartModel() : Model(nullptr) { }
- ModelPartModel(T * m) : Model(m) { }
+ explicit ModelPartModel() : Model(nullptr) { }
+ explicit ModelPartModel(T * m) : Model(m) { }
T * Model;
};
class DLL_PUBLIC ModelPartForRootBase : public ModelPart {
public:
- ModelPartForRootBase(ModelPartPtr mp);
+ explicit ModelPartForRootBase(ModelPartPtr mp);
virtual const std::string & GetRootName() const = 0;
- virtual ChildRef GetAnonChildRef(const HookFilter &) override;
- virtual ChildRef GetChildRef(const std::string & name, const HookFilter &, bool matchCase = true) override;
- virtual void OnEachChild(const ChildHandler & ch) override;
- virtual ModelPartType GetType() const override;
- virtual bool IsOptional() const override;
+ ChildRef GetAnonChildRef(const HookFilter &) override;
+ ChildRef GetChildRef(const std::string & name, const HookFilter &, bool matchCase = true) override;
+ void OnEachChild(const ChildHandler & ch) override;
+ ModelPartType GetType() const override;
+ bool IsOptional() const override;
virtual void Write(::Ice::OutputStream &) const = 0;
virtual void Read(::Ice::InputStream &) = 0;
- virtual ModelPartPtr GetContainedModelPart() override;
+ ModelPartPtr GetContainedModelPart() override;
ModelPartPtr mp;
};
diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp
index ac95164..faad404 100644
--- a/slicer/slicer/modelPartsTypes.cpp
+++ b/slicer/slicer/modelPartsTypes.cpp
@@ -267,7 +267,7 @@ namespace Slicer {
ModelPartType ModelPartForStreamBase::GetType() const { return mpt_Sequence; }
bool ModelPartForStreamBase::HasValue() const { return true; }
// Stream Roots
- ModelPartForStreamRootBase::ModelPartForStreamRootBase(ModelPartPtr mp) : ModelPartForRootBase(std::move(mp)) { }
+ ModelPartForStreamRootBase::ModelPartForStreamRootBase(const ModelPartPtr & mp) : ModelPartForRootBase(mp) { }
// NOLINTNEXTLINE(hicpp-no-array-decay)
void ModelPartForStreamRootBase::Write(Ice::OutputStream&) const { throw InvalidStreamOperation(__FUNCTION__); }
// NOLINTNEXTLINE(hicpp-no-array-decay)
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h
index 2ce204e..3c69f76 100644
--- a/slicer/slicer/modelPartsTypes.h
+++ b/slicer/slicer/modelPartsTypes.h
@@ -351,7 +351,7 @@ namespace Slicer {
class DLL_PUBLIC ModelPartForStreamRootBase : public ModelPartForRootBase {
public:
- ModelPartForStreamRootBase(ModelPartPtr mp);
+ ModelPartForStreamRootBase(const ModelPartPtr & mp);
virtual void Write(Ice::OutputStream&) const override;
virtual void Read(Ice::InputStream&) override;
diff --git a/slicer/slicer/serializer.h b/slicer/slicer/serializer.h
index 857fa65..73d4617 100644
--- a/slicer/slicer/serializer.h
+++ b/slicer/slicer/serializer.h
@@ -9,24 +9,38 @@
namespace Slicer {
class DLL_PUBLIC Serializer {
public:
+ Serializer() = default;
+ Serializer(const Serializer &) = delete;
+ Serializer(Serializer &&) = delete;
+
virtual ~Serializer() = default;
+ Serializer & operator=(const Serializer &) = delete;
+ Serializer & operator=(Serializer &&) = delete;
+
virtual void Serialize(ModelPartForRootPtr) = 0;
};
- typedef std::shared_ptr<Serializer> SerializerPtr;
+ using SerializerPtr = std::shared_ptr<Serializer>;
class DLL_PUBLIC Deserializer {
public:
+ Deserializer() = default;
+ Deserializer(const Deserializer &) = delete;
+ Deserializer(Deserializer &&) = delete;
+
virtual ~Deserializer() = default;
+ Deserializer & operator=(const Deserializer &) = delete;
+ Deserializer & operator=(Deserializer &&) = delete;
+
virtual void Deserialize(ModelPartForRootPtr) = 0;
};
- typedef std::shared_ptr<Deserializer> DeserializerPtr;
+ using DeserializerPtr = std::shared_ptr<Deserializer>;
- typedef AdHoc::Factory<Serializer, std::ostream &> StreamSerializerFactory;
- typedef AdHoc::Factory<Deserializer, std::istream &> StreamDeserializerFactory;
- typedef AdHoc::Factory<Serializer, const std::filesystem::path &> FileSerializerFactory;
- typedef AdHoc::Factory<Deserializer, const std::filesystem::path &> FileDeserializerFactory;
+ using StreamSerializerFactory = AdHoc::Factory<Serializer, std::ostream &>;
+ using StreamDeserializerFactory = AdHoc::Factory<Deserializer, std::istream &>;
+ using FileSerializerFactory = AdHoc::Factory<Serializer, const std::filesystem::path &>;
+ using FileDeserializerFactory = AdHoc::Factory<Deserializer, const std::filesystem::path &>;
}
#endif
diff --git a/slicer/slicer/slicer.h b/slicer/slicer/slicer.h
index 7d6f381..16d5a46 100644
--- a/slicer/slicer/slicer.h
+++ b/slicer/slicer/slicer.h
@@ -7,7 +7,7 @@
namespace Slicer {
template <typename Object>
Object
- DeserializeAnyWith(DeserializerPtr deserializer)
+ DeserializeAnyWith(const DeserializerPtr & deserializer)
{
Object object;
deserializer->Deserialize(ModelPart::CreateRootFor<Object>(object));
@@ -23,7 +23,7 @@ namespace Slicer {
template <typename Object>
void
- SerializeAnyWith(const Object & object, SerializerPtr serializer)
+ SerializeAnyWith(const Object & object, const SerializerPtr & serializer)
{
serializer->Serialize(ModelPart::CreateRootFor<const Object>(object));
}