1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
/* This file is part of The New Aspell
* Copyright (C) 2001 by Kevin Atkinson under the GNU LGPL
* license version 2.0 or 2.1. You should have received a copy of the
* LGPL license along with this library if you did not you can find it
* at http://www.gnu.org/. */
#ifndef ASPELL_DOCUMENT_CHECKER__HPP
#define ASPELL_DOCUMENT_CHECKER__HPP
#include "filter.hpp"
#include "char_vector.hpp"
#include "copy_ptr.hpp"
#include "can_have_error.hpp"
#include "filter_char.hpp"
#include "filter_char_vector.hpp"
namespace acommon {
class Config;
class Speller;
class Tokenizer;
class Convert;
struct Token {
unsigned int offset;
unsigned int len;
operator bool () const {return len != 0;}
};
class DocumentChecker : public CanHaveError {
public:
// will take ownership of tokenizer and filter (even if there is an error)
// config only used for this method.
// speller expected to stick around.
PosibErr<void> setup(Tokenizer *, Speller *, Filter *);
void reset();
void process(const char * str, int size);
Token next_misspelling();
Filter * filter() {return filter_;}
void set_status_fun(void (*)(void *, Token, int), void *);
DocumentChecker();
~DocumentChecker();
private:
CopyPtr<Filter> filter_;
CopyPtr<Tokenizer> tokenizer_;
void (* status_fun_)(void *, Token, int);
void * status_fun_data_;
Speller * speller_;
Convert * conv_;
FilterCharVector proc_str_;
};
PosibErr<DocumentChecker *> new_document_checker(Speller *);
}
#endif /* ASPELL_DOCUMENT_CHECKER__HPP */
|