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