89ddb03b1fe915c470e7b60af903bde5d32ea6f2
[platform/upstream/aspell.git] / modules / speller / default / check_list.hpp
1 // This file is part of The New Aspell
2 // Copyright (C) 2004 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 __aspeller_check_list__
8 #define __aspeller_check_list__
9
10 #include "objstack.hpp"
11 #include "speller.hpp"
12
13 namespace aspeller {
14
15   using acommon::CheckInfo;
16
17   static inline void clear_check_info(CheckInfo & ci)
18   {
19     memset(&ci, 0, sizeof(ci));
20   }
21
22   struct GuessInfo
23   {
24     int num;
25     CheckInfo * head;
26     GuessInfo() : num(0), head(0) {}
27     void reset() { buf.reset(); num = 0; head = 0; }
28     CheckInfo * add() {
29       num++;
30       CheckInfo * tmp = (CheckInfo *)buf.alloc_top(sizeof(CheckInfo), 
31                                                    sizeof(void*));
32       clear_check_info(*tmp);
33       tmp->next = head;
34       head = tmp;
35       head->guess = true;
36       return head;
37     }
38     void * alloc(unsigned s) {return buf.alloc_bottom(s);}
39     char * dup(ParmString str) {return buf.dup(str);}
40   private:
41     ObjStack buf;
42   };
43
44
45 }
46
47 #endif