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 649 1999-10-10 08:14:12Z 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, comDoc};
|
---|
36 | enum pcommand_t {pNone, pImmediate, pTop, pAll};
|
---|
37 | enum dcommand_t {dMeta};
|
---|
38 | enum mcommand_t {mNone, mCgiSafe};
|
---|
39 |
|
---|
40 | struct metadata_t {
|
---|
41 | void clear();
|
---|
42 | metadata_t () {clear();}
|
---|
43 |
|
---|
44 | text_t metaname;
|
---|
45 | mcommand_t metacommand;
|
---|
46 | pcommand_t parentcommand;
|
---|
47 | text_t parentoptions;
|
---|
48 | };
|
---|
49 |
|
---|
50 | struct decision_t {
|
---|
51 | void clear();
|
---|
52 | decision_t () {clear();}
|
---|
53 |
|
---|
54 | dcommand_t command;
|
---|
55 | metadata_t meta;
|
---|
56 | };
|
---|
57 |
|
---|
58 | struct format_t {
|
---|
59 | void clear();
|
---|
60 | format_t () {clear();}
|
---|
61 |
|
---|
62 | command_t command;
|
---|
63 | decision_t decision;
|
---|
64 | text_t text;
|
---|
65 | metadata_t meta;
|
---|
66 | format_t *nextptr;
|
---|
67 | format_t *ifptr;
|
---|
68 | format_t *elseptr;
|
---|
69 | format_t *orptr;
|
---|
70 | };
|
---|
71 |
|
---|
72 | // the format structure used by this receptionist
|
---|
73 | struct formatinfo_t {
|
---|
74 | void clear();
|
---|
75 | formatinfo_t () {clear();}
|
---|
76 |
|
---|
77 | bool DocumentImages;
|
---|
78 | bool DocumentTopPages;
|
---|
79 | text_t DocumentHeading;
|
---|
80 | bool DocumentArrowsTop;
|
---|
81 | bool DocumentArrowsBottom;
|
---|
82 | bool DocumentGoTo;
|
---|
83 | text_tarray DocumentButtons;
|
---|
84 | text_t DocumentText;
|
---|
85 | text_tmap formatstrings;
|
---|
86 | };
|
---|
87 |
|
---|
88 | bool get_formatstring (const text_t &key, const text_tmap &formatstringmap,
|
---|
89 | text_t &formatstring);
|
---|
90 | bool get_formatstring (const text_t &key1, const text_t &key2,
|
---|
91 | const text_tmap &formatstringmap,
|
---|
92 | text_t &formatstring);
|
---|
93 |
|
---|
94 | text_t format_date (const text_t &date);
|
---|
95 |
|
---|
96 | bool parse_formatstring (const text_t &formatstring, format_t *formatlistptr,
|
---|
97 | text_tset &metadata, bool &getParents);
|
---|
98 |
|
---|
99 | text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
|
---|
100 | const text_t &link, const text_t &icon);
|
---|
101 |
|
---|
102 | text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr);
|
---|
103 |
|
---|
104 | text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
|
---|
105 | const text_t &text);
|
---|
106 |
|
---|
107 | text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
|
---|
108 | const text_t &link, const text_t &icon, const text_t &text);
|
---|
109 |
|
---|
110 |
|
---|
111 | #endif
|
---|