]> git.ipfire.org Git - thirdparty/cups.git/blob - cgi-bin/help-index.h
5fb1ac1f5b25007130274e00dd4ce5e823173f27
[thirdparty/cups.git] / cgi-bin / help-index.h
1 /*
2 * Online help index definitions for CUPS.
3 *
4 * Copyright 2007-2011 by Apple Inc.
5 * Copyright 1997-2007 by Easy Software Products.
6 *
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
11 * file is missing or damaged, see the license at "http://www.cups.org/".
12 */
13
14 #ifndef _CUPS_HELP_INDEX_H_
15 # define _CUPS_HELP_INDEX_H_
16
17 /*
18 * Include necessary headers...
19 */
20
21 # include <cups/array.h>
22
23
24 /*
25 * C++ magic...
26 */
27
28 # ifdef __cplusplus
29 extern "C" {
30 # endif /* __cplusplus */
31
32 /*
33 * Data structures...
34 */
35
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... ****/
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 */
48 cups_array_t *words; /* Words after this node */
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
55 typedef struct help_index_s /**** Help index structure ****/
56 {
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 */
60 } help_index_t;
61
62
63 /*
64 * Functions...
65 */
66
67 extern void helpDeleteIndex(help_index_t *hi);
68 extern help_node_t *helpFindNode(help_index_t *hi, const char *filename,
69 const char *anchor);
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
77 # ifdef __cplusplus
78 }
79 # endif /* __cplusplus */
80
81 #endif /* !_CUPS_HELP_INDEX_H_ */