summaryrefslogtreecommitdiff
path: root/ui/grid_view.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:27:42 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:27:42 +0200
commitb916407a2a06f8452e82b74dc44c54acbcc572b0 (patch)
tree46358e0bb035fca0f42edb4b5b8aa5f1613814af /ui/grid_view.cpp
parent5.20 (diff)
downloadFreeFileSync-b916407a2a06f8452e82b74dc44c54acbcc572b0.tar.gz
FreeFileSync-b916407a2a06f8452e82b74dc44c54acbcc572b0.tar.bz2
FreeFileSync-b916407a2a06f8452e82b74dc44c54acbcc572b0.zip
5.21
Diffstat (limited to 'ui/grid_view.cpp')
-rw-r--r--ui/grid_view.cpp36
1 files changed, 14 insertions, 22 deletions
diff --git a/ui/grid_view.cpp b/ui/grid_view.cpp
index fa1e9915..e1e16e47 100644
--- a/ui/grid_view.cpp
+++ b/ui/grid_view.cpp
@@ -297,34 +297,26 @@ void GridView::removeInvalidRows()
class GridView::SerializeHierarchy
{
public:
+ static void execute(HierarchyObject& hierObj, std::vector<GridView::RefIndex>& sortedRef, size_t index) { SerializeHierarchy(sortedRef, index).recurse(hierObj); }
+
+private:
SerializeHierarchy(std::vector<GridView::RefIndex>& sortedRef, size_t index) :
index_(index),
sortedRef_(sortedRef) {}
- void execute(HierarchyObject& hierObj)
- {
- std::for_each(hierObj.refSubFiles().begin(), hierObj.refSubFiles().end(), *this);
- std::for_each(hierObj.refSubLinks().begin(), hierObj.refSubLinks().end(), *this);
- std::for_each(hierObj.refSubDirs ().begin(), hierObj.refSubDirs ().end(), *this);
- }
-
- void operator()(FilePair& fileObj)
- {
- sortedRef_.push_back(RefIndex(index_, fileObj.getId()));
- }
-
- void operator()(SymlinkPair& linkObj)
- {
- sortedRef_.push_back(RefIndex(index_, linkObj.getId()));
- }
-
- void operator()(DirPair& dirObj)
+ void recurse(HierarchyObject& hierObj)
{
- sortedRef_.push_back(RefIndex(index_, dirObj.getId()));
- execute(dirObj); //add recursion here to list sub-objects directly below parent!
+ for (FilePair& fileObj : hierObj.refSubFiles())
+ sortedRef_.push_back(RefIndex(index_, fileObj.getId()));
+ for (SymlinkPair& linkObj : hierObj.refSubLinks())
+ sortedRef_.push_back(RefIndex(index_, linkObj.getId()));
+ for (DirPair& dirObj : hierObj.refSubDirs())
+ {
+ sortedRef_.push_back(RefIndex(index_, dirObj.getId()));
+ recurse(dirObj); //add recursion here to list sub-objects directly below parent!
+ }
}
-private:
size_t index_;
std::vector<GridView::RefIndex>& sortedRef_;
};
@@ -345,7 +337,7 @@ void GridView::setData(FolderComparison& folderCmp)
});
for (auto it = begin(folderCmp); it != end(folderCmp); ++it)
- SerializeHierarchy(sortedRef, it - begin(folderCmp)).execute(*it);
+ SerializeHierarchy::execute(*it, sortedRef, it - begin(folderCmp));
}
bgstack15