1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* ============================================================
 *
 * This file is a part of digiKam project
 * https://www.digikam.org
 *
 * Date        : 2007-03-22
 * Description : database SQL queries helper class
 *
 * SPDX-FileCopyrightText: 2007-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
 * SPDX-FileCopyrightText: 2012-2025 by Gilles Caulier <caulier dot gilles at gmail dot com>
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 *
 * ============================================================ */

#include "itemqueryposthooks.h"

// Local includes

#include "digikam_debug.h"

namespace Digikam
{

ItemQueryPostHooks::~ItemQueryPostHooks()
{
    for (const ItemQueryPostHook* const hook : std::as_const(m_postHooks))
    {
        delete hook;
    }
}

// cppcheck-suppress constParameterPointer
void ItemQueryPostHooks::addHook(ItemQueryPostHook* const hook)
{
    m_postHooks << hook;
}

bool ItemQueryPostHooks::checkPosition(double latitudeNumber, double longitudeNumber)
{
    for (ItemQueryPostHook* const hook : std::as_const(m_postHooks))<--- Consider using std::all_of or std::none_of algorithm instead of a raw loop.
    {
        if (!hook->checkPosition(latitudeNumber, longitudeNumber))
        {   // cppcheck-suppress useStlAlgorithm
            return false;
        }
    }

    return true;
}

} // namespace Digikam