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