QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsnumericformatregistry.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsnumericformatregistry.h
3  --------------------------
4  begin : January 2020
5  copyright : (C) 2020 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSNUMERICFORMATREGISTRY_H
16 #define QGSNUMERICFORMATREGISTRY_H
17 
18 #include <QHash>
19 #include <QString>
20 #include <QObject>
21 
22 #include "qgis_sip.h"
23 #include "qgis_core.h"
24 
25 class QgsNumericFormat;
26 class QDomElement;
28 
38 class CORE_EXPORT QgsNumericFormatRegistry
39 {
40 
41  public:
42 
48  explicit QgsNumericFormatRegistry();
50 
54  QStringList formats() const;
55 
61  void addFormat( QgsNumericFormat *format SIP_TRANSFER );
62 
66  void removeFormat( const QString &id );
67 
74  QgsNumericFormat *format( const QString &id ) const SIP_TRANSFERBACK;
75 
82  QgsNumericFormat *create( const QString &id, const QVariantMap &configuration, const QgsReadWriteContext &context ) const SIP_TRANSFERBACK;
83 
90  QgsNumericFormat *createFromXml( const QDomElement &element, const QgsReadWriteContext &context ) const SIP_TRANSFERBACK;
91 
98  QgsNumericFormat *fallbackFormat() const SIP_FACTORY;
99 
103  QString visibleName( const QString &id ) const;
104 
108  int sortKey( const QString &id ) const;
109 
110  private:
111  QHash<QString, QgsNumericFormat *> mFormats;
112 };
113 
114 #endif // QGSNUMERICFORMATREGISTRY_H
The QgsNumericFormatRegistry manages registered classes of QgsNumericFormat.
A numeric formatter allows for formatting a numeric value for display, using a variety of different f...
The class is used as a container of context for various read/write operations on other objects.
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_TRANSFERBACK
Definition: qgis_sip.h:48
#define SIP_FACTORY
Definition: qgis_sip.h:76