MetricManagerIncrementToday.cpp

A simple example of a metric that doesn't worry about updating history, and just increments a single value in response to an action. This is for apps that can simply increment by a fixed amount.

    #include<libusermetricsinput/MetricManager.h>
    #include<QtCore/QCoreApplication>

    usingnamespaceUserMetricsInput;

    intmain(intargc,char*argv[]){
    QCoreApplicationapplication(argc,argv);

    //Westartwithamanagerobject
    MetricManagerPtrmanager(MetricManager::getInstance());

    //Youcanholdontothissharedpointerforaslongasyouwant
    MetricPtrmetric(
    manager->add(
    MetricParameters("photo-app-photos").formatString(
    "<b>%1</b>photostakentoday").emptyDataString(
    "Nophotostakentoday").textDomain(APP_ID)));

    //Thedefaultparametersforincrementcauseittobeincrementedby1.0,
    //forthecurrentuser.
    metric->increment();

    return0;
    }