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

Last change on this file since 5017 was 4972, checked in by sjboddie, 21 years ago

More changes to the new document formatting code. Added an
AllowExtendedOptions format option which must be set to allow other
new options to work.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 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,
37 comTOC, comImage, comDocumentButtonDetach, comDocumentButtonHighlight,
38 comDocumentButtonExpandContents, comDocumentButtonExpandText};
39enum pcommand_t {pNone, pImmediate, pTop, pAll};
40enum dcommand_t {dMeta, dText};
41enum mcommand_t {mNone, mCgiSafe};
42
43struct metadata_t {
44 void clear();
45 metadata_t () {clear();}
46
47 text_t metaname;
48 mcommand_t metacommand;
49 pcommand_t parentcommand;
50 text_t parentoptions;
51};
52
53
54// The decision component of an {If}{decision,true-text,false-text}
55// formatstring. Te decision can be based on metadata or on text;
56// normally that text would be a macro like _cgiargmode_. --gordon
57struct decision_t {
58 void clear();
59 decision_t () {clear();}
60
61 dcommand_t command;
62 metadata_t meta;
63 text_t text;
64};
65
66struct format_t {
67 void clear();
68 format_t () {clear();}
69
70 command_t command;
71 decision_t decision;
72 text_t text;
73 metadata_t meta;
74 format_t *nextptr;
75 format_t *ifptr;
76 format_t *elseptr;
77 format_t *orptr;
78};
79
80// the format structure used by this receptionist
81struct formatinfo_t {
82 void clear();
83 formatinfo_t () {clear();}
84
85 bool DocumentImages;
86 bool DocumentTitles;
87 text_t DocumentHeading;
88 bool DocumentContents;
89 bool DocumentArrowsBottom;
90 bool DocumentArrowsTop;
91 text_tarray DocumentButtons;
92 text_t DocumentText;
93 //-----------------
94 text_t RelatedDocuments;
95 //----------------
96 text_tmap formatstrings;
97 bool DocumentUseHTML;
98 bool AllowExtendedOptions;
99};
100
101bool is_table_content (const text_t &formatstring);
102bool is_table_content (const format_t *formatlistptr);
103
104bool get_formatstring (const text_t &key, const text_tmap &formatstringmap,
105 text_t &formatstring);
106bool get_formatstring (const text_t &key1, const text_t &key2,
107 const text_tmap &formatstringmap,
108 text_t &formatstring);
109
110text_t format_date (const text_t &date);
111
112text_t iso639 (const text_t &langcode);
113
114text_t get_href (const text_t &link);
115
116text_t get_related_docs(const text_t& collection, recptproto* collectproto,
117 ResultDocInfo_t &docinfo, ostream& logout);
118
119
120bool parse_formatstring (const text_t &formatstring, format_t *formatlistptr,
121 text_tset &metadata, bool &getParents);
122
123
124
125text_t get_formatted_string (const text_t& collection, recptproto* collectproto,
126 ResultDocInfo_t &docinfo, displayclass &disp,
127 format_t *formatlistptr, text_tmap &options,
128 ostream& logout);
129
130#endif
131
132
Note: See TracBrowser for help on using the repository browser.