Coverage Report

Created: 2025-08-29 06:09

/src/aspell/common/document_checker.hpp
Line
Count
Source (jump to first uncovered line)
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_DOCUMENT_CHECKER__HPP
8
#define ASPELL_DOCUMENT_CHECKER__HPP
9
10
#include "filter.hpp"
11
#include "char_vector.hpp"
12
#include "copy_ptr.hpp"
13
#include "can_have_error.hpp"
14
#include "filter_char.hpp"
15
#include "filter_char_vector.hpp"
16
17
namespace acommon {
18
19
  class Config;
20
  class Speller;
21
  class Tokenizer;
22
  class Convert;
23
24
  struct Token {
25
    unsigned int offset;
26
    unsigned int len;
27
0
    operator bool () const {return len != 0;}
28
  };
29
  
30
  
31
  class DocumentChecker : public CanHaveError {
32
  public:
33
    // will take ownership of tokenizer and filter (even if there is an error)
34
    // config only used for this method.
35
    // speller expected to stick around.
36
    PosibErr<void> setup(Tokenizer *, Speller *, Filter *);
37
    void reset();
38
    void process(const char * str, int size);
39
    void process_wide(const void * str, int size, int type_width);
40
    Token next_misspelling();
41
    
42
0
    Filter * filter() {return filter_;}
43
44
    void set_status_fun(void (*)(void *, Token, int), void *); 
45
   
46
    DocumentChecker();
47
    ~DocumentChecker();
48
    
49
  private:
50
    CopyPtr<Filter> filter_;
51
    CopyPtr<Tokenizer> tokenizer_;
52
    void (* status_fun_)(void *, Token, int);
53
    void * status_fun_data_;
54
    Speller * speller_;
55
    Convert * conv_;
56
    FilterCharVector proc_str_;
57
  };
58
59
  PosibErr<DocumentChecker *> new_document_checker(Speller *);
60
61
}
62
63
#endif /* ASPELL_DOCUMENT_CHECKER__HPP */