1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * formattools.h --
|
---|
4 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
5 | *
|
---|
6 | * A component of the Greenstone digital library software
|
---|
7 | * from the New Zealand Digital Library Project at the
|
---|
8 | * University of Waikato, New Zealand.
|
---|
9 | *
|
---|
10 | * This program is free software; you can redistribute it and/or modify
|
---|
11 | * it under the terms of the GNU General Public License as published by
|
---|
12 | * the Free Software Foundation; either version 2 of the License, or
|
---|
13 | * (at your option) any later version.
|
---|
14 | *
|
---|
15 | * This program is distributed in the hope that it will be useful,
|
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
18 | * GNU General Public License for more details.
|
---|
19 | *
|
---|
20 | * You should have received a copy of the GNU General Public License
|
---|
21 | * along with this program; if not, write to the Free Software
|
---|
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
23 | *
|
---|
24 | * $Id: formattools.h 868 2000-01-25 22:33:31Z sjboddie $
|
---|
25 | *
|
---|
26 | *********************************************************************/
|
---|
27 |
|
---|
28 |
|
---|
29 | #ifndef FORMATTOOLS_H
|
---|
30 | #define FORMATTOOLS_H
|
---|
31 |
|
---|
32 | #include "text_t.h"
|
---|
33 | #include "comtypes.h"
|
---|
34 |
|
---|
35 | enum command_t {comIf, comOr, comMeta, comText, comLink, comEndLink, comNum, comIcon,
|
---|
36 | comDoc, comHighlight, comEndHighlight};
|
---|
37 | enum pcommand_t {pNone, pImmediate, pTop, pAll};
|
---|
38 | enum dcommand_t {dMeta};
|
---|
39 | enum mcommand_t {mNone, mCgiSafe};
|
---|
40 |
|
---|
41 | struct metadata_t {
|
---|
42 | void clear();
|
---|
43 | metadata_t () {clear();}
|
---|
44 |
|
---|
45 | text_t metaname;
|
---|
46 | mcommand_t metacommand;
|
---|
47 | pcommand_t parentcommand;
|
---|
48 | text_t parentoptions;
|
---|
49 | };
|
---|
50 |
|
---|
51 | struct decision_t {
|
---|
52 | void clear();
|
---|
53 | decision_t () {clear();}
|
---|
54 |
|
---|
55 | dcommand_t command;
|
---|
56 | metadata_t meta;
|
---|
57 | };
|
---|
58 |
|
---|
59 | struct format_t {
|
---|
60 | void clear();
|
---|
61 | format_t () {clear();}
|
---|
62 |
|
---|
63 | command_t command;
|
---|
64 | decision_t decision;
|
---|
65 | text_t text;
|
---|
66 | metadata_t meta;
|
---|
67 | format_t *nextptr;
|
---|
68 | format_t *ifptr;
|
---|
69 | format_t *elseptr;
|
---|
70 | format_t *orptr;
|
---|
71 | };
|
---|
72 |
|
---|
73 | // the format structure used by this receptionist
|
---|
74 | struct formatinfo_t {
|
---|
75 | void clear();
|
---|
76 | formatinfo_t () {clear();}
|
---|
77 |
|
---|
78 | bool DocumentImages;
|
---|
79 | bool DocumentTitles;
|
---|
80 | text_t DocumentHeading;
|
---|
81 | bool DocumentContents;
|
---|
82 | bool DocumentArrowsBottom;
|
---|
83 | text_tarray DocumentButtons;
|
---|
84 | text_t DocumentText;
|
---|
85 | text_tmap formatstrings;
|
---|
86 | bool DocumentUseHTML;
|
---|
87 | };
|
---|
88 |
|
---|
89 | bool is_table_content (const text_t &formatstring);
|
---|
90 | bool is_table_content (const format_t *formatlistptr);
|
---|
91 |
|
---|
92 | bool get_formatstring (const text_t &key, const text_tmap &formatstringmap,
|
---|
93 | text_t &formatstring);
|
---|
94 | bool get_formatstring (const text_t &key1, const text_t &key2,
|
---|
95 | const text_tmap &formatstringmap,
|
---|
96 | text_t &formatstring);
|
---|
97 |
|
---|
98 | text_t format_date (const text_t &date);
|
---|
99 |
|
---|
100 | bool parse_formatstring (const text_t &formatstring, format_t *formatlistptr,
|
---|
101 | text_tset &metadata, bool &getParents);
|
---|
102 |
|
---|
103 | text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
|
---|
104 | const text_t &link, const text_t &icon);
|
---|
105 |
|
---|
106 | text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr);
|
---|
107 |
|
---|
108 | text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
|
---|
109 | const text_t &text);
|
---|
110 |
|
---|
111 | text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
|
---|
112 | const text_t &link, const text_t &icon, const text_t &text);
|
---|
113 |
|
---|
114 | text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
|
---|
115 | const text_t &link, const text_t &icon, bool highlight);
|
---|
116 |
|
---|
117 | text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
|
---|
118 | const text_t &link, const text_t &icon,
|
---|
119 | const text_t &text, bool highlight);
|
---|
120 |
|
---|
121 |
|
---|
122 | #endif
|
---|