Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
srohatgi01
GitHub Repository: srohatgi01/cups
Path: blob/master/cgi-bin/help-index.h
1090 views
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
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
8
*/
9
10
#ifndef _CUPS_HELP_INDEX_H_
11
# define _CUPS_HELP_INDEX_H_
12
13
/*
14
* Include necessary headers...
15
*/
16
17
# include <cups/array.h>
18
19
20
/*
21
* C++ magic...
22
*/
23
24
# ifdef __cplusplus
25
extern "C" {
26
# endif /* __cplusplus */
27
28
/*
29
* Data structures...
30
*/
31
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... ****/
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 */
44
cups_array_t *words; /* Words after this node */
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
51
typedef struct help_index_s /**** Help index structure ****/
52
{
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 */
56
} help_index_t;
57
58
59
/*
60
* Functions...
61
*/
62
63
extern void helpDeleteIndex(help_index_t *hi);
64
extern help_node_t *helpFindNode(help_index_t *hi, const char *filename,
65
const char *anchor);
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
73
# ifdef __cplusplus
74
}
75
# endif /* __cplusplus */
76
77
#endif /* !_CUPS_HELP_INDEX_H_ */
78
79