source: branches/z3950-branch/gsdl/src/recpt/formattools.h@ 1342

Last change on this file since 1342 was 1342, checked in by johnmcp, 24 years ago

Relatively stable z39.50 implementation now, merged with the mgpp source.
(Still needs a decent interface and query language though...)

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 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
33enum command_t {comIf, comOr, comMeta, comText, comLink, comEndLink, comNum, comIcon,
34 comDoc, comHighlight, comEndHighlight};
35enum pcommand_t {pNone, pImmediate, pTop, pAll};
36enum dcommand_t {dMeta};
37enum mcommand_t {mNone, mCgiSafe};
38
39struct metadata_t {
40 void clear();
41 metadata_t () {clear();}
42
43 text_t metaname;
44 mcommand_t metacommand;
45 pcommand_t parentcommand;
46 text_t parentoptions;
47};
48
49struct decision_t {
50 void clear();
51 decision_t () {clear();}
52
53 dcommand_t command;
54 metadata_t meta;
55};
56
57struct format_t {
58 void clear();
59 format_t () {clear();}
60
61 command_t command;
62 decision_t decision;
63 text_t text;
64 metadata_t meta;
65 format_t *nextptr;
66 format_t *ifptr;
67 format_t *elseptr;
68 format_t *orptr;
69};
70
71// the format structure used by this receptionist
72struct formatinfo_t {
73 void clear();
74 formatinfo_t () {clear();}
75
76 bool DocumentImages;
77 bool DocumentTitles;
78 text_t DocumentHeading;
79 bool DocumentContents;
80 bool DocumentArrowsBottom;
81 text_tarray DocumentButtons;
82 text_t DocumentText;
83 text_tmap formatstrings;
84 bool DocumentUseHTML;
85};
86
87bool is_table_content (const text_t &formatstring);
88bool is_table_content (const format_t *formatlistptr);
89
90bool get_formatstring (const text_t &key, const text_tmap &formatstringmap,
91 text_t &formatstring);
92bool get_formatstring (const text_t &key1, const text_t &key2,
93 const text_tmap &formatstringmap,
94 text_t &formatstring);
95
96text_t format_date (const text_t &date);
97
98bool parse_formatstring (const text_t &formatstring, format_t *formatlistptr,
99 text_tset &metadata, bool &getParents);
100
101text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
102 const text_t &link, const text_t &icon);
103
104text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr);
105
106text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
107 const text_t &text);
108
109text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
110 const text_t &link, const text_t &icon, const text_t &text);
111
112text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
113 const text_t &link, const text_t &icon, bool highlight);
114
115text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
116 const text_t &link, const text_t &icon,
117 const text_t &text, bool highlight);
118
119
120#endif
Note: See TracBrowser for help on using the repository browser.