Commit faf0f17fa4e1691eaa67729013bd5f343b4be5ba
1 parent
56ab2cb5
cleaned up br::File API
Showing
1 changed file
with
5 additions
and
4 deletions
openbr/openbr_plugin.h
| ... | ... | @@ -174,14 +174,15 @@ struct BR_EXPORT File |
| 174 | 174 | File(const QString &file) { init(file); } /*!< \brief Construct a file from a string. */ |
| 175 | 175 | File(const QString &file, const QVariant &label) { init(file); set("Label", label); } /*!< \brief Construct a file from a string and assign a label. */ |
| 176 | 176 | File(const char *file) { init(file); } /*!< \brief Construct a file from a c-style string. */ |
| 177 | + File(const QVariantMap &metadata) : m_metadata(metadata) {} /*!< \brief Construct a file from metadata. */ | |
| 177 | 178 | inline operator QString() const { return name; } /*!< \brief Returns #name. */ |
| 178 | 179 | QString flat() const; /*!< \brief A stringified version of the file with metadata. */ |
| 179 | 180 | QString hash() const; /*!< \brief A hash of the file. */ |
| 180 | 181 | |
| 181 | - inline QList<QString> localKeys() const { return m_metadata.keys(); } /*!< \brief Returns the private metadata keys. */ | |
| 182 | - inline QMap<QString,QVariant> localMetadata() const { return m_metadata; } /*!< \brief Returns the private metadata. */ | |
| 182 | + inline QStringList localKeys() const { return m_metadata.keys(); } /*!< \brief Returns the private metadata keys. */ | |
| 183 | + inline QVariantMap localMetadata() const { return m_metadata; } /*!< \brief Returns the private metadata. */ | |
| 183 | 184 | |
| 184 | - void append(const QMap<QString,QVariant> &localMetadata); /*!< \brief Add new metadata fields. */ | |
| 185 | + void append(const QVariantMap &localMetadata); /*!< \brief Add new metadata fields. */ | |
| 185 | 186 | void append(const File &other); /*!< \brief Append another file using \c separator. */ |
| 186 | 187 | inline File &operator+=(const QMap<QString,QVariant> &other) { append(other); return *this; } /*!< \brief Add new metadata fields. */ |
| 187 | 188 | inline File &operator+=(const File &other) { append(other); return *this; } /*!< \brief Append another file using \c separator. */ |
| ... | ... | @@ -326,7 +327,7 @@ struct BR_EXPORT File |
| 326 | 327 | inline void setRects(const QList<cv::Rect> &rects) { clearRects(); appendRects(rects); } /*!< \brief Overwrites the file's rect list. */ |
| 327 | 328 | |
| 328 | 329 | private: |
| 329 | - QMap<QString,QVariant> m_metadata; | |
| 330 | + QVariantMap m_metadata; | |
| 330 | 331 | BR_EXPORT friend QDataStream &operator<<(QDataStream &stream, const File &file); |
| 331 | 332 | BR_EXPORT friend QDataStream &operator>>(QDataStream &stream, File &file); |
| 332 | 333 | ... | ... |