Generic Filter. More...
#include <gfilter.h>
Public Member Functions | |
| GFilter (GSession *session, GPlugInFactory *fac) | |
| void | AddMIME (R::RString mime) |
| virtual void | Analyze (GDocAnalyze *analyzer, const GDoc *doc, const R::RURI &file)=0 |
| virtual R::RString | GetTextFragment (GDocFragment *fragment) |
| virtual | ~GFilter (void) |
Detailed Description
Generic Filter.
The GFilter class provides a generic filter that extracts text from a document of a given type. In practice, the filter calls the methods Extract* from the GDocAnalyze class.
Each filter is associated with a given set of MIME types. This association is used to determine which filter should extracts the text from a document.
Constructor & Destructor Documentation
| GFilter | ( | GSession * | session, |
| GPlugInFactory * | fac | ||
| ) |
Construct the filter.
- Parameters:
-
session Session. fac Factory.
| virtual ~GFilter | ( | void | ) | [virtual] |
Destruct the filter.
Member Function Documentation
| void AddMIME | ( | R::RString | mime | ) |
Add a specific MIME-Type for the filter.
- Parameters:
-
mime Name of the MIME-Type.
| virtual void Analyze | ( | GDocAnalyze * | analyzer, |
| const GDoc * | doc, | ||
| const R::RURI & | file | ||
| ) | [pure virtual] |
Analyze a document with a given URI. This method must be re-implemented by all filters.
- Parameters:
-
analyzer Analyzer. doc Document to analyze. file File to analyze (eventually a local copy of a remote document).
| virtual R::RString GetTextFragment | ( | GDocFragment * | fragment | ) | [virtual] |
Extract a text fragment from a file with a given URI. This method should be re-implemented by filters.
By default, it opens a simple text file in utf-8 and extract the text window defined (stopping at the first space or punctuation character).
- Parameters:
-
fragment Fragment to extract.
- Returns:
- a string containing the text fragment.