diff --git a/src/App/Application.h b/src/App/Application.h index 95ec7c2c16ad..e2a32adefe2d 100644 --- a/src/App/Application.h +++ b/src/App/Application.h @@ -78,7 +78,6 @@ class AppExport Application { public: - //--------------------------------------------------------------------- // exported functions go here +++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------- @@ -205,6 +204,8 @@ class AppExport Application void closeActiveTransaction(bool abort=false, int id=0); //@} + // NOLINTBEGIN + // clang-format off /** @name Signals of the Application */ //@{ /// signal on new Document @@ -311,7 +312,9 @@ class AppExport Application boost::signals2::signal signalBeforeAddingDynamicExtension; /// signal after the extension was added boost::signals2::signal signalAddedDynamicExtension; - //@} + //@} + // clang-format off + // NOLINTEND /** @name methods for parameter handling */ diff --git a/src/App/DynamicProperty.h b/src/App/DynamicProperty.h index 6a2caf1d1198..29936fa66563 100644 --- a/src/App/DynamicProperty.h +++ b/src/App/DynamicProperty.h @@ -33,6 +33,7 @@ #include #include #include +#include namespace Base diff --git a/src/App/Expression.h b/src/App/Expression.h index 78f1edb1c58c..7ff8352d0c12 100644 --- a/src/App/Expression.h +++ b/src/App/Expression.h @@ -50,8 +50,10 @@ using ExpressionPtr = std::unique_ptr; AppExport bool isAnyEqual(const App::any &v1, const App::any &v2); AppExport Base::Quantity anyToQuantity(const App::any &value, const char *errmsg = nullptr); +// clang-format off // Map of depending objects to a map of depending property name to the full referencing object identifier using ExpressionDeps = std::map > >; +// clang-format on class AppExport ExpressionVisitor { public: @@ -212,12 +214,14 @@ class AppExport Expression : public Base::BaseClass { virtual void _visit(ExpressionVisitor &) {} protected: + // clang-format off App::DocumentObject * owner; /**< The document object used to access unqualified variables (i.e local scope) */ ComponentList components; public: std::string comment; + // clang-format on }; } diff --git a/src/App/Extension.cpp b/src/App/Extension.cpp index 51ba5fff7cb1..c84e613de49d 100644 --- a/src/App/Extension.cpp +++ b/src/App/Extension.cpp @@ -39,18 +39,21 @@ * PropertyData in the extension chain, there is no parent property data. */ EXTENSION_TYPESYSTEM_SOURCE_P(App::Extension) + const App::PropertyData* App::Extension::extensionGetPropertyDataPtr() { return &propertyData; } + const App::PropertyData& App::Extension::extensionGetPropertyData() const { return propertyData; } + App::PropertyData App::Extension::propertyData; + void App::Extension::init() { - assert(Extension::classTypeId == Base::Type::badType() && "don't init() twice!"); /* Set up entry in the type system. */ @@ -76,7 +79,6 @@ Extension::~Extension() void Extension::initExtensionType(Base::Type type) { - m_extensionType = type; if (m_extensionType.isBad()) { throw Base::RuntimeError("Extension: Extension type not set"); @@ -104,7 +106,6 @@ void Extension::initExtension(ExtensionContainer* obj) PyObject* Extension::getExtensionPyObject() { - if (ExtensionPythonObject.is(Py::_None())) { // ref counter is set to 1 auto grp = new ExtensionPy(this); @@ -115,7 +116,6 @@ PyObject* Extension::getExtensionPyObject() std::string Extension::name() const { - if (m_extensionType.isBad()) { throw Base::RuntimeError("Extension::name: Extension type not set"); } @@ -131,50 +131,42 @@ std::string Extension::name() const Property* Extension::extensionGetPropertyByName(const char* name) const { - return extensionGetPropertyData().getPropertyByName(this, name); } short int Extension::extensionGetPropertyType(const Property* prop) const { - return extensionGetPropertyData().getType(this, prop); } short int Extension::extensionGetPropertyType(const char* name) const { - return extensionGetPropertyData().getType(this, name); } const char* Extension::extensionGetPropertyName(const Property* prop) const { - return extensionGetPropertyData().getName(this, prop); } const char* Extension::extensionGetPropertyGroup(const Property* prop) const { - return extensionGetPropertyData().getGroup(this, prop); } const char* Extension::extensionGetPropertyGroup(const char* name) const { - return extensionGetPropertyData().getGroup(this, name); } const char* Extension::extensionGetPropertyDocumentation(const Property* prop) const { - return extensionGetPropertyData().getDocumentation(this, prop); } const char* Extension::extensionGetPropertyDocumentation(const char* name) const { - return extensionGetPropertyData().getDocumentation(this, name); } @@ -186,7 +178,6 @@ void Extension::extensionGetPropertyList(std::vector& List) const void Extension::extensionGetPropertyMap(std::map& Map) const { - extensionGetPropertyData().getPropertyMap(this, Map); } @@ -195,7 +186,6 @@ void Extension::initExtensionSubclass(Base::Type& toInit, const char* ParentName, Base::Type::instantiationMethod method) { - // don't init twice! assert(toInit == Base::Type::badType()); // get the parent class @@ -207,7 +197,6 @@ void Extension::initExtensionSubclass(Base::Type& toInit, toInit = Base::Type::createType(parentType, ClassName, method); } - bool Extension::extensionHandleChangedPropertyName(Base::XMLReader& reader, const char* TypeName, const char* PropName) @@ -217,7 +206,7 @@ bool Extension::extensionHandleChangedPropertyName(Base::XMLReader& reader, (void)PropName; return false; -}; +} bool Extension::extensionHandleChangedPropertyType(Base::XMLReader& reader, const char* TypeName, @@ -228,7 +217,7 @@ bool Extension::extensionHandleChangedPropertyType(Base::XMLReader& reader, (void)prop; return false; -}; +} namespace App { diff --git a/src/App/Extension.h b/src/App/Extension.h index 10e54e435523..7c1545435e3b 100644 --- a/src/App/Extension.h +++ b/src/App/Extension.h @@ -31,6 +31,7 @@ namespace App { class ExtensionContainer; +// clang-format off /// define Extension types #define EXTENSION_TYPESYSTEM_HEADER() \ public: \ @@ -119,6 +120,7 @@ template<> void _class_::init(void){\ initExtensionSubclass(_class_::classTypeId, #_class_ , #_parentclass_, &(_class_::create) ); \ _class_::propertyData.parentPropertyData = _parentclass_::extensionGetPropertyDataPtr();\ } +// clang-format on /** * @brief Base class for all extension that can be added to a DocumentObject @@ -302,6 +304,7 @@ class AppExport Extension App::ExtensionContainer* m_base = nullptr; }; +// clang-format off // Property define #define _EXTENSION_ADD_PROPERTY(_name, _prop_, _defaultval_) \ do { \ @@ -321,6 +324,7 @@ class AppExport Extension #define EXTENSION_ADD_PROPERTY_TYPE(_prop_, _defaultval_, _group_,_type_,_Docu_) \ _EXTENSION_ADD_PROPERTY_TYPE(#_prop_, _prop_, _defaultval_, _group_,_type_,_Docu_) +// clang-format on } //App diff --git a/src/App/PropertyContainer.h b/src/App/PropertyContainer.h index 9f50ce9aa8a5..b8b5ac91ae1d 100644 --- a/src/App/PropertyContainer.h +++ b/src/App/PropertyContainer.h @@ -45,13 +45,13 @@ class Extension; // clang-format off enum PropertyType { - Prop_None = 0, /*!< No special property type */ - Prop_ReadOnly = 1, /*!< Property is read-only in the editor */ - Prop_Transient = 2, /*!< Property content won't be saved to file, but still saves name, type and status */ - Prop_Hidden = 4, /*!< Property won't appear in the editor */ - Prop_Output = 8, /*!< Modified property doesn't touch its parent container */ - Prop_NoRecompute = 16,/*!< Modified property doesn't touch its container for recompute */ - Prop_NoPersist = 32,/*!< Property won't be saved to file at all */ + Prop_None = 0, /*!< No special property type */ + Prop_ReadOnly = 1, /*!< Property is read-only in the editor */ + Prop_Transient = 2, /*!< Property content won't be saved to file, but still saves name, type and status */ + Prop_Hidden = 4, /*!< Property won't appear in the editor */ + Prop_Output = 8, /*!< Modified property doesn't touch its parent container */ + Prop_NoRecompute = 16,/*!< Modified property doesn't touch its container for recompute */ + Prop_NoPersist = 32,/*!< Property won't be saved to file at all */ }; // clang-format on @@ -91,25 +91,27 @@ struct AppExport PropertyData const void* m_container; }; - // A multi index container for holding the property spec, with the following - // index, - // * a sequence, to preserve creation order - // * hash index on property name - // * hash index on property pointer offset - mutable bmi::multi_index_container< - PropertySpec, - bmi::indexed_by< - bmi::sequenced<>, - bmi::hashed_unique< - bmi::member, - CStringHasher, - CStringHasher - >, - bmi::hashed_unique< - bmi::member - > - > - > propertyData; + // clang-format off + // A multi index container for holding the property spec, with the following + // index, + // * a sequence, to preserve creation order + // * hash index on property name + // * hash index on property pointer offset + mutable bmi::multi_index_container< + PropertySpec, + bmi::indexed_by< + bmi::sequenced<>, + bmi::hashed_unique< + bmi::member, + CStringHasher, + CStringHasher + >, + bmi::hashed_unique< + bmi::member + > + > + > propertyData; + // clang-format on mutable bool parentMerged = false; @@ -269,6 +271,7 @@ class AppExport PropertyContainer: public Base::Persistence static PropertyData propertyData; }; +// clang-format off /// Property define #define _ADD_PROPERTY(_name,_prop_, _defaultval_) \ do { \ @@ -345,6 +348,7 @@ template<> void _class_::init(void){\ initSubclass(_class_::classTypeId, #_class_ , #_parentclass_, &(_class_::create) ); \ _class_::propertyData.parentPropertyData = _parentclass_::getPropertyDataPtr(); \ } +// clang-format on } // namespace App