From ef27cc7d177aa7c64c514af824ba41628f8cd4b9 Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Sun, 12 Jan 2025 21:40:45 +0100 Subject: [PATCH] Make old type countObjectsOfType functions protected --- src/App/Document.h | 2 +- src/Gui/Selection.h | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/App/Document.h b/src/App/Document.h index cf7ea9672f..b13b206bd0 100644 --- a/src/App/Document.h +++ b/src/App/Document.h @@ -338,7 +338,6 @@ public: /// Returns an array with the correct types already. template inline std::vector getObjectsOfType() const; - int countObjectsOfType(const Base::Type& typeId) const; template inline int countObjectsOfType() const; int countObjectsOfType(const char* typeName) const; @@ -593,6 +592,7 @@ protected: std::vector readObjects(Base::XMLReader& reader); void writeObjects(const std::vector&, Base::Writer& writer) const; bool saveToFile(const char* filename) const; + int countObjectsOfType(const Base::Type& typeId) const; void onBeforeChange(const Property* prop) override; void onChanged(const Property* prop) override; diff --git a/src/Gui/Selection.h b/src/Gui/Selection.h index 2780914dec..f5e0154204 100644 --- a/src/Gui/Selection.h +++ b/src/Gui/Selection.h @@ -387,14 +387,9 @@ public: * If no document name is given the active document is assumed. * * Set 'resolve' to true to resolve any sub object inside selection SubName - * field - */ - unsigned int countObjectsOfType(const Base::Type& typeId=App::DocumentObject::getClassTypeId(), - const char* pDocName=nullptr, ResolveMode resolve = ResolveMode::OldStyleElement) const; - - /** - * A convenience template-based method that returns the number of objects of the given type. - * \a T must be based on Base::BaseClass, otherwise 0 is returned. + * field. + * + * The typename T must be based on App::DocumentObject. */ template inline unsigned int countObjectsOfType( const char* pDocName=nullptr, ResolveMode resolve = ResolveMode::OldStyleElement) const; @@ -715,6 +710,9 @@ protected: static App::DocumentObject *getObjectOfType(_SelObj &sel, Base::Type type, ResolveMode resolve, const char **subelement=nullptr); + unsigned int countObjectsOfType(const Base::Type& typeId=App::DocumentObject::getClassTypeId(), + const char* pDocName=nullptr, ResolveMode resolve = ResolveMode::OldStyleElement) const; + static SelectionSingleton* _pcSingleton; std::string DocName;