16 #ifndef QGSSTRINGSTATISTICALSUMMARY_H
17 #define QGSSTRINGSTATISTICALSUMMARY_H
20 #include <QVariantList>
22 #include "qgis_core.h"
61 All = Count | CountDistinct | CountMissing | Min | Max | MinimumLength | MaximumLength | MeanLength | Minority | Majority,
63 Q_DECLARE_FLAGS( Statistics, Statistic )
84 void setStatistics( QgsStringStatisticalSummary::Statistics stats ) { mStatistics = stats; }
97 void calculate(
const QStringList &values );
106 void calculateFromVariants(
const QVariantList &values );
122 void addString(
const QString &
string );
137 void addValue(
const QVariant &value );
156 int count()
const {
return mCount; }
168 QSet< QString >
distinctValues()
const {
return qgis::listToSet( mValues.keys() ); }
178 QString
min()
const {
return mMin; }
183 QString
max()
const {
return mMax; }
229 Statistics mStatistics;
232 QMap< QString, int > mValues;
243 void testString(
const QString &
string );
Calculator for summary statistics and aggregates for a list of strings.
Statistics statistics() const
Returns flags which specify which statistics will be calculated.
QString max() const
Returns the maximum (non-null) string value.
QString min() const
Returns the minimum (non-null) string value.
int countMissing() const
Returns the number of missing (null) string values.
int count() const
Returns the calculated count of values.
int countDistinct() const
Returns the number of distinct string values.
QSet< QString > distinctValues() const
Returns the set of distinct string values.
int minLength() const
Returns the minimum length of strings.
int maxLength() const
Returns the maximum length of strings.
Statistic
Enumeration of flags that specify statistics to be calculated.
QString majority() const
Returns the most common string.
QString minority() const
Returns the least common string.
double meanLength() const
Returns the mean length of strings.
void setStatistics(QgsStringStatisticalSummary::Statistics stats)
Sets flags which specify which statistics will be calculated.
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.