From 943f48e4b42a3e95d3f1b8542e76e5a6fc332357 Mon Sep 17 00:00:00 2001 From: Quentin Quadrat Date: Mon, 6 Nov 2023 02:09:14 +0100 Subject: [PATCH] Fix indentation --- src/Net/Formats/ExportDrawIO.cpp | 2 +- src/Net/Formats/ExportGraphviz.cpp | 2 +- src/Net/Formats/ExportJSON.cpp | 2 +- src/Net/Formats/ExportJulia.cpp | 2 +- src/Net/Formats/ExportPetriLaTeX.cpp | 2 +- src/Net/Formats/ExportPnEditor.cpp | 2 +- src/Net/Formats/ExportSymfony.cpp | 2 +- src/Net/Formats/ImportJSON.cpp | 20 ++++++++++---------- src/Net/PetriNet.cpp | 18 +++++++++--------- src/Net/SparseMatrix.hpp | 6 +++--- src/Renderer/PetriEditor.cpp | 24 ++++++++++++------------ src/Renderer/PetriEditor.hpp | 14 +++++++------- 12 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/Net/Formats/ExportDrawIO.cpp b/src/Net/Formats/ExportDrawIO.cpp index b50e10a..8e2901e 100644 --- a/src/Net/Formats/ExportDrawIO.cpp +++ b/src/Net/Formats/ExportDrawIO.cpp @@ -98,4 +98,4 @@ std::string exportToDrawIO(Net const& net, std::string const& filename) return {}; } -} // namespace tpne \ No newline at end of file +} // namespace tpne diff --git a/src/Net/Formats/ExportGraphviz.cpp b/src/Net/Formats/ExportGraphviz.cpp index 5732583..214018d 100644 --- a/src/Net/Formats/ExportGraphviz.cpp +++ b/src/Net/Formats/ExportGraphviz.cpp @@ -85,4 +85,4 @@ std::string exportToGraphviz(Net const& net, std::string const& filename) return {}; } -} // namespace tpne \ No newline at end of file +} // namespace tpne diff --git a/src/Net/Formats/ExportJSON.cpp b/src/Net/Formats/ExportJSON.cpp index afaa9b4..e11a9ce 100644 --- a/src/Net/Formats/ExportJSON.cpp +++ b/src/Net/Formats/ExportJSON.cpp @@ -88,4 +88,4 @@ std::string exportToJSON(Net const& net, std::string const& filename) return {}; } -} // namespace tpne \ No newline at end of file +} // namespace tpne diff --git a/src/Net/Formats/ExportJulia.cpp b/src/Net/Formats/ExportJulia.cpp index cf07fd3..d99c07a 100644 --- a/src/Net/Formats/ExportJulia.cpp +++ b/src/Net/Formats/ExportJulia.cpp @@ -168,4 +168,4 @@ std::string exportToJulia(Net const& net, std::string const& filename) return {}; } -} // namespace tpne \ No newline at end of file +} // namespace tpne diff --git a/src/Net/Formats/ExportPetriLaTeX.cpp b/src/Net/Formats/ExportPetriLaTeX.cpp index f6b69d4..02fce62 100644 --- a/src/Net/Formats/ExportPetriLaTeX.cpp +++ b/src/Net/Formats/ExportPetriLaTeX.cpp @@ -109,4 +109,4 @@ std::string exportToPetriLaTeX(Net const& net, std::string const& filename) return {}; } -} // namespace tpne \ No newline at end of file +} // namespace tpne diff --git a/src/Net/Formats/ExportPnEditor.cpp b/src/Net/Formats/ExportPnEditor.cpp index 5618868..115a69b 100644 --- a/src/Net/Formats/ExportPnEditor.cpp +++ b/src/Net/Formats/ExportPnEditor.cpp @@ -150,4 +150,4 @@ std::string exportToPNEditor(Net const& net, std::string const& filename) return {}; } -} // namespace tpne \ No newline at end of file +} // namespace tpne diff --git a/src/Net/Formats/ExportSymfony.cpp b/src/Net/Formats/ExportSymfony.cpp index f4d328f..7f48588 100644 --- a/src/Net/Formats/ExportSymfony.cpp +++ b/src/Net/Formats/ExportSymfony.cpp @@ -91,4 +91,4 @@ std::string exportToSymfony(Net const& net, std::string const& filename) return {}; } -} // namespace tpne \ No newline at end of file +} // namespace tpne diff --git a/src/Net/Formats/ImportJSON.cpp b/src/Net/Formats/ImportJSON.cpp index d03f88f..fb915e2 100644 --- a/src/Net/Formats/ImportJSON.cpp +++ b/src/Net/Formats/ImportJSON.cpp @@ -37,7 +37,7 @@ std::string importFromJSON(Net& net, std::string const& filename) if (!file) { error << "Failed opening '" << filename << "'. Reason was '" - << strerror(errno) << "'" << std::endl; + << strerror(errno) << "'" << std::endl; return error.str(); } @@ -50,7 +50,7 @@ std::string importFromJSON(Net& net, std::string const& filename) catch (std::exception const& e) { error << "Failed parsing '" << filename << "'. Reason was '" - << e.what() << "'" << std::endl; + << e.what() << "'" << std::endl; return error.str(); } @@ -65,7 +65,7 @@ std::string importFromJSON(Net& net, std::string const& filename) net.clear(TypeOfNet::TimedEventGraph); } else { error << "Failed parsing '" << filename << "'. Reason was '" - << "Unknown type of net: " << type << "'" << std::endl; + << "Unknown type of net: " << type << "'" << std::endl; return error.str(); } @@ -90,8 +90,8 @@ std::string importFromJSON(Net& net, std::string const& filename) if ((from == nullptr) || (to == nullptr)) { error << "Failed parsing '" << filename << "'. Reason was 'Arc " - << a["from"] << " -> " << a["to"] << " refer to unknown nodes'" - << std::endl; + << a["from"] << " -> " << a["to"] << " refer to unknown nodes'" + << std::endl; return error.str(); } @@ -103,16 +103,16 @@ std::string importFromJSON(Net& net, std::string const& filename) if (duration < 0.0f) { error << "Failed parsing '" << filename << "'. Reason was 'Arc " - << from->key << " -> " << to->key << " has negative duration'" - << std::endl; + << from->key << " -> " << to->key << " has negative duration'" + << std::endl; return error.str(); } } if (!net.addArc(*from, *to, duration)) { error << "Failed loading " << filename - << ". Arc " << from->key << " -> " << to->key - << " is badly formed" << std::endl; + << ". Arc " << from->key << " -> " << to->key + << " is badly formed" << std::endl; return error.str(); } } @@ -120,4 +120,4 @@ std::string importFromJSON(Net& net, std::string const& filename) return {}; } -} // namespace tpne \ No newline at end of file +} // namespace tpne diff --git a/src/Net/PetriNet.cpp b/src/Net/PetriNet.cpp index 64db86f..0e0b408 100644 --- a/src/Net/PetriNet.cpp +++ b/src/Net/PetriNet.cpp @@ -111,7 +111,7 @@ size_t Transition::howManyTokensCanBurnt() const //------------------------------------------------------------------------------ Net::Net(TypeOfNet const type) - : m_type(type), name(to_str(type)) + : m_type(type), name(to_str(type)) {} //------------------------------------------------------------------------------ @@ -125,11 +125,11 @@ Net& Net::operator=(Net const& other) for (auto const& it: other.m_arcs) { Node& from = (it.from.type == Node::Type::Place) - ? reinterpret_cast(m_places[it.from.id]) - : reinterpret_cast(m_transitions[it.from.id]); + ? reinterpret_cast(m_places[it.from.id]) + : reinterpret_cast(m_transitions[it.from.id]); Node& to = (it.to.type == Node::Type::Place) - ? reinterpret_cast(m_places[it.to.id]) - : reinterpret_cast(m_transitions[it.to.id]); + ? reinterpret_cast(m_places[it.to.id]) + : reinterpret_cast(m_transitions[it.to.id]); m_arcs.push_back(Arc(from, to, it.duration)); } generateArcsInArcsOut(); @@ -234,7 +234,7 @@ Place& Net::addPlace(float const x, float const y, size_t const tokens) //------------------------------------------------------------------------------ Place& Net::addPlace(size_t const id, std::string const& caption, float const x, - float const y, size_t const tokens) + float const y, size_t const tokens) { modified = true; m_places.push_back(Place(id, caption, x, y, tokens)); @@ -311,9 +311,9 @@ bool Net::sanityArc(Node const& from, Node const& to, bool const strict) const // Option 1: we simply fail (for example when loading file) m_message.str(""); m_message << "Failed adding arc " << from.key - << " --> " << to.key - << ": nodes type shall not be the same" - << std::endl; + << " --> " << to.key + << ": nodes type shall not be the same" + << std::endl; return false; } diff --git a/src/Net/SparseMatrix.hpp b/src/Net/SparseMatrix.hpp index 1a0b92a..46ea6ed 100644 --- a/src/Net/SparseMatrix.hpp +++ b/src/Net/SparseMatrix.hpp @@ -76,7 +76,7 @@ struct SparseMatrix // FIXME: redo manage (max,+) type { size_t currCol; - for (size_t pos = 0u; pos < i.size(); ++pos) + for (size_t pos = 0u; pos < i.size(); ++pos) { if (i[pos] == i_) { @@ -85,9 +85,9 @@ struct SparseMatrix // FIXME: redo manage (max,+) type return d[pos]; } } - } + } - return zero(); + return zero(); } //! \brief Option to display for C++ or for Julia diff --git a/src/Renderer/PetriEditor.cpp b/src/Renderer/PetriEditor.cpp index b149021..2b358df 100644 --- a/src/Renderer/PetriEditor.cpp +++ b/src/Renderer/PetriEditor.cpp @@ -138,10 +138,10 @@ static void help() { std::stringstream help; help << "Left button pressed: add a place" << std::endl - << "Right button pressed: add a transition" << std::endl - << "Middle button pressed: add an arc with the selected place or transition as origin" << std::endl - << "Middle button release: end the arc with the selected place or transition as destination" << std::endl - << "Middle button pressed: move the view" << std::endl; + << "Right button pressed: add a transition" << std::endl + << "Middle button pressed: add an arc with the selected place or transition as origin" << std::endl + << "Middle button release: end the arc with the selected place or transition as destination" << std::endl + << "Middle button pressed: move the view" << std::endl; ImGui::Text("%s", help.str().c_str()); ImGui::EndTabItem(); @@ -193,17 +193,17 @@ static void console(Editor& editor) if (logs[i].level == Messages::Level::Info) { ImGui::TextColored(ImVec4(0, 255, 0, 255), "%s[info]: %s", - logs[i].time.c_str(), logs[i].message.c_str()); + logs[i].time.c_str(), logs[i].message.c_str()); } else if (logs[i].level == Messages::Level::Error) { ImGui::TextColored(ImVec4(255, 0, 0, 255), "%s[error]: %s", - logs[i].time.c_str(), logs[i].message.c_str()); + logs[i].time.c_str(), logs[i].message.c_str()); } else { ImGui::TextColored(ImVec4(255, 0, 255, 255), "%s[warn]: %s", - logs[i].time.c_str(), logs[i].message.c_str()); + logs[i].time.c_str(), logs[i].message.c_str()); } } ImGui::End(); @@ -777,7 +777,7 @@ void Editor::onDraw() //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ static void drawArrow(ImDrawList* draw_list, const float xa, const float ya, - const float xb, const float yb, const ImU32 color) + const float xb, const float yb, const ImU32 color) { // Orientation const float teta = (yb - ya) / (xb - xa); @@ -901,7 +901,7 @@ void Editor::drawPlace(Place const& place) ImVec2 dim = ImGui::CalcTextSize(place.key.c_str()); ImVec2 ptext = p - ImVec2(dim.x / 2.0f, PLACE_RADIUS + dim.y); draw_list->AddText(ptext, IM_COL32(0, 0, 0, 255), - show_place_captions ? place.caption.c_str() : place.key.c_str()); + show_place_captions ? place.caption.c_str() : place.key.c_str()); // Draw the number of tokens if (place.tokens == 0u) @@ -973,7 +973,7 @@ void Editor::drawTransition(Transition const& transition) ImVec2 dim = ImGui::CalcTextSize(transition.key.c_str()); ImVec2 ptext = p - ImVec2(dim.x / 2.0f, TRANS_HEIGHT + dim.y); draw_list->AddText(ptext, IM_COL32(0, 0, 0, 255), - show_transition_captions ? transition.caption.c_str() : transition.key.c_str()); + show_transition_captions ? transition.caption.c_str() : transition.key.c_str()); } //------------------------------------------------------------------------------ @@ -1043,7 +1043,7 @@ void Editor::load() if (m_net.load(ImGuiFileDialog::Instance()->GetFilePathName())) { m_messages.setInfo("loaded with success " + - ImGuiFileDialog::Instance()->GetFilePathName()); + ImGuiFileDialog::Instance()->GetFilePathName()); } else { @@ -1083,7 +1083,7 @@ void Editor::exportTo(Exporter const& exporter) if (error.empty()) { m_messages.setInfo("saved with success " + - ImGuiFileDialog::Instance()->GetFilePathName()); + ImGuiFileDialog::Instance()->GetFilePathName()); } else { diff --git a/src/Renderer/PetriEditor.hpp b/src/Renderer/PetriEditor.hpp index 9f7e7f6..4946f3b 100644 --- a/src/Renderer/PetriEditor.hpp +++ b/src/Renderer/PetriEditor.hpp @@ -25,7 +25,7 @@ class Editor: public Application //! dummy if you do not want to open a file. //-------------------------------------------------------------------------- Editor(size_t const width, size_t const height, std::string const& title, - std::string const& project_path = {}); + std::string const& project_path = {}); public: @@ -63,12 +63,12 @@ class Editor: public Application ImVec2 getMousePosition(); void handleArcOrigin(); void handleArcDestination(); -/* - void align(); - PetriNet::CriticalCycleResult findCriticalCycle(); - bool screenshot(); - bool changeTypeOfNet(TypeOfNet const type); -*/ + /* + void align(); + PetriNet::CriticalCycleResult findCriticalCycle(); + bool screenshot(); + bool changeTypeOfNet(TypeOfNet const type); + */ void clear(); std::string getError() const