App: Apply clang format (part 3)

This commit is contained in:
wmayer
2024-11-28 23:03:39 +01:00
committed by wwmayer
parent 3cec8114b5
commit 4e4bcd5ce7
6 changed files with 50 additions and 45 deletions

View File

@@ -78,7 +78,6 @@ class AppExport Application
{
public:
//---------------------------------------------------------------------
// exported functions go here +++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------------------------
@@ -205,6 +204,8 @@ public:
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 @@ public:
boost::signals2::signal<void (const App::ExtensionContainer&, std::string extension)> signalBeforeAddingDynamicExtension;
/// signal after the extension was added
boost::signals2::signal<void (const App::ExtensionContainer&, std::string extension)> signalAddedDynamicExtension;
//@}
//@}
// clang-format off
// NOLINTEND
/** @name methods for parameter handling */

View File

@@ -33,6 +33,7 @@
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/mem_fun.hpp>
#include <FCGlobal.h>
namespace Base

View File

@@ -50,8 +50,10 @@ using ExpressionPtr = std::unique_ptr<Expression>;
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<App::DocumentObject*, std::map<std::string, std::vector<ObjectIdentifier> > >;
// clang-format on
class AppExport ExpressionVisitor {
public:
@@ -212,12 +214,14 @@ protected:
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
};
}

View File

@@ -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<Property*>& List) const
void Extension::extensionGetPropertyMap(std::map<std::string, Property*>& 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
{

View File

@@ -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 @@ private:
App::ExtensionContainer* m_base = nullptr;
};
// clang-format off
// Property define
#define _EXTENSION_ADD_PROPERTY(_name, _prop_, _defaultval_) \
do { \
@@ -321,6 +324,7 @@ private:
#define EXTENSION_ADD_PROPERTY_TYPE(_prop_, _defaultval_, _group_,_type_,_Docu_) \
_EXTENSION_ADD_PROPERTY_TYPE(#_prop_, _prop_, _defaultval_, _group_,_type_,_Docu_)
// clang-format on
} //App

View File

@@ -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<PropertySpec, const char*, &PropertySpec::Name>,
CStringHasher,
CStringHasher
>,
bmi::hashed_unique<
bmi::member<PropertySpec, short, &PropertySpec::Offset>
>
>
> 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<PropertySpec, const char*, &PropertySpec::Name>,
CStringHasher,
CStringHasher
>,
bmi::hashed_unique<
bmi::member<PropertySpec, short, &PropertySpec::Offset>
>
>
> propertyData;
// clang-format on
mutable bool parentMerged = false;
@@ -269,6 +271,7 @@ private:
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