[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 | * $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 |
|
---|
[670] | 35 | enum command_t {comIf, comOr, comMeta, comText, comLink, comEndLink, comNum, comIcon,
|
---|
| 36 | comDoc, comHighlight, comEndHighlight};
|
---|
[649] | 37 | enum pcommand_t {pNone, pImmediate, pTop, pAll};
|
---|
[347] | 38 | enum dcommand_t {dMeta};
|
---|
[462] | 39 | enum mcommand_t {mNone, mCgiSafe};
|
---|
[347] | 40 |
|
---|
| 41 | struct metadata_t {
|
---|
| 42 | void clear();
|
---|
| 43 | metadata_t () {clear();}
|
---|
| 44 |
|
---|
[410] | 45 | text_t metaname;
|
---|
[462] | 46 | mcommand_t metacommand;
|
---|
[347] | 47 | pcommand_t parentcommand;
|
---|
| 48 | text_t parentoptions;
|
---|
| 49 | };
|
---|
| 50 |
|
---|
| 51 | struct decision_t {
|
---|
| 52 | void clear();
|
---|
| 53 | decision_t () {clear();}
|
---|
| 54 |
|
---|
| 55 | dcommand_t command;
|
---|
| 56 | metadata_t meta;
|
---|
| 57 | };
|
---|
| 58 |
|
---|
| 59 | struct 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 |
|
---|
[442] | 73 | // the format structure used by this receptionist
|
---|
| 74 | struct formatinfo_t {
|
---|
| 75 | void clear();
|
---|
| 76 | formatinfo_t () {clear();}
|
---|
[347] | 77 |
|
---|
[442] | 78 | bool DocumentImages;
|
---|
[670] | 79 | bool DocumentTitles;
|
---|
[442] | 80 | text_t DocumentHeading;
|
---|
[670] | 81 | bool DocumentContents;
|
---|
[442] | 82 | bool DocumentArrowsBottom;
|
---|
| 83 | text_tarray DocumentButtons;
|
---|
| 84 | text_t DocumentText;
|
---|
[649] | 85 | text_tmap formatstrings;
|
---|
[442] | 86 | };
|
---|
| 87 |
|
---|
[749] | 88 | bool is_table_content (const text_t &formatstring);
|
---|
| 89 | bool is_table_content (const format_t *formatlistptr);
|
---|
| 90 |
|
---|
[649] | 91 | bool get_formatstring (const text_t &key, const text_tmap &formatstringmap,
|
---|
| 92 | text_t &formatstring);
|
---|
| 93 | bool get_formatstring (const text_t &key1, const text_t &key2,
|
---|
| 94 | const text_tmap &formatstringmap,
|
---|
| 95 | text_t &formatstring);
|
---|
[442] | 96 |
|
---|
[422] | 97 | text_t format_date (const text_t &date);
|
---|
[347] | 98 |
|
---|
| 99 | bool parse_formatstring (const text_t &formatstring, format_t *formatlistptr,
|
---|
[649] | 100 | text_tset &metadata, bool &getParents);
|
---|
[347] | 101 |
|
---|
[649] | 102 | text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
|
---|
[407] | 103 | const text_t &link, const text_t &icon);
|
---|
| 104 |
|
---|
[649] | 105 | text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr);
|
---|
[347] | 106 |
|
---|
[649] | 107 | text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
|
---|
[442] | 108 | const text_t &text);
|
---|
[347] | 109 |
|
---|
[649] | 110 | text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
|
---|
[442] | 111 | const text_t &link, const text_t &icon, const text_t &text);
|
---|
| 112 |
|
---|
[670] | 113 | text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
|
---|
| 114 | const text_t &link, const text_t &icon, bool highlight);
|
---|
[442] | 115 |
|
---|
[670] | 116 | text_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 |
|
---|
[347] | 121 | #endif
|
---|