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

Last change on this file since 3036 was 2967, checked in by paradis, 22 years ago

new metadata command [Summary]

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 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#include "display.h"
34
35enum command_t {comIf, comOr, comMeta, comText, comLink, comEndLink, comNum, comIcon,
36 comDoc, comHighlight, comEndHighlight, comRel, comHref, comSummary};
37enum pcommand_t {pNone, pImmediate, pTop, pAll};
38enum dcommand_t {dMeta, dText};
39enum mcommand_t {mNone, mCgiSafe};
40
41struct 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
52// The decision component of an {If}{decision,true-text,false-text}
53// formatstring. Te decision can be based on metadata or on text;
54// normally that text would be a macro like _cgiargmode_. --gordon
55struct decision_t {
56 void clear();
57 decision_t () {clear();}
58
59 dcommand_t command;
60 metadata_t meta;
61 text_t text;
62};
63
64struct format_t {
65 void clear();
66 format_t () {clear();}
67
68 command_t command;
69 decision_t decision;
70 text_t text;
71 metadata_t meta;
72 format_t *nextptr;
73 format_t *ifptr;
74 format_t *elseptr;
75 format_t *orptr;
76};
77
78// the format structure used by this receptionist
79struct formatinfo_t {
80 void clear();
81 formatinfo_t () {clear();}
82
83 bool DocumentImages;
84 bool DocumentTitles;
85 text_t DocumentHeading;
86 bool DocumentContents;
87 bool DocumentArrowsBottom;
88 text_tarray DocumentButtons;
89 text_t DocumentText;
90 //-----------------
91 text_t RelatedDocuments;
92 //----------------
93 text_tmap formatstrings;
94 bool DocumentUseHTML;
95};
96
97bool is_table_content (const text_t &formatstring);
98bool is_table_content (const format_t *formatlistptr);
99
100bool get_formatstring (const text_t &key, const text_tmap &formatstringmap,
101 text_t &formatstring);
102bool get_formatstring (const text_t &key1, const text_t &key2,
103 const text_tmap &formatstringmap,
104 text_t &formatstring);
105
106text_t format_date (const text_t &date);
107
108text_t iso639 (const text_t &langcode);
109
110text_t get_href (const text_t &link);
111
112text_t get_related_docs(const text_t& collection, recptproto* collectproto,
113 ResultDocInfo_t &docinfo, ostream& logout);
114
115
116bool parse_formatstring (const text_t &formatstring, format_t *formatlistptr,
117 text_tset &metadata, bool &getParents);
118
119
120text_t get_formatted_string (const text_t& collection, recptproto* collectproto,
121 ResultDocInfo_t &docinfo, displayclass &disp,
122 format_t *formatlistptr,
123 const text_t &link, const text_t &icon,
124 const text_t& t, const bool highlight,
125 ostream& logout);
126
127text_t get_formatted_string (const text_t& collection, recptproto* collectproto,
128 ResultDocInfo_t &docinfo, displayclass &disp,
129 format_t *formatlistptr,
130 const text_t &link, const text_t &icon,
131 const bool highlight,
132 ostream& logout);
133
134text_t get_formatted_string (const text_t& collection, recptproto* collectproto,
135 ResultDocInfo_t &docinfo, displayclass &disp,
136 format_t *formatlistptr,
137 const text_t &text,
138 ostream& logout);
139
140text_t get_formatted_string (const text_t& collection, recptproto* collectproto,
141 ResultDocInfo_t &docinfo, displayclass &disp,
142 format_t *formatlistptr, ostream& logout);
143
144
145
146#endif
147
148
Note: See TracBrowser for help on using the repository browser.