source: branches/z3950-branch/gsdl/src/recpt/browserclass.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: 5.2 KB
Line 
1/**********************************************************************
2 *
3 * browserclass.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 BROWSERCLASS_H
28#define BROWSERCLASS_H
29
30#include "gsdlconf.h"
31#include "text_t.h"
32#include "cgiargs.h"
33#include "display.h"
34#include "recptproto.h"
35#include "formattools.h"
36
37#if defined(GSDL_USE_OBJECTSPACE)
38# include <ospace\std\iostream>
39#elif defined(GSDL_USE_IOS_H)
40# include <iostream.h>
41#else
42# include <iostream>
43#endif
44
45
46class browserclass {
47protected:
48
49public:
50 browserclass ();
51 virtual ~browserclass ();
52
53 // configure should be called once for each configuration line
54 virtual void configure (const text_t &key, const text_tarray &cfgline);
55
56 // init should be called after all the configuration is done but
57 // before any other methods are called
58 virtual bool init (ostream &logout);
59
60 // returns the name that specifies the browserclass type
61 virtual text_t get_browser_name ();
62
63 virtual void processOID (cgiargsclass &args, recptproto *collectproto, ostream &logout);
64
65 // load_metadata_defaults should be called before
66 // doing protocol call to get metadata for OID to
67 // be displayed by this browserclass. it adds fields
68 // to the metadata set that are needed by browserclass
69 // during display
70 virtual void load_metadata_defaults (text_tset &metadata);
71
72 virtual text_t get_default_formatstring ();
73
74 void set_filter_options (FilterRequest_t &request, cgiargsclass &args);
75
76 // returns the number of tabs to add before displaying the
77 // next section group
78 virtual int output_section_group (ResultDocInfo_t &section, cgiargsclass &args,
79 const text_t &collection, int colnumber,
80 format_t *formatlistptr, bool use_table,
81 text_tset &metadata, bool &getParents,
82 recptproto *collectproto, displayclass &disp,
83 outconvertclass &outconvert, ostream &textout,
84 ostream &logout);
85
86 virtual int output_section_group (FilterResponse_t &sections, cgiargsclass &args,
87 const text_t &collection, int colnumber,
88 format_t *formatlistptr, bool use_table,
89 text_tset &metadata, bool &getParents,
90 recptproto *collectproto, displayclass &disp,
91 outconvertclass &outconvert, ostream &textout,
92 ostream &logout);
93};
94
95
96// The browserptr function does not 'own' the browser. The
97// browser should be deleted by the code which created it.
98class browserptr {
99public:
100 browserclass *b;
101
102 browserptr () {b=NULL;}
103};
104
105bool operator==(const browserptr &x, const browserptr &y);
106bool operator<(const browserptr &x, const browserptr &y);
107
108typedef map<text_t, browserptr, lttext_t> browserptrmap;
109
110// contains a list of browsers indexed by their name
111class browsermapclass {
112protected:
113 browserptrmap browserptrs;
114 text_t defaultbrowser;
115
116public:
117 // type support for browserptrmap
118 typedef browserptrmap::iterator iterator;
119 typedef browserptrmap::const_iterator const_iterator;
120 typedef browserptrmap::reference reference;
121 typedef browserptrmap::const_reference const_reference;
122 typedef browserptrmap::size_type size_type;
123
124 typedef browserptrmap::difference_type difference_type;
125 typedef browserptrmap::const_reverse_iterator const_reverse_iterator;
126 typedef browserptrmap::reverse_iterator reverse_iterator;
127
128 // basic container support
129 iterator begin () {return browserptrs.begin();}
130 const_iterator begin () const {return browserptrs.begin();}
131 iterator end () {return browserptrs.end();}
132 const_iterator end () const {return browserptrs.end();}
133
134 void erase(iterator pos) {browserptrs.erase(pos);}
135 void erase(iterator first, iterator last) {browserptrs.erase(first, last);}
136 browsermapclass &operator=(const browsermapclass &x) {browserptrs=x.browserptrs;return *this;}
137
138 bool empty () const {return browserptrs.empty();}
139 size_type size() const {return browserptrs.size();}
140
141
142 // added functionality
143 void clear () {browserptrs.erase(browserptrs.begin(),browserptrs.end());}
144
145 // thebrowserclass remains the property of the calling code but
146 // should not be deleted until it is removed from this list.
147 void addbrowser (browserclass *thebrowserclass);
148
149 // getbrowser will return NULL if the browser could not be found
150 browserclass *getbrowser (const text_t &key);
151
152 void setdefaultbrowser (const text_t &browsername);
153
154 browserclass *get_default_browser ();
155};
156
157
158#endif
Note: See TracBrowser for help on using the repository browser.