~ubuntu-branches/ubuntu/trusty/libusermetrics/trusty-proposed

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
53
54
55
56
57
58
59
60
61
62
63
/*
 * Copyright (C) 2013 Canonical, Ltd.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of version 3 of the GNU Lesser General Public License as published
 * by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Author: Pete Woods <pete.woods@canonical.com>
 */

#ifndef USERMETRICSOUTPUT_DATASETSTORE_H_
#define USERMETRICSOUTPUT_DATASETSTORE_H_

#include <libusermetricsoutput/DataSource.h>
#include <libusermetricsoutput/UserData.h>

#include <QtCore/QSharedPointer>
#include <QtCore/QMap>

namespace UserMetricsOutput {

class UserMetricsStore: public QObject {
Q_OBJECT
public:
	typedef QMap<QString, UserDataPtr> UserDataMap;

	typedef UserDataMap::iterator iterator;

	typedef UserDataMap::const_iterator const_iterator;

	typedef QMap<QString, DataSourcePtr> DataSourceMap;

	explicit UserMetricsStore(QObject *parent = 0);

	virtual ~UserMetricsStore();

	virtual const_iterator constFind(const QString &username) const;

	virtual const_iterator constEnd() const;

	virtual iterator insert(const QString &username, UserDataPtr userData);

	virtual void insert(const QString &name, DataSourcePtr dataSource);

	virtual DataSourcePtr dataSource(const QString &name);

protected:
	UserDataMap m_userData;

	DataSourceMap m_dataSources;
};

}

#endif // USERMETRICSOUTPUT_DATASETSTORE_H_