~thomas-voss/trust-store/add-click-based-package-name-query

« back to all changes in this revision

Viewing changes to src/core/trust/click/database.h

  • Committer: thomas-voss
  • Date: 2014-08-21 08:07:29 UTC
  • Revision ID: thomas.voss@canonical.com-20140821080729-sihlhaifeibhicqt
Add an interface to installed click packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2014 Canonical Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU Lesser General Public License version 3,
 
6
 * as published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Thomas Voß <thomas.voss@canonical.com>
 
17
 */
 
18
 
 
19
#ifndef CLICK_DATABASE_H_
 
20
#define CLICK_DATABASE_H_
 
21
 
 
22
#include <core/trust/click/package.h>
 
23
 
 
24
#include <functional>
 
25
#include <memory>
 
26
 
 
27
namespace click
 
28
{
 
29
struct FrameworkRegistry;
 
30
 
 
31
/** @brief Abstracts an enumerateable and queryable collection of click::Package's */
 
32
struct Database
 
33
{
 
34
    /** @brief To save some typing. */
 
35
    typedef std::shared_ptr<Database> Ptr;
 
36
 
 
37
    /** @brief Functor called for every package in a database. */
 
38
    typedef std::function<void(const Package::Ptr&)> PackageEnumerator;
 
39
 
 
40
    /** @cond */
 
41
    Database() = default;
 
42
    virtual ~Database() = default;
 
43
    /** @endcond */
 
44
 
 
45
    /** @brief Enumerates all packages known to a database instance. */
 
46
    virtual void enumerate_packages(const PackageEnumerator& enumerator) const = 0;
 
47
 
 
48
    /** @brief Tries to lookup a package in the database. */
 
49
    virtual Package::Ptr find_package_for_name(const std::string& package_name) const = 0;
 
50
};
 
51
}
 
52
 
 
53
#endif // CLICK_DATABASE_H_