Changeset View
Standalone View
src/resultset.h
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 63 | public: | |||
---|---|---|---|---|---|
69 | Result &operator=(Result result); | 69 | Result &operator=(Result result); | ||
70 | 70 | | |||
71 | enum LinkStatus { | 71 | enum LinkStatus { | ||
72 | NotLinked = 0, | 72 | NotLinked = 0, | ||
73 | Unknown = 1, | 73 | Unknown = 1, | ||
74 | Linked = 2 | 74 | Linked = 2 | ||
75 | }; | 75 | }; | ||
76 | 76 | | |||
77 | QString resource() const; ///< URL of the resource | 77 | QString resource() const; ///< String representation of resource (can represent an url or a path) | ||
78 | QUrl url() const; ///< Url representation of a resource based on internal resource, cannot be set | ||||
ivan: `url` or `resourceUrl`?
I hoped we are not going to have these problems after the death of… | |||||
url makes more sense to me, no need to decorate it, this is idiomatic KDE/Qt. toUrl might make sense alternatively since it is not a free operation as it is a copy. I am not too aware of the history around Nepomuk. File paths for files and urls for everything else is fine internally but the API was not very clear about how to use it. IMO we would need a type dedicated for file path, that would be a wrapper around QString, something like C++17 https://en.cppreference.com/w/cpp/filesystem/path or Rust https://doc.rust-lang.org/std/path/struct.Path.html While we are at it I could add a isPath() or similar to tell if resource contains a url or a path QDir::isAbsolutePath(resource()) basically. About KF6 I would suggest resource would return something like std::variant<std::filesystem::path, QString> https://en.cppreference.com/w/cpp/utility/variant meven: `url` makes more sense to me, no need to decorate it, this is idiomatic KDE/Qt. `toUrl` might… | |||||
Ok, agreed. The reason why I thought the resourceUrl is a better choice is that it is an url of the resource, not of the result. But I agree url is cleaner. We'll see about the KF6 part. variants/optionals vs a proxy type that converts to QString and QUrl in a correct way :) ivan: Ok, agreed. The reason why I thought the `resourceUrl` is a better choice is that it is an url… | |||||
78 | QString title() const; ///< Title of the resource, or URL if title is not known | 79 | QString title() const; ///< Title of the resource, or URL if title is not known | ||
79 | QString mimetype() const; ///< Mimetype of the resource, or URL if title is not known | 80 | QString mimetype() const; ///< Mimetype of the resource, or URL if title is not known | ||
80 | double score() const; ///< The score calculated based on the usage statistics | 81 | double score() const; ///< The score calculated based on the usage statistics | ||
81 | uint lastUpdate() const; ///< Timestamp of the last update | 82 | uint lastUpdate() const; ///< Timestamp of the last update | ||
82 | uint firstUpdate() const; ///< Timestamp of the first update | 83 | uint firstUpdate() const; ///< Timestamp of the first update | ||
83 | LinkStatus linkStatus() const; ///< Differentiates between linked and non-linked resources in mixed queries | 84 | LinkStatus linkStatus() const; ///< Differentiates between linked and non-linked resources in mixed queries | ||
84 | QStringList linkedActivities() const; ///< Contains the activities this resource is linked to for the queries that care about resource linking | 85 | QStringList linkedActivities() const; ///< Contains the activities this resource is linked to for the queries that care about resource linking | ||
85 | 86 | | |||
▲ Show 20 Lines • Show All 172 Lines • Show Last 20 Lines |
url or resourceUrl?
I hoped we are not going to have these problems after the death of Nepomuk. Thought file paths for files and urls for everything else would be a sane default. :)
Also, can you add a TODO: KF6 rething the function names for these two.