Skip to content

Commit bb2a90e

Browse files
committed
formatted undo tree
1 parent 9c49a1d commit bb2a90e

File tree

1 file changed

+9
-25
lines changed

1 file changed

+9
-25
lines changed

src/backend/circuit/undoTree/undoTree.cpp

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
// ================================================================================================
44
// Class UndoTree implementation
55

6-
UndoTree::UndoTree() :
7-
mainBranch(new Branch(this)) {
8-
branches.insert(mainBranch);
9-
}
6+
UndoTree::UndoTree() : mainBranch(new Branch(this)) { branches.insert(mainBranch); }
107
UndoTree::~UndoTree() {
118
for (Branch* branch : branches) {
129
delete branch;
@@ -15,9 +12,7 @@ UndoTree::~UndoTree() {
1512
mainBranch = nullptr;
1613
}
1714

18-
size_t UndoTree::numBranches() const {
19-
return branches.size();
20-
}
15+
size_t UndoTree::numBranches() const { return branches.size(); }
2116

2217
UndoTree::iterator UndoTree::insert(const iterator& it, DifferenceSharedPtr diff) {
2318
// Make sure the iterator is on this tree
@@ -71,15 +66,12 @@ UndoTree::iterator UndoTree::begin() {
7166
} else return iterator(mainBranch, 0);
7267
}
7368

74-
UndoTree::iterator UndoTree::end() {
75-
return iterator(mainBranch, -1);
76-
}
69+
UndoTree::iterator UndoTree::end() { return iterator(mainBranch, -1); }
7770

7871
// ================================================================================================
7972
// Class UndoTree::iterator implementation
8073

81-
UndoTree::iterator::iterator(Branch* branch, int pos) :
82-
branch(branch), pos(pos) { }
74+
UndoTree::iterator::iterator(Branch* branch, int pos) : branch(branch), pos(pos) { }
8375

8476
UndoTree::iterator UndoTree::iterator::next(int whichBranch) const {
8577
if (whichBranch == -1) {
@@ -131,15 +123,12 @@ bool UndoTree::iterator::operator==(const iterator& other) const {
131123
} else return **this == *other;
132124
}
133125

134-
bool UndoTree::iterator::operator!=(const iterator& other) const {
135-
return !(*this == other);
136-
}
126+
bool UndoTree::iterator::operator!=(const iterator& other) const { return !(*this == other); }
137127

138128
// ================================================================================================
139129
// Class UndoTree::Branch implementation
140130

141-
UndoTree::Branch::Branch(UndoTree* tree) :
142-
tree(tree), parentBranch(nullptr), parentNode(-1) { }
131+
UndoTree::Branch::Branch(UndoTree* tree) : tree(tree), parentBranch(nullptr), parentNode(-1) { }
143132
UndoTree::Branch::Branch(UndoTree* tree, Branch* parentBranch, int parentNode, DifferenceSharedPtr diff) :
144133
tree(tree), parentBranch(parentBranch), parentNode(parentNode) {
145134
nodes.emplace_back(Node(diff));
@@ -148,13 +137,8 @@ UndoTree::Branch::Branch(UndoTree* tree, Branch* parentBranch, int parentNode, D
148137
// ================================================================================================
149138
// Class UndoTree::Branch::Node implementation
150139

151-
UndoTree::Branch::Node::Node(DifferenceSharedPtr diff) :
152-
diff(diff), branches(nullptr) { }
140+
UndoTree::Branch::Node::Node(DifferenceSharedPtr diff) : diff(diff), branches(nullptr) { }
153141

154-
UndoTree::Branch::Node::~Node() {
155-
delete branches;
156-
}
142+
UndoTree::Branch::Node::~Node() { delete branches; }
157143

158-
bool onSameBranch(const UndoTree::iterator& a, const UndoTree::iterator& b) {
159-
return a.branch == b.branch;
160-
}
144+
bool onSameBranch(const UndoTree::iterator& a, const UndoTree::iterator& b) { return a.branch == b.branch; }

0 commit comments

Comments
 (0)