/usr/include/libusermetrics-1/libusermetricsinput/usermetricsinput.h is in libusermetricsinput1-dev 1.1.1+15.10.20150915-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | /*
* 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>
*/
/*
* This file defines the C API of libusermetricsinput. If you can, it is strongly
* recommended to use the C++ API, MetricManager.h instead.
*/
#ifndef USERMETRICSINPUT_H_
#define USERMETRICSINPUT_H_
#ifdef USERMETRICSINPUT_METRICUPDATE_H_
#error "Mixing C and C++ public header includes. You can only use one or the other."
#endif
#include <libusermetricsinput/UserMetricsInputExport.h>
#ifdef __cplusplus
/**
* @{
*/
extern "C" {
#endif
enum USERMETRICSINPUT_METRICTYPE {
METRIC_TYPE_USER, METRIC_TYPE_SYSTEM
};
/**
* @brief A central place for registering user metrics.
*/
typedef void* UserMetricsInputMetricManager;
/**
* @brief Parameters for constructing a metric.
*/
typedef void* UserMetricsInputMetricParameters;
/**
* @brief A single user metric, e.g. "number of e-mails today" or "photos taken today".
*/
typedef void* UserMetricsInputMetric;
/**
* @brief A update to a user metric for a particular user.
*/
typedef void* UserMetricsInputMetricUpdate;
/**
* @brief Construct a new UserMetricsInputMetricManager
*
* Must be freed with #usermetricsinput_metricmanager_delete
*/
USERMETRICSINPUT_EXPORT
UserMetricsInputMetricManager usermetricsinput_metricmanager_new();
/**
* @brief Free a UserMetricsInputMetricManager
*
* @param metricManager The UserMetricsInputMetricManager to free
*/USERMETRICSINPUT_EXPORT
void usermetricsinput_metricmanager_delete(
UserMetricsInputMetricManager metricManager);
/**
* @brief Construct a new UserMetricsInputMetricParameters
*
* @param dataSourceId The unique ID of the data source, e.g. "facebook"
*
* Must be freed with #usermetricsinput_metricparameters_delete
*/
USERMETRICSINPUT_EXPORT
UserMetricsInputMetricParameters usermetricsinput_metricparameters_new(
const char *dataSourceId);
/**
* @brief Set the string to print in the output API, e.g. "<b>%1</b> messages received today"
*
* @param metricParameter
* @param formatString
*/
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricparameters_set_format_string(
UserMetricsInputMetricParameters metricParameter,
const char *formatString);
/**
* @brief set the string to print in the case of no data, e.g. "No messages received today"
*
* @param metricParameter
* @param emptyDataString
*/
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricparameters_set_empty_data_string(
UserMetricsInputMetricParameters metricParameter,
const char *emptyDataString);
/**
* @brief Set the translation domain
*
* @param metricParameter
* @param textDomain
*/
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricparameters_set_text_domain(
UserMetricsInputMetricParameters metricParameter,
const char *textDomain);
/**
* @brief Set the minimum display value for this metric
*
* @param metricParameter
* @param minimum
*/
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricparameters_set_minimum(
UserMetricsInputMetricParameters metricParameter, double minimum);
/**
* @brief Set the maximum display value for this metric
*
* @param metricParameter
* @param maximum
*/
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricparameters_set_maximum(
UserMetricsInputMetricParameters metricParameter, double maximum);
/**
* @brief Set the type of metric this is (user owned or system owned)
*
* @param metricParameter
* @param metricType
*/
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricparameters_set_type(
UserMetricsInputMetricParameters metricParameter,
USERMETRICSINPUT_METRICTYPE metricType);
/**
* @brief Free a UserMetricsInputMetricParameters
*
* @param metricParameters The UserMetricsInputMetricManager to free
*/
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricparameters_delete(
UserMetricsInputMetricParameters metricParameters);
/**
* @brief Register a new UserMetricsInputMetric
*
* @param metricManager
* @param metricParameters The parameters of the metric to create
*
* Do not attempt to delete this object.
*/
USERMETRICSINPUT_EXPORT
UserMetricsInputMetric usermetricsinput_metricmanager_add(
UserMetricsInputMetricManager metricManager,
UserMetricsInputMetricParameters metricParameters);
/**
* @brief Increment the "today" value for a simple user metric
*
* @param metric
* @param amount How much to increase the metric by - usually 1.
* @param username The user to update the data for. If blank ("") then the current user is used.
*/
USERMETRICSINPUT_EXPORT
void usermetricsinput_metric_increment(UserMetricsInputMetric metric,
double amount, const char *username);
/**
* @brief Update the "today" value for a simple user metric
*
* @param metric
* @param value Today's value
* @param username The user to update the data for. If blank ("") then the current user is used.
*/
USERMETRICSINPUT_EXPORT
void usermetricsinput_metric_update_today(UserMetricsInputMetric metric,
double value, const char *username);
/**
* @brief Create an update to a particular metric
*
* @param metric
* @param username The user to update the data for. If blank ("") then the current user is used.
*
* Must be freed with #usermetricsinput_metricupdate_delete - this is when the
* actual update will be sent to the storage service.
*/
USERMETRICSINPUT_EXPORT
UserMetricsInputMetricUpdate usermetricsinput_metric_update(
UserMetricsInputMetric metric, const char *username);
/**
* @brief Free a UserMetricsInputMetric
*
* @param metricUpdate The UserMetricsInputMetric to free and dispatch
*
* This will cause the update to be dispatched.
*/
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricupdate_delete(
UserMetricsInputMetricUpdate metricUpdate);
/**
* @brief Add data to a UserMetricsInputMetricUpdate.
*
* @param metricUpdate The UserMetricsInputMetricUpdate to add data to
* @param data The double-valued data to add
*
* Each call to this method appends a new day's data to the update.
* So the first call adds data for today, the second call adds data for
* yesterday, and so on.
*/
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricupdate_add_data(
UserMetricsInputMetricUpdate metricUpdate, double data);
/**
* @brief Add unknown data to an update.
*
* @param metricUpdate The UserMetricsInputMetricUpdate to add data to
*
* If data is not known for a particular day, then null can be added.
*/
USERMETRICSINPUT_EXPORT
void usermetricsinput_metricupdate_add_null(
UserMetricsInputMetricUpdate metricUpdate);
/**
* @example MetricManagerIncrementTodayCAPI.c
* 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 do not already have a way of
* knowing the current value.
**/
/**
* @example MetricManagerUpdateTodayCAPI.c
* A simple example of a metric that doesn't worry about updating
* history, and just updates a single value in response to an
* action. This is for apps that cannot simply just increment
* the current value.
**/
/**
* @example MetricManagerAdvancedCAPI.c
* A more advanced metric that updates the history of a metric.
* Usually this would be a metric from an external data source,
* e.g. e-mail or Facebook messages.
**/
#ifdef __cplusplus
}
/**
* @}
**/
#endif
#endif
|