libusermetrics
MetricManager.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Canonical, Ltd.
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of version 3 of the GNU Lesser General Public License as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * 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  * Author: Pete Woods <pete.woods@canonical.com>
17  */
18 
19 #ifndef USERMETRICSINPUT_METRICMANAGER_H_
20 #define USERMETRICSINPUT_METRICMANAGER_H_
21 
23 
31 namespace UserMetricsInput {
32 
33 class MetricManager;
34 class MetricParametersPrivate;
35 
39 typedef QScopedPointer<MetricManager> MetricManagerPtr;
40 
41 class Q_DECL_EXPORT MetricParameters {
42 public:
43 
44  explicit MetricParameters(const QString &dataSourceId);
45 
46  MetricParameters & formatString(const QString &formatString);
47 
48  MetricParameters & emptyDataString(const QString &emptyDataString);
49 
50  MetricParameters & textDomain(const QString &textDomain);
51 
52  MetricParameters & minimum(double minimum);
53 
54  MetricParameters & maximum(double maximum);
55 
56  MetricParameters & type(MetricType type);
57 
58  virtual ~MetricParameters();
59 
60  QScopedPointer<MetricParametersPrivate> p;
61 };
62 
69 class Q_DECL_EXPORT MetricManager: public QObject {
70 public:
74  explicit MetricManager(QObject *parent = 0);
75 
79  virtual ~MetricManager();
80 
86  static MetricManager * getInstance();
87 
100  virtual MetricPtr add(const QString &dataSourceId,
101  const QString &formatString, const QString &emptyDataString = "",
102  const QString &textDomain = "") = 0;
103 
113  virtual MetricPtr add(const MetricParameters &parameters) = 0;
114 };
115 
138 }
139 
144 #endif // USERMETRICSINPUT_METRICMANAGER_H_
QScopedPointer< MetricManager > MetricManagerPtr
Shared pointer for the MetricManager.
Definition: MetricManager.h:34
Central place for registering and updating user metrics.
Definition: MetricManager.h:69
Definition: MetricManager.h:41
QSharedPointer< Metric > MetricPtr
Definition: Metric.h:31
QScopedPointer< MetricParametersPrivate > p
Definition: MetricManager.h:60
MetricType
Definition: Metric.h:38