Metric.h
Go to the documentation of this file.
/*
* 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 USERMETRICSINPUT_METRIC_H_
#define USERMETRICSINPUT_METRIC_H_
#include <libusermetricsinput/MetricUpdate.h>
#include <QtCore/QSharedPointer>
namespace UserMetricsInput {
class Metric;
typedef QSharedPointer<Metric> MetricPtr;
enum MetricType {
USER, SYSTEM,
};
class Q_DECL_EXPORT Metric: public QObject {
public:
explicit Metric(QObject *parent = 0);
virtual ~Metric();
virtual MetricUpdate * update(const QString &username = "") = 0;
virtual void update(double value, const QString &username = "") = 0;
virtual void increment(double amount = 1.0f,
const QString &username = "") = 0;
};
}
#endif // USERMETRICSINPUT_METRIC_H_
MetricUpdate.h
UserMetricsInput::MetricUpdate
An update to a Metric.
Definition MetricUpdate.h:44
UserMetricsInput::Metric
This class represents a single user metric.
Definition Metric.h:50
UserMetricsInput::Metric::increment
virtual void increment(double amount=1.0f, const QString &username="")=0
Increment the "today" value for a simple user metric.
UserMetricsInput::Metric::Metric
Metric(QObject *parent=0)
This constructor cannot be used - the class is pure-virtual.
UserMetricsInput::Metric::~Metric
virtual ~Metric()
Destructor.
UserMetricsInput::Metric::update
virtual void update(double value, const QString &username="")=0
Update the "today" value for a simple user metric.
UserMetricsInput::Metric::update
virtual MetricUpdate * update(const QString &username="")=0
Create an MetricUpdate to a particular Metric.
UserMetricsInput
The user metrics input library namespace.
Definition Metric.h:29
UserMetricsInput::MetricType
MetricType
Definition Metric.h:38
UserMetricsInput::SYSTEM
@ SYSTEM
Definition Metric.h:39
UserMetricsInput::USER
@ USER
Definition Metric.h:39
UserMetricsInput::MetricPtr
QSharedPointer< Metric > MetricPtr
Definition Metric.h:36