Generic Filter. More...

#include <gfilter.h>

Inheritance diagram for GFilter:
[legend]

Public Member Functions

 GFilter (GSession *session, GPlugInFactory *fac)
 
void AddMIME (const R::RString &mime)
 
void AddScheme (const R::RString &scheme)
 
virtual R::RURI GetValidURI (const R::RURI &uri, bool &mustdelete)
 
virtual void Analyze (GDocAnalyze *analyzer, const GDoc *doc, const R::RURI &file)=0
 
virtual R::RString GetTextFragment (GDoc *doc, size_t begin, size_t end)
 
virtual ~GFilter (void)
 
- Public Member Functions inherited from GPlugIn
 GPlugIn (GSession *session, GPlugInFactory *fac)
 
virtual void ApplyConfig (void)
 
void InsertParam (R::RParam *param)
 
template<class T >
T * FindParam (const R::RString &name)
 
R::RCursor< R::RParamGetParams (const R::RString &cat=R::RString::Null)
 
void GetCategories (R::RContainer< R::RString, true, false > &cats)
 
virtual void Init (void)
 
virtual void CreateConfig (void)
 
virtual void Reset (void)
 
GPlugInFactoryGetFactory (void) const
 
int Compare (const GPlugIn &plugin) const
 
int Compare (const R::RString &plugin) const
 
R::RString GetName (void) const
 
R::RString GetDesc (void) const
 
GSessionGetSession (void) const
 
virtual void Done (void)
 
virtual ~GPlugIn (void)
 

Additional Inherited Members

- Protected Attributes inherited from GPlugIn
GPlugInFactoryFactory
 
GSessionSession
 
size_t Id
 

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.

See the documentation related to GPlugIn for more general information.

Constructor & Destructor Documentation

GFilter ( GSession session,
GPlugInFactory fac 
)

Construct the filter.

Parameters
sessionSession.
facFactory.
virtual ~GFilter ( void  )
virtual

Destruct the filter.

Member Function Documentation

void AddMIME ( const R::RString mime)

Add a specific MIME-Type for the filter.

Parameters
mimeName of the MIME-Type.
void AddScheme ( const R::RString scheme)

Add a specific scheme for the filter.

Parameters
schemeName of the scheme.
virtual R::RURI GetValidURI ( const R::RURI uri,
bool &  mustdelete 
)
virtual

Get a valid URI (something that a normal RFile can handle) and specify if the corresponding document must be deleted (because it is temporary file) or not once the caller does not need it anymore.

Parameters
uriOriginal URI.
mustdeleteMust the document be deleted by the caller (modified by the function.
Returns
an URI.
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
analyzerAnalyzer.
docDocument to analyze.
fileFile to analyze (eventually a local copy of a remote document).
virtual R::RString GetTextFragment ( GDoc doc,
size_t  begin,
size_t  end 
)
virtual

Extract a text fragment. This method can be re-implemented by filters.

Parameters
docDocument to extract from.
beginBeginning position.
endEnding position.
Returns
a string containing the text fragment.