File indexing completed on 2024-05-12 15:58:13

0001 /*
0002  *  SPDX-FileCopyrightText: 2007 Boudewijn Rempt <boud@valdyas.org>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #include "kis_count_visitor.h"
0008 #include "kis_image.h"
0009 
0010 bool KisCountVisitor::inList(KisNode* node)
0011 {
0012     Q_FOREACH (const QString& nodeType, m_nodeTypes) {
0013         if (node->inherits(nodeType.toLatin1()))
0014             return true;
0015     }
0016     return false;
0017 }
0018 
0019 bool KisCountVisitor::check(KisNode * node)
0020 {
0021     if (m_nodeTypes.isEmpty() || inList(node)) {
0022 
0023         if (m_properties.isEmpty() || node->check(m_properties)) {
0024             m_count++;
0025         }
0026     }
0027     visitAll(node);
0028 
0029     return true;
0030 }