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

Last change on this file since 749 was 749, checked in by sjboddie, 24 years ago

moved table functions from browsetools

  • 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 * $Id: formattools.h 749 1999-10-30 22:23:11Z sjboddie $
25 *
26 *********************************************************************/
27
28
29#ifndef FORMATTOOLS_H
30#define FORMATTOOLS_H
31
32#include "text_t.h"
33#include "comtypes.h"
34
35enum command_t {comIf, comOr, comMeta, comText, comLink, comEndLink, comNum, comIcon,
36 comDoc, comHighlight, comEndHighlight};
37enum pcommand_t {pNone, pImmediate, pTop, pAll};
38enum dcommand_t {dMeta};
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
51struct decision_t {
52 void clear();
53 decision_t () {clear();}
54
55 dcommand_t command;
56 metadata_t meta;
57};
58
59struct format_t {
60 void clear();
61 format_t () {clear();}
62
63 command_t command;
64 decision_t decision;
65 text_t text;
66 metadata_t meta;
67 format_t *nextptr;
68 format_t *ifptr;
69 format_t *elseptr;
70 format_t *orptr;
71};
72
73// the format structure used by this receptionist
74struct formatinfo_t {
75 void clear();
76 formatinfo_t () {clear();}
77
78 bool DocumentImages;
79 bool DocumentTitles;
80 text_t DocumentHeading;
81 bool DocumentContents;
82 bool DocumentArrowsBottom;
83 text_tarray DocumentButtons;
84 text_t DocumentText;
85 text_tmap formatstrings;
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
102text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
103 const text_t &link, const text_t &icon);
104
105text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr);
106
107text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
108 const text_t &text);
109
110text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
111 const text_t &link, const text_t &icon, const text_t &text);
112
113text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
114 const text_t &link, const text_t &icon, bool highlight);
115
116text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
117 const text_t &link, const text_t &icon,
118 const text_t &text, bool highlight);
119
120
121#endif
Note: See TracBrowser for help on using the repository browser.