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