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 #include <memory>
17 
18 namespace KFileMetaData {
19 
20 class PropertyInfoPrivate;
21 /**
22  * \class PropertyInfo propertyinfo.h <KFileMetaData/PropertyInfo>
23  *
24  * The PropertyInfo class can be used to obtain extra information
25  * about any property. It is commonly used be indexers in order
26  * to obtain a translatable name of the property along with
27  * additional information such as if the property should be indexed.
28  */
29 class KFILEMETADATA_EXPORT PropertyInfo
30 {
31 public:
32  PropertyInfo();
34  PropertyInfo(const PropertyInfo& pi);
35  ~PropertyInfo();
36 
37  PropertyInfo& operator=(const PropertyInfo& rhs);
38  bool operator==(const PropertyInfo& rhs) const;
39 
40  /**
41  * The enumeration which represents this property
42  */
43  Property::Property property() const;
44 
45  /**
46  * The internal unique name used to refer to the property
47  */
48  QString name() const;
49 
50  /**
51  * A user visible name of the property
52  */
53  QString displayName() const;
54 
55  /**
56  * The type the value of this property should be.
57  * Eg - Property::Height should be an integer
58  */
59  QVariant::Type valueType() const;
60 
61  /**
62  * Indicates if this property requires indexing or should just be stored.
63  * Eg - Property::Height does not need to be part of the global index.
64  * When a user searches for 600, they should not get images with
65  * that height
66  *
67  * This is just a recommendation.
68  */
69  bool shouldBeIndexed() const;
70 
71  /**
72  * Construct a PropertyInfo from the internal property name.
73  * The internal property name is case insensitive
74  */
75  static PropertyInfo fromName(const QString& name);
76 
77  /**
78  * Returns the value of the property as a QString with added formatting,
79  * added units if needed, and translated enums.
80  * @since 5.56
81  */
82  QString formatAsDisplayString(const QVariant& value) const;
83 
84 private:
85  const std::unique_ptr<PropertyInfoPrivate> d;
86 };
87 
88 } // namespace
89 Q_DECLARE_METATYPE(KFileMetaData::PropertyInfo)
90 
91 
92 #endif // _KFILEMETADATA_PROPERTYINFO_H
Property
The Property enum contains all files property types that KFileMetaData manipulates.
Definition: properties.h:25
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Jun 27 2022 04:26:52 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.