]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
503b54c9 | 2 | * Online help index definitions for CUPS. |
ef416fc2 | 3 | * |
503b54c9 MS |
4 | * Copyright 2007-2011 by Apple Inc. |
5 | * Copyright 1997-2007 by Easy Software Products. | |
ef416fc2 | 6 | * |
e3101897 | 7 | * Licensed under Apache License v2.0. See the file "LICENSE" for more information. |
ef416fc2 | 8 | */ |
9 | ||
10 | #ifndef _CUPS_HELP_INDEX_H_ | |
11 | # define _CUPS_HELP_INDEX_H_ | |
12 | ||
ecdc0628 | 13 | /* |
14 | * Include necessary headers... | |
15 | */ | |
16 | ||
17 | # include <cups/array.h> | |
18 | ||
ef416fc2 | 19 | |
ef55b745 MS |
20 | /* |
21 | * C++ magic... | |
22 | */ | |
23 | ||
24 | # ifdef __cplusplus | |
25 | extern "C" { | |
26 | # endif /* __cplusplus */ | |
27 | ||
ef416fc2 | 28 | /* |
29 | * Data structures... | |
30 | */ | |
31 | ||
f7deaa1a | 32 | typedef struct help_word_s /**** Help word structure... ****/ |
33 | { | |
34 | int count; /* Number of occurrences */ | |
35 | char *text; /* Word text */ | |
36 | } help_word_t; | |
37 | ||
38 | typedef struct help_node_s /**** Help node structure... ****/ | |
ef416fc2 | 39 | { |
40 | char *filename; /* Filename, relative to help dir */ | |
41 | char *section; /* Section name (NULL if none) */ | |
42 | char *anchor; /* Anchor name (NULL if none) */ | |
43 | char *text; /* Text in anchor */ | |
f7deaa1a | 44 | cups_array_t *words; /* Words after this node */ |
ef416fc2 | 45 | time_t mtime; /* Last modification time */ |
46 | off_t offset; /* Offset in file */ | |
47 | size_t length; /* Length in bytes */ | |
48 | int score; /* Search score */ | |
49 | } help_node_t; | |
50 | ||
f7deaa1a | 51 | typedef struct help_index_s /**** Help index structure ****/ |
ef416fc2 | 52 | { |
ecdc0628 | 53 | int search; /* 1 = search index, 0 = normal */ |
54 | cups_array_t *nodes; /* Nodes sorted by filename */ | |
55 | cups_array_t *sorted; /* Nodes sorted by score + text */ | |
ef416fc2 | 56 | } help_index_t; |
57 | ||
58 | ||
59 | /* | |
60 | * Functions... | |
61 | */ | |
62 | ||
63 | extern void helpDeleteIndex(help_index_t *hi); | |
ecdc0628 | 64 | extern help_node_t *helpFindNode(help_index_t *hi, const char *filename, |
65 | const char *anchor); | |
ef416fc2 | 66 | extern help_index_t *helpLoadIndex(const char *hifile, const char *directory); |
67 | extern int helpSaveIndex(help_index_t *hi, const char *hifile); | |
68 | extern help_index_t *helpSearchIndex(help_index_t *hi, const char *query, | |
69 | const char *section, | |
70 | const char *filename); | |
71 | ||
72 | ||
ef55b745 MS |
73 | # ifdef __cplusplus |
74 | } | |
75 | # endif /* __cplusplus */ | |
76 | ||
ef416fc2 | 77 | #endif /* !_CUPS_HELP_INDEX_H_ */ |