libusermetrics: UserMetricsInput::Metric Class Reference

libusermetrics

Public Member Functions | List of all members
UserMetricsInput::Metric Class Referenceabstract

This class represents a single user metric. More...

`#include <libusermetricsinput/Metric.h>`

Inheritance diagram for UserMetricsInput::Metric:
[legend]
Collaboration diagram for UserMetricsInput::Metric:
[legend]

## Public Member Functions
| Metric (QObject *parent=0)
| This constructor cannot be used - the class is pure-virtual. More...
virtual | ~Metric ()
| Destructor. More...
virtual MetricUpdate * | update (const QString &username="")=0
| Create an MetricUpdate to a particular Metric. More...
virtual void | update (double value, const QString &username="")=0
| Update the "today" value for a simple user metric. More...
virtual void | increment (double amount=1.0f, const QString &username="")=0
| Increment the "today" value for a simple user metric. More...

## Detailed Description

This class represents a single user metric.

For example, "number of e-mails today" or "photos taken today".

This is a long-lived class that can exist for the whole application lifecycle.

## Constructor & Destructor Documentation

## ◆ Metric()

UserMetricsInput::Metric::Metric | ( | QObject * | parent = `0` | ) |
| explicit

This constructor cannot be used - the class is pure-virtual.

## ◆ ~Metric()

virtual UserMetricsInput::Metric::~Metric | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ increment()

virtual void UserMetricsInput::Metric::increment | ( | double | amount = `1.0f`,
|  | const QString & | username = `""`
| ) |  |
| pure virtual

Increment the "today" value for a simple user metric.

Parameters

  amount | How much to increase the metric by - defaults to 1.
  username | The user to update the data for. If blank ("") or omitted then the current user is used.

## ◆ update() [1/2]

virtual MetricUpdate* UserMetricsInput::Metric::update | ( | const QString & | username = `""` | ) |
| pure virtual

Create an MetricUpdate to a particular Metric.

Parameters

  username | The user to update the data for. If blank ("") or omitted then the current user is used.

The MetricUpdate object must be deleted - this is when the actual update will be sent to the storage service.

## ◆ update() [2/2]

virtual void UserMetricsInput::Metric::update | ( | double | value,
|  | const QString & | username = `""`
| ) |  |
| pure virtual

Update the "today" value for a simple user metric.

Parameters

  value | Today's value
  username | The user to update the data for. If blank ("") or omitted then the current user is used.

The documentation for this class was generated from the following file:

- libusermetricsinput/Metric.h