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

Last change on this file since 16347 was 15415, checked in by mdewsnip, 16 years ago

Removed an unnecessary inclusion of comtypes.h.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
RevLine 
[347]1/**********************************************************************
2 *
3 * formattools.h --
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
[533]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.
[347]9 *
[533]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 *
[347]24 *********************************************************************/
25
26
27#ifndef FORMATTOOLS_H
28#define FORMATTOOLS_H
29
30#include "text_t.h"
[1443]31#include "recptproto.h"
[1610]32#include "display.h"
[347]33
[670]34enum command_t {comIf, comOr, comMeta, comText, comLink, comEndLink, comNum, comIcon,
[4936]35 comDoc, comHighlight, comEndHighlight, comRel, comHref, comSummary,
36 comTOC, comImage, comDocumentButtonDetach, comDocumentButtonHighlight,
[13118]37 comDocumentButtonExpandContents, comDocumentButtonExpandText, comOID, comTopOID, comRank, comCollection};
[9401]38
[12567]39enum mcommand_t {mNone=0, mCgiSafe=1, mParent=2, mSibling=4, mChild=8, mSpecial=16};
[9401]40
[649]41enum pcommand_t {pNone, pImmediate, pTop, pAll};
[10415]42enum scommand_t {sNone, sAll, sNum};
[9401]43enum ccommand_t {cNone, cAll, cNum};
[1610]44enum dcommand_t {dMeta, dText};
[347]45
46struct metadata_t {
47 void clear();
48 metadata_t () {clear();}
49
[410]50 text_t metaname;
[5787]51 int metacommand; // used to hold flags from mcommand_t
[9401]52 struct {
53 pcommand_t parent;
54 scommand_t sibling;
55 ccommand_t child;
56 } mqualifier;
57
[10415]58 text_t parentoptions;
59 text_t siblingoptions;
60 text_t childoptions;
[347]61};
62
[1610]63
64// The decision component of an {If}{decision,true-text,false-text}
[7389]65// formatstring. The decision can be based on metadata or on text;
[1610]66// normally that text would be a macro like _cgiargmode_. --gordon
[347]67struct decision_t {
68 void clear();
69 decision_t () {clear();}
70
71 dcommand_t command;
72 metadata_t meta;
[1610]73 text_t text;
[347]74};
75
76struct format_t {
77 void clear();
78 format_t () {clear();}
79
80 command_t command;
81 decision_t decision;
82 text_t text;
83 metadata_t meta;
84 format_t *nextptr;
85 format_t *ifptr;
86 format_t *elseptr;
87 format_t *orptr;
88};
89
[442]90// the format structure used by this receptionist
91struct formatinfo_t {
92 void clear();
93 formatinfo_t () {clear();}
[347]94
[1079]95 bool DocumentImages;
96 bool DocumentTitles;
97 text_t DocumentHeading;
98 bool DocumentContents;
[442]99 bool DocumentArrowsBottom;
[4868]100 bool DocumentArrowsTop;
[13365]101 bool DocumentSearchResultLinks;
[442]102 text_tarray DocumentButtons;
103 text_t DocumentText;
[1941]104 //-----------------
105 text_t RelatedDocuments;
106 //----------------
[649]107 text_tmap formatstrings;
[868]108 bool DocumentUseHTML;
[4972]109 bool AllowExtendedOptions;
[442]110};
111
[749]112bool is_table_content (const text_t &formatstring);
113bool is_table_content (const format_t *formatlistptr);
114
[649]115bool get_formatstring (const text_t &key, const text_tmap &formatstringmap,
116 text_t &formatstring);
117bool get_formatstring (const text_t &key1, const text_t &key2,
118 const text_tmap &formatstringmap,
119 text_t &formatstring);
[442]120
[422]121text_t format_date (const text_t &date);
[347]122
[6645]123text_t remove_namespace(const text_t &meta_name);
124
[2001]125text_t iso639 (const text_t &langcode);
[1941]126
[2706]127text_t get_href (const text_t &link);
128
[1941]129text_t get_related_docs(const text_t& collection, recptproto* collectproto,
130 ResultDocInfo_t &docinfo, ostream& logout);
131
132
[347]133bool parse_formatstring (const text_t &formatstring, format_t *formatlistptr,
[649]134 text_tset &metadata, bool &getParents);
[347]135
[407]136
[347]137
[1443]138text_t get_formatted_string (const text_t& collection, recptproto* collectproto,
[1610]139 ResultDocInfo_t &docinfo, displayclass &disp,
[4906]140 format_t *formatlistptr, text_tmap &options,
[1443]141 ostream& logout);
[347]142
143#endif
[1443]144
145
Note: See TracBrowser for help on using the repository browser.