source: trunk/gsdl/src/recpt/browserclass.h@ 1861

Last change on this file since 1861 was 1860, checked in by cs025, 23 years ago

Included CORBA branch for first time

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