Warning, file /sdk/cervisia/updateview_visitors.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  * Copyright (c) 2003-2008 André Wöbbeking <Woebbeking@kde.org>
0003  *
0004  * This program is free software; you can redistribute it and/or modify
0005  * it under the terms of the GNU General Public License as published by
0006  * the Free Software Foundation; either version 2 of the License, or
0007  * (at your option) any later version.
0008  *
0009  * This program is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  * GNU General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU General Public License
0015  * along with this program; if not, write to the Free Software
0016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0017  */
0018 
0019 #ifndef UPDATEVIEW_VISITORS_H
0020 #define UPDATEVIEW_VISITORS_H
0021 
0022 #include "updateview.h"
0023 
0024 #include <set>
0025 
0026 class UpdateItem;
0027 class UpdateDirItem;
0028 class UpdateFileItem;
0029 
0030 class Visitor
0031 {
0032 public:
0033     virtual ~Visitor() = default;
0034 
0035     virtual void preVisit(UpdateDirItem *) = 0;
0036     virtual void postVisit(UpdateDirItem *) = 0;
0037 
0038     virtual void visit(UpdateFileItem *) = 0;
0039 };
0040 
0041 class ApplyFilterVisitor : public Visitor
0042 {
0043 public:
0044     explicit ApplyFilterVisitor(UpdateView::Filter filter);
0045 
0046     void preVisit(UpdateDirItem *) override;
0047     void postVisit(UpdateDirItem *) override;
0048 
0049     void visit(UpdateFileItem *) override;
0050 
0051 private:
0052     void markAllParentsAsVisible(UpdateItem *);
0053 
0054     UpdateView::Filter m_filter;
0055 
0056     using TItemSet = std::set<UpdateItem *>;
0057     TItemSet m_invisibleDirItems;
0058 };
0059 
0060 #endif // UPDATEVIEW_VISITORS_H