1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * source.cpp --
|
---|
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: source.cpp 650 1999-10-10 08:20:37Z sjboddie $
|
---|
25 | *
|
---|
26 | *********************************************************************/
|
---|
27 |
|
---|
28 | /*
|
---|
29 | $Log$
|
---|
30 | Revision 1.8 1999/10/10 08:20:36 sjboddie
|
---|
31 | - metadata now returns map rather than array
|
---|
32 | - redesigned browsing support (although it's not finished so
|
---|
33 | won't currently work ;-)
|
---|
34 |
|
---|
35 | Revision 1.7 1999/09/07 04:57:25 sjboddie
|
---|
36 | added gpl notice
|
---|
37 |
|
---|
38 | Revision 1.6 1999/08/31 22:49:01 rjmcnab
|
---|
39 | Changes for AIX.
|
---|
40 |
|
---|
41 | Revision 1.5 1999/06/16 02:00:33 sjboddie
|
---|
42 | Few changes to get getParent filter option to return metadata of
|
---|
43 | parents as well as current OID
|
---|
44 |
|
---|
45 | Revision 1.4 1999/05/10 03:43:49 sjboddie
|
---|
46 | lots of changes to lots of files - getting document action going
|
---|
47 |
|
---|
48 | Revision 1.3 1999/04/30 02:00:48 sjboddie
|
---|
49 | lots of stuff to do with getting documentaction working
|
---|
50 |
|
---|
51 | Revision 1.2 1999/04/06 22:20:32 rjmcnab
|
---|
52 | Got browsefilter working.
|
---|
53 |
|
---|
54 | Revision 1.1 1999/03/31 23:43:40 rjmcnab
|
---|
55 | Initial revision
|
---|
56 |
|
---|
57 | */
|
---|
58 |
|
---|
59 |
|
---|
60 | #include "source.h"
|
---|
61 | #include <assert.h>
|
---|
62 |
|
---|
63 |
|
---|
64 | // default constructor does nothing
|
---|
65 | sourceclass::sourceclass () {
|
---|
66 | }
|
---|
67 |
|
---|
68 | // default destructor does nothing
|
---|
69 | sourceclass::~sourceclass () {
|
---|
70 | }
|
---|
71 |
|
---|
72 | // configure should be called once for each configuration line
|
---|
73 | // default does nothing
|
---|
74 | void sourceclass::configure (const text_t &/*key*/, const text_tarray &/*cfgline*/) {
|
---|
75 | }
|
---|
76 |
|
---|
77 | // init should be called after all the configuration is done but
|
---|
78 | // before any other methods are called
|
---|
79 | // default does nothing
|
---|
80 | bool sourceclass::init (ostream &/*logout*/) {
|
---|
81 | return true;
|
---|
82 | }
|
---|
83 |
|
---|
84 |
|
---|
85 | // translate_OID translates OIDs using ".pr", ."fc" etc.
|
---|
86 | bool sourceclass::translate_OID (const text_t &/*OIDin*/, text_t &/*OIDout*/,
|
---|
87 | comerror_t &err, ostream &/*logout*/) {
|
---|
88 | err = noError;
|
---|
89 |
|
---|
90 | return false;
|
---|
91 | }
|
---|
92 |
|
---|
93 |
|
---|
94 | // get_metadata fills out the metadata if possible, if it is not responsable
|
---|
95 | // for the given OID then it will return false.
|
---|
96 | bool sourceclass::get_metadata (const text_t &/*requestParams*/, const text_t &/*refParams*/,
|
---|
97 | bool /*getParents*/, const text_tset &/*fields*/,
|
---|
98 | const text_t &/*OID*/, MetadataInfo_tmap &metadata,
|
---|
99 | comerror_t &err, ostream &/*logout*/) {
|
---|
100 | metadata.erase(metadata.begin(), metadata.end());
|
---|
101 | err = noError;
|
---|
102 |
|
---|
103 | return false;
|
---|
104 | }
|
---|
105 |
|
---|
106 | bool sourceclass::get_document (const text_t &/*OID*/, text_t &/*doc*/,
|
---|
107 | comerror_t &err, ostream &/*logout*/) {
|
---|
108 | err = noError;
|
---|
109 |
|
---|
110 | return false;
|
---|
111 | }
|
---|
112 |
|
---|
113 |
|
---|
114 | bool operator==(const sourceptr &x, const sourceptr &y) {
|
---|
115 | return (x.s == y.s);
|
---|
116 | }
|
---|
117 |
|
---|
118 | bool operator<(const sourceptr &x, const sourceptr &y) {
|
---|
119 | return (x.s < y.s);
|
---|
120 | }
|
---|
121 |
|
---|
122 |
|
---|
123 | // thesource remains the property of the calling code but
|
---|
124 | // should not be deleted until it is removed from this list.
|
---|
125 | void sourcelistclass::addsource (sourceclass *thesource) {
|
---|
126 | // can't add a source that doesn't exist
|
---|
127 | assert (thesource != NULL);
|
---|
128 | if (thesource == NULL) return;
|
---|
129 |
|
---|
130 | sourceptr sp;
|
---|
131 | sp.s = thesource;
|
---|
132 |
|
---|
133 | sourceptrs.push_back(sp);
|
---|
134 | }
|
---|