E-MailRelay

Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
GFilters::FilterFactory Class Reference

A FilterFactory implementation. More...

`#include <gfilterfactory.h>`

Inheritance diagram for GFilters::FilterFactory:
[legend]
Collaboration diagram for GFilters::FilterFactory:
[legend]

## Public Member Functions
| FilterFactory (GStore::FileStore &)
| Constructor. More...
| FilterFactory (const FilterFactory &)=delete
| FilterFactory (FilterFactory &&)=delete
FilterFactory & | operator= (const FilterFactory &)=delete
FilterFactory & | operator= (FilterFactory &&)=delete
Public Member Functions inherited from GSmtp::FilterFactoryBase
virtual std::unique_ptr< Filter > | newFilter (GNet::EventState, Filter::Type, const Filter::Config &, const Spec &spec)=0
| Returns a Filter on the heap. More...
virtual | ~FilterFactoryBase ()=default
| Destructor.

## Static Public Member Functions
static Spec | parse (std::string_view spec, const G::Path &base_dir={}, const G::Path &app_dir={}, G::StringArray *warnings_p=nullptr)
| Parses and validates the filter specification string returning the type and value in a Spec tuple, eg. More...

## Protected Member Functions
std::unique_ptr< GSmtp::Filter > | newFilter (GNet::EventState, GSmtp::Filter::Type, const GSmtp::Filter::Config &, const Spec &) override
| Returns a Filter on the heap. More...

## Detailed Description

A FilterFactory implementation.

It holds a GSmtp::FileStore reference so that it can instantiate filters that operate on messages stored as files.

Definition at line 44 of file gfilterfactory.h.

## Constructor & Destructor Documentation

## ◆ FilterFactory()

GFilters::FilterFactory::FilterFactory | ( | GStore::FileStore & | file_store | ) |
| explicit

Constructor.

The FileStore reference is retained and passed to new filter objects so that they can derive the paths of the content and envelope files that they process.

Definition at line 41 of file gfilterfactory.cpp.

## Member Function Documentation

## ◆ newFilter()

std::unique_ptr< GSmtp::Filter > GFilters::FilterFactory::newFilter | ( | GNet::EventState | ,
|  | GSmtp::Filter::Type | ,
|  | const GSmtp::Filter::Config & | ,
|  | const Spec & | spec
| ) |  |
| override protected virtual

Returns a Filter on the heap.

Optionally throws if an invalid or unsupported filter specification.

Implements GSmtp::FilterFactoryBase.

Definition at line 122 of file gfilterfactory.cpp.

## ◆ parse()

GFilters::FilterFactory::Spec GFilters::FilterFactory::parse | ( | std::string_view | spec,
|  | const G::Path & | base_dir = `{}`,
|  | const G::Path & | app_dir = `{}`,
|  | G::StringArray * | warnings_p = `nullptr`
| ) |  |
| static

Parses and validates the filter specification string returning the type and value in a Spec tuple, eg.

("file","/usr/bin/foo") or ("net","127.0.0.1:99").

The specification string can be a comma-separated list with the component parts checked separately and the returned Spec is like ("chain","file:foo,net:bar").

Any relative file paths are made absolute using the given base directory, if given. (This is normally from G::Process::cwd() called at startup).

Any "@app" sub-strings in file paths are substituted with the given application directory, if given.

Returns 'first' empty if a fatal parsing error, with the reason in 'second'.

Returns warnings by reference for non-fatal errors, such as missing files.

Definition at line 46 of file gfilterfactory.cpp.

The documentation for this class was generated from the following files:

- /tmp/slackdce/slackrepo.HKsbdz/build_emailrelay/emailrelay-2.6/src/gfilters/gfilterfactory.h
- /tmp/slackdce/slackrepo.HKsbdz/build_emailrelay/emailrelay-2.6/src/gfilters/gfilterfactory.cpp