source: trunk/gsdl/src/recpt/formattools.h@ 1474

Last change on this file since 1474 was 1443, checked in by davidb, 24 years ago

Changes to support nested {If} and {Or} statements in macro files.
Also expansion of metadata if it includes further metadata. The two
can be intermixed -- metadata can include metadata that has {If}
and {Or} statements.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
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 *********************************************************************/
25
26
27#ifndef FORMATTOOLS_H
28#define FORMATTOOLS_H
29
30#include "text_t.h"
31#include "comtypes.h"
32#include "recptproto.h"
33
34enum command_t {comIf, comOr, comMeta, comText, comLink, comEndLink, comNum, comIcon,
35 comDoc, comHighlight, comEndHighlight};
36enum pcommand_t {pNone, pImmediate, pTop, pAll};
37enum dcommand_t {dMeta};
38enum mcommand_t {mNone, mCgiSafe};
39
40struct 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
50struct decision_t {
51 void clear();
52 decision_t () {clear();}
53
54 dcommand_t command;
55 metadata_t meta;
56};
57
58struct 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
73struct formatinfo_t {
74 void clear();
75 formatinfo_t () {clear();}
76
77 bool DocumentImages;
78 bool DocumentTitles;
79 text_t DocumentHeading;
80 bool DocumentContents;
81 bool DocumentArrowsBottom;
82 text_tarray DocumentButtons;
83 text_t DocumentText;
84 text_tmap formatstrings;
85 bool DocumentUseHTML;
86};
87
88bool is_table_content (const text_t &formatstring);
89bool is_table_content (const format_t *formatlistptr);
90
91bool get_formatstring (const text_t &key, const text_tmap &formatstringmap,
92 text_t &formatstring);
93bool get_formatstring (const text_t &key1, const text_t &key2,
94 const text_tmap &formatstringmap,
95 text_t &formatstring);
96
97text_t format_date (const text_t &date);
98
99bool parse_formatstring (const text_t &formatstring, format_t *formatlistptr,
100 text_tset &metadata, bool &getParents);
101
102
103text_t get_formatted_string (const text_t& collection, recptproto* collectproto,
104 ResultDocInfo_t &docinfo, format_t *formatlistptr,
105 const text_t &link, const text_t &icon,
106 const text_t& t, const bool highlight,
107 ostream& logout);
108
109text_t get_formatted_string (const text_t& collection, recptproto* collectproto,
110 ResultDocInfo_t &docinfo, format_t *formatlistptr,
111 const text_t &link, const text_t &icon,
112 const bool highlight,
113 ostream& logout);
114
115text_t get_formatted_string (const text_t& collection, recptproto* collectproto,
116 ResultDocInfo_t &docinfo, format_t *formatlistptr,
117 const text_t &text,
118 ostream& logout);
119
120text_t get_formatted_string (const text_t& collection, recptproto* collectproto,
121 ResultDocInfo_t &docinfo, format_t *formatlistptr,
122 ostream& logout);
123
124
125
126#endif
127
128
Note: See TracBrowser for help on using the repository browser.