Skip to content

Commit

Permalink
App: Apply clang format (part 3)
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Nov 28, 2024
1 parent a372678 commit 4e70619
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 45 deletions.
7 changes: 5 additions & 2 deletions src/App/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ class AppExport Application
{

public:

//---------------------------------------------------------------------
// exported functions go here +++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------------------------
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -311,7 +312,9 @@ class AppExport Application
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 */
Expand Down
1 change: 1 addition & 0 deletions src/App/DynamicProperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/App/Expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
};

}
Expand Down
23 changes: 6 additions & 17 deletions src/App/Extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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");
Expand Down Expand Up @@ -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);
Expand All @@ -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");
}
Expand All @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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
Expand All @@ -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)
Expand All @@ -217,7 +206,7 @@ bool Extension::extensionHandleChangedPropertyName(Base::XMLReader& reader,
(void)PropName;

return false;
};
}

bool Extension::extensionHandleChangedPropertyType(Base::XMLReader& reader,
const char* TypeName,
Expand All @@ -228,7 +217,7 @@ bool Extension::extensionHandleChangedPropertyType(Base::XMLReader& reader,
(void)prop;

return false;
};
}

namespace App
{
Expand Down
4 changes: 4 additions & 0 deletions src/App/Extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ namespace App {

class ExtensionContainer;

// clang-format off
/// define Extension types
#define EXTENSION_TYPESYSTEM_HEADER() \
public: \
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 { \
Expand All @@ -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
Expand Down
56 changes: 30 additions & 26 deletions src/App/PropertyContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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 { \
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 4e70619

Please sign in to comment.