KFileMetaData

propertyinfo.h
1 /*
2  This file is part of the KFileMetaData project
3  SPDX-FileCopyrightText: 2014 Vishesh Handa <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6 */
7 
8 #ifndef _KFILEMETADATA_PROPERTYINFO_H
9 #define _KFILEMETADATA_PROPERTYINFO_H
10 
11 #include <QString>
12 #include <QVariant>
13 #include "properties.h"
14 #include "kfilemetadata_export.h"
15 
16 namespace KFileMetaData {
17 
18 /**
19  * \class PropertyInfo propertyinfo.h <KFileMetaData/PropertyInfo>
20  *
21  * The PropertyInfo class can be used to obtain extra information
22  * about any property. It is commonly used be indexers in order
23  * to obtain a translatable name of the property along with
24  * additional information such as if the property should be indexed.
25  */
26 class KFILEMETADATA_EXPORT PropertyInfo
27 {
28 public:
29  PropertyInfo();
31  PropertyInfo(const PropertyInfo& pi);
32  ~PropertyInfo();
33 
34  PropertyInfo& operator=(const PropertyInfo& rhs);
35  bool operator==(const PropertyInfo& rhs) const;
36 
37  /**
38  * The enumeration which represents this property
39  */
40  Property::Property property() const;
41 
42  /**
43  * The internal unique name used to refer to the property
44  */
45  QString name() const;
46 
47  /**
48  * A user visible name of the property
49  */
50  QString displayName() const;
51 
52  /**
53  * The type the value of this property should be.
54  * Eg - Property::Height should be an integer
55  */
56  QVariant::Type valueType() const;
57 
58  /**
59  * Indicates if this property requires indexing or should just be stored.
60  * Eg - Property::Height does not need to be part of the global index.
61  * When a user searches for 600, they should not get images with
62  * that height
63  *
64  * This is just a recommendation.
65  */
66  bool shouldBeIndexed() const;
67 
68  /**
69  * Construct a PropertyInfo from the internal property name.
70  * The internal property name is case insensitive
71  */
72  static PropertyInfo fromName(const QString& name);
73 
74  /**
75  * Returns the value of the property as a QString with added formatting,
76  * added units if needed, and translated enums.
77  * @since 5.56
78  */
79  QString formatAsDisplayString(const QVariant& value) const;
80 
81 private:
82  class Private;
83  Private* d;
84 };
85 
86 } // namespace
87 Q_DECLARE_METATYPE(KFileMetaData::PropertyInfo)
88 
89 
90 #endif // _KFILEMETADATA_PROPERTYINFO_H
The PropertyInfo class can be used to obtain extra information about any property.
Definition: propertyinfo.h:26
const QLatin1String name
Property
The Property enum contains all files property types that KFileMetaData manipulates.
Definition: properties.h:25
<KFileMetaData/Properties>
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jan 20 2022 22:49:18 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.