App: Apply clang format (part 1)

This commit is contained in:
wmayer
2024-11-15 17:43:49 +01:00
committed by wwmayer
parent 463cc08f3f
commit 6f5259af26
124 changed files with 6733 additions and 4886 deletions

View File

@@ -24,7 +24,7 @@
#define APP_DOCUMENTP_H
#ifdef _MSC_VER
#pragma warning( disable : 4834 )
#pragma warning(disable : 4834)
#endif
#include <App/DocumentObject.h>
@@ -38,22 +38,23 @@
// using VertexProperty = boost::property<boost::vertex_root_t, DocumentObject* >;
using DependencyList = boost::adjacency_list <
boost::vecS, // class OutEdgeListS : a Sequence or an AssociativeContainer
boost::vecS, // class VertexListS : a Sequence or a RandomAccessContainer
boost::directedS, // class DirectedS : This is a directed graph
boost::no_property, // class VertexProperty:
boost::no_property, // class EdgeProperty:
boost::no_property, // class GraphProperty:
boost::listS // class EdgeListS:
>;
using DependencyList = boost::adjacency_list<
boost::vecS, // class OutEdgeListS : a Sequence or an AssociativeContainer
boost::vecS, // class VertexListS : a Sequence or a RandomAccessContainer
boost::directedS, // class DirectedS : This is a directed graph
boost::no_property, // class VertexProperty:
boost::no_property, // class EdgeProperty:
boost::no_property, // class GraphProperty:
boost::listS // class EdgeListS:
>;
using Traits = boost::graph_traits<DependencyList>;
using Vertex = Traits::vertex_descriptor;
using Edge = Traits::edge_descriptor;
using Node = std::vector <size_t>;
using Path = std::vector <size_t>;
using Edge = Traits::edge_descriptor;
using Node = std::vector<size_t>;
using Path = std::vector<size_t>;
namespace App {
namespace App
{
using HasherMap = boost::bimap<StringHasherRef, int>;
class Transaction;
@@ -69,12 +70,12 @@ struct DocumentP
std::vector<DocumentObjectT> pendingRemove;
long lastObjectId;
DocumentObject* activeObject;
Transaction *activeUndoTransaction;
Transaction* activeUndoTransaction;
// pointer to the python class
Py::Object DocumentPythonObject;
int iTransactionMode;
bool rollback;
bool undoing; ///< document in the middle of undo or redo
bool undoing; ///< document in the middle of undo or redo
bool committing;
bool opentransaction;
std::bitset<32> StatusBits;
@@ -87,66 +88,77 @@ struct DocumentP
DependencyList DepList;
std::map<DocumentObject*, Vertex> VertexObjectList;
std::map<Vertex, DocumentObject*> vertexMap;
#endif //USE_OLD_DAG
std::multimap<const App::DocumentObject*,
std::unique_ptr<App::DocumentObjectExecReturn> > _RecomputeLog;
#endif // USE_OLD_DAG
std::multimap<const App::DocumentObject*, std::unique_ptr<App::DocumentObjectExecReturn>>
_RecomputeLog;
StringHasherRef Hasher;
DocumentP();
void addRecomputeLog(const char *why, App::DocumentObject *obj) {
void addRecomputeLog(const char* why, App::DocumentObject* obj)
{
addRecomputeLog(new DocumentObjectExecReturn(why, obj));
}
void addRecomputeLog(const std::string &why, App::DocumentObject *obj) {
void addRecomputeLog(const std::string& why, App::DocumentObject* obj)
{
addRecomputeLog(new DocumentObjectExecReturn(why, obj));
}
void addRecomputeLog(DocumentObjectExecReturn *returnCode) {
if(!returnCode->Which) {
void addRecomputeLog(DocumentObjectExecReturn* returnCode)
{
if (!returnCode->Which) {
delete returnCode;
return;
}
_RecomputeLog.emplace(returnCode->Which, std::unique_ptr<DocumentObjectExecReturn>(returnCode));
_RecomputeLog.emplace(returnCode->Which,
std::unique_ptr<DocumentObjectExecReturn>(returnCode));
returnCode->Which->setStatus(ObjectStatus::Error, true);
}
void clearRecomputeLog(const App::DocumentObject *obj=nullptr) {
if(!obj)
void clearRecomputeLog(const App::DocumentObject* obj = nullptr)
{
if (!obj) {
_RecomputeLog.clear();
else
}
else {
_RecomputeLog.erase(obj);
}
}
void clearDocument() {
void clearDocument()
{
objectArray.clear();
for(auto &v : objectMap) {
for (auto& v : objectMap) {
v.second->setStatus(ObjectStatus::Destroy, true);
delete(v.second);
delete (v.second);
v.second = nullptr;
}
objectMap.clear();
objectIdMap.clear();
}
const char *findRecomputeLog(const App::DocumentObject *obj) {
const char* findRecomputeLog(const App::DocumentObject* obj)
{
auto range = _RecomputeLog.equal_range(obj);
if(range.first == range.second)
if (range.first == range.second) {
return nullptr;
}
return (--range.second)->second->Why.c_str();
}
static
void findAllPathsAt(const std::vector <Node> &all_nodes, size_t id,
std::vector <Path> &all_paths, Path tmp);
static void findAllPathsAt(const std::vector<Node>& all_nodes,
size_t id,
std::vector<Path>& all_paths,
Path tmp);
std::vector<App::DocumentObject*>
topologicalSort(const std::vector<App::DocumentObject*>& objects) const;
std::vector<App::DocumentObject*>
static partialTopologicalSort(const std::vector<App::DocumentObject*>& objects);
static std::vector<App::DocumentObject*> partialTopologicalSort(
const std::vector<App::DocumentObject*>& objects);
static void checkStringHasher(const Base::XMLReader& reader);
};
} // namespace App
} // namespace App
#endif // APP_DOCUMENTP_H
#endif // APP_DOCUMENTP_H