diff --git a/src/file/extractor/result.h b/src/file/extractor/result.h --- a/src/file/extractor/result.h +++ b/src/file/extractor/result.h @@ -31,20 +31,67 @@ namespace Baloo { +/** + * \class Result result.h + * + * \brief The result class is where all the data extracted by + * the KFileMetaData extractors is saved to a Baloo::Document. + * It implements the KFileMetaData::ExtractionResult interface. + * The resulting Baloo::Document can then be pushed into the + * database. + * + */ class Result : public KFileMetaData::ExtractionResult { public: Result(); Result(const QString& url, const QString& mimetype, const Flags& flags = ExtractEverything); + /** + * Overloaded function from KFileMetaData::ExtractionResult. + * Adds a key value pair which should be indexed. + * + * \param property This specifies a property name. It should be one of the + * properties from the list of properties from KFileMetaData. + * + * \param value The value of the property + */ void add(KFileMetaData::Property::Property property, const QVariant& value) override; + + /** + * Appends plain text to the document. This generally corresponds + * to the text content in a file. + * + * \param text The text that will be appended to the document + */ void append(const QString& text) override; + + /** + * A type is a higher level classification of the file, e.g. + * a document or an video file. + * + * \param type The type linked to this document + */ void addType(KFileMetaData::Type::Type type) override; + /** + * Sets the Baloo document to which the results from the extractors + * will be saved. + * + * \param doc The Baloo::Document + */ void setDocument(const Baloo::Document& doc); + /** + * Returns a QVariantMap containing all metadata fetched from the extractors. + * The metadata is saved as + */ QVariantMap map() const; + /** + * Returns the Baloo document to which the results from the extractors + * will are saved. + */ Baloo::Document& document(); /** @@ -54,10 +101,21 @@ void finish(); private: + /** + * The document that represents the file that is to be indexed. + */ Baloo::Document m_doc; + /** + * Contains the collection of words of the metadata + */ Baloo::TermGenerator m_termGen; + /** + * Contains the collection of words of plain text + */ Baloo::TermGenerator m_termGenForText; - + /** + * Contains all indexed data from the extractors + */ QVariantMap m_map; };