"Fossies" - the Fresh Open Source Software Archive

Member "recoll-1.26.3/internfile/mh_html.h" (4 Sep 2019, 1889 Bytes) of package /linux/privat/recoll-1.26.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "mh_html.h" see the Fossies "Dox" file reference documentation.

    1 /* Copyright (C) 2004 J.F.Dockes
    2  *   This program is free software; you can redistribute it and/or modify
    3  *   it under the terms of the GNU General Public License as published by
    4  *   the Free Software Foundation; either version 2 of the License, or
    5  *   (at your option) any later version.
    6  *
    7  *   This program is distributed in the hope that it will be useful,
    8  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    9  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   10  *   GNU General Public License for more details.
   11  *
   12  *   You should have received a copy of the GNU General Public License
   13  *   along with this program; if not, write to the
   14  *   Free Software Foundation, Inc.,
   15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   16  */
   17 #ifndef _HTML_H_INCLUDED_
   18 #define _HTML_H_INCLUDED_
   19 
   20 #include <string>
   21 
   22 #include "mimehandler.h"
   23 
   24 /**
   25  * Convert html to utf-8 text and extract whatever metadata we can find.
   26  */
   27 class MimeHandlerHtml : public RecollFilter {
   28  public:
   29     MimeHandlerHtml(RclConfig *cnf, const std::string& id) 
   30     : RecollFilter(cnf, id) {
   31     }
   32     virtual ~MimeHandlerHtml() {}
   33 
   34     virtual bool is_data_input_ok(DataInput input) const override {
   35     if (input == DOCUMENT_FILE_NAME || input == DOCUMENT_STRING)
   36         return true;
   37     return false;
   38     }
   39     virtual bool next_document() override;
   40     const std::string& get_html() {
   41     return m_html;
   42     }
   43     virtual void clear_impl() override {
   44     m_filename.erase();
   45     m_html.erase();
   46     }
   47 protected:
   48     virtual bool set_document_file_impl(const std::string& mt,
   49                                         const std::string &file_path) override;
   50     virtual bool set_document_string_impl(const std::string& mt,
   51                                           const std::string &data) override;
   52 
   53 private:
   54     std::string m_filename;
   55     std::string m_html;
   56 };
   57 
   58 #endif /* _HTML_H_INCLUDED_ */