]>
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 | * |
503b54c9 MS |
7 | * These coded instructions, statements, and computer programs are the |
8 | * property of Apple Inc. and are protected by Federal copyright | |
9 | * law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
10 | * which should have been included with this file. If this file is | |
57b7b66b | 11 | * missing or damaged, see the license at "http://www.cups.org/". |
ef416fc2 | 12 | */ |
13 | ||
14 | #ifndef _CUPS_HELP_INDEX_H_ | |
15 | # define _CUPS_HELP_INDEX_H_ | |
16 | ||
ecdc0628 | 17 | /* |
18 | * Include necessary headers... | |
19 | */ | |
20 | ||
21 | # include <cups/array.h> | |
22 | ||
ef416fc2 | 23 | |
ef55b745 MS |
24 | /* |
25 | * C++ magic... | |
26 | */ | |
27 | ||
28 | # ifdef __cplusplus | |
29 | extern "C" { | |
30 | # endif /* __cplusplus */ | |
31 | ||
ef416fc2 | 32 | /* |
33 | * Data structures... | |
34 | */ | |
35 | ||
f7deaa1a | 36 | typedef struct help_word_s /**** Help word structure... ****/ |
37 | { | |
38 | int count; /* Number of occurrences */ | |
39 | char *text; /* Word text */ | |
40 | } help_word_t; | |
41 | ||
42 | typedef struct help_node_s /**** Help node structure... ****/ | |
ef416fc2 | 43 | { |
44 | char *filename; /* Filename, relative to help dir */ | |
45 | char *section; /* Section name (NULL if none) */ | |
46 | char *anchor; /* Anchor name (NULL if none) */ | |
47 | char *text; /* Text in anchor */ | |
f7deaa1a | 48 | cups_array_t *words; /* Words after this node */ |
ef416fc2 | 49 | time_t mtime; /* Last modification time */ |
50 | off_t offset; /* Offset in file */ | |
51 | size_t length; /* Length in bytes */ | |
52 | int score; /* Search score */ | |
53 | } help_node_t; | |
54 | ||
f7deaa1a | 55 | typedef struct help_index_s /**** Help index structure ****/ |
ef416fc2 | 56 | { |
ecdc0628 | 57 | int search; /* 1 = search index, 0 = normal */ |
58 | cups_array_t *nodes; /* Nodes sorted by filename */ | |
59 | cups_array_t *sorted; /* Nodes sorted by score + text */ | |
ef416fc2 | 60 | } help_index_t; |
61 | ||
62 | ||
63 | /* | |
64 | * Functions... | |
65 | */ | |
66 | ||
67 | extern void helpDeleteIndex(help_index_t *hi); | |
ecdc0628 | 68 | extern help_node_t *helpFindNode(help_index_t *hi, const char *filename, |
69 | const char *anchor); | |
ef416fc2 | 70 | extern help_index_t *helpLoadIndex(const char *hifile, const char *directory); |
71 | extern int helpSaveIndex(help_index_t *hi, const char *hifile); | |
72 | extern help_index_t *helpSearchIndex(help_index_t *hi, const char *query, | |
73 | const char *section, | |
74 | const char *filename); | |
75 | ||
76 | ||
ef55b745 MS |
77 | # ifdef __cplusplus |
78 | } | |
79 | # endif /* __cplusplus */ | |
80 | ||
ef416fc2 | 81 | #endif /* !_CUPS_HELP_INDEX_H_ */ |