1 /* This file is part of The New Aspell
2  * Copyright (C) 2001 by Kevin Atkinson under the GNU LGPL
3  * license version 2.0 or 2.1.  You should have received a copy of the
4  * LGPL license along with this library if you did not you can find it
5  * at http://www.gnu.org/.                                              */
6 
7 #ifndef ASPELL_FILTER__HPP
8 #define ASPELL_FILTER__HPP
9 
10 #include "can_have_error.hpp"
11 #include "copy_ptr.hpp"
12 #include "filter_char.hpp"
13 #include "posib_err.hpp"
14 #include "vector.hpp"
15 #include "string_pair_enumeration.hpp"
16 
17 #include <stdio.h>
18 
19 namespace acommon {
20 
21   class Config;
22   class Speller;
23   class IndividualFilter;
24   class StringList;
25   struct ConfigModule;
26 
27   class Filter : public CanHaveError {
28   public:
29 
empty() const30     bool empty() const {return filters_.empty();}
31     void clear();
32     void reset();
33     void process(FilterChar * & start, FilterChar * & stop);
34     void add_filter(IndividualFilter * filter);
35     // setup the filter where the string list is the list of
36     // filters to use.
37     Filter();
38     ~Filter();
39 
40  private:
41     typedef Vector<IndividualFilter *> Filters;
42     Filters filters_;
43   };
44 
45   PosibErr<void> set_mode_from_extension(Config * config,
46                                          ParmString filename,
47                                          FILE * in = NULL);
48 
49   PosibErr<void> setup_filter(Filter &, Config *,
50 			      bool use_decoder,
51 			      bool use_filter,
52 			      bool use_encoder);
53   void activate_dynamic_filteroptions(Config *c);
54   void activate_filter_modes(Config * config);
55 
56   void load_all_filters(Config * config);
57 
58   PosibErr<bool> verify_version(const char * relOp,
59                                 const char * actual, const char * required);
60   PosibErr<void> check_version(const char * requirement);
61 
62   PosibErr<StringPairEnumeration *> available_filters(Config *);
63   PosibErr<StringPairEnumeration *> available_filter_modes(Config *);
64 
65 };
66 
67 #endif /* ASPELL_FILTER__HPP */
68