source: trunk/gsdl/src/recpt/comtypes.cpp@ 272

Last change on this file since 272 was 272, checked in by sjboddie, 25 years ago

Few changes to get getParents filter option to return metadata of parents
as well as current OID

  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 KB
Line 
1/**********************************************************************
2 *
3 * comtypes.cpp --
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * PUT COPYRIGHT NOTICE HERE
7 *
8 * $Id: comtypes.cpp 272 1999-06-16 02:01:22Z sjboddie $
9 *
10 *********************************************************************/
11
12/*
13 $Log$
14 Revision 1.9 1999/06/16 02:01:22 sjboddie
15 Few changes to get getParents filter option to return metadata of parents
16 as well as current OID
17
18 Revision 1.8 1999/05/10 03:40:33 sjboddie
19 lots of changes - slowly getting document action sorted out
20
21 Revision 1.7 1999/04/21 05:23:14 sjboddie
22
23 Changed the way metadata is returned
24
25 Revision 1.6 1999/04/06 22:20:34 rjmcnab
26 Got browsefilter working.
27
28 Revision 1.5 1999/03/31 23:44:47 rjmcnab
29 Altered the protocol so that the metadata is part of the filter.
30
31 Revision 1.4 1999/03/11 00:11:19 rjmcnab
32 Added a function to get a string version of comerror_t
33
34 Revision 1.3 1999/03/09 21:00:47 rjmcnab
35 Reorganised the statusaction, added more functions to comtypes.
36
37 Revision 1.2 1999/03/04 21:19:15 rjmcnab
38
39 Added clear() functions to all the data types.
40
41 Revision 1.1 1999/02/21 22:35:25 rjmcnab
42
43 Initial revision.
44
45 */
46
47
48#include "comtypes.h"
49
50
51text_t get_comerror_string (comerror_t err) {
52 if (err == noError) return "no error";
53 else if (err == authenticationFailure) return "authentication failure";
54 else if (err == protocolError) return "protocol error";
55 else if (err == configurationError) return "configuration error";
56 else if (err == systemProblem) return "system problem";
57
58 return "unknown problem";
59}
60
61
62void ShortColInfo_t::clear() {
63 name.clear();
64 host.clear();
65 port = 0;
66}
67
68void ColInfoResponse_t::clear () {
69 shortInfo.clear();
70 isPublic=false;
71 isBeta=false;
72 buildDate=0;
73 numDocs=0;
74 numWords=0;
75 numBytes=0;
76}
77
78void InfoFiltersResponse_t::clear () {
79 filterNames.erase(filterNames.begin(), filterNames.end());
80}
81
82
83void InfoFilterOptionsRequest_t::clear () {
84 filterName.clear();
85}
86
87
88void FilterOption_t::clear () {
89 name.clear();
90 type = booleant;
91 repeatable = onePerQuery;
92 defaultValue.clear();
93 validValues.erase(validValues.begin(), validValues.end());
94}
95
96void FilterOption_t::check_defaultValue () {
97 text_tarray::iterator here, end;
98
99 // how the default is interpreted depends on the option type
100 switch (type) {
101 case booleant:
102 case enumeratedt: // has to be one of the validValues
103 here = validValues.begin ();
104 end = validValues.end ();
105 while (here != end) {
106 if (*here == defaultValue) return;
107 here++;
108 }
109
110 break;
111
112 case integert: // has to be in the validValues range
113 if ((validValues.size() >= 2) &&
114 (validValues[0].getint() <= defaultValue.getint()) &&
115 (validValues[1].getint() >= defaultValue.getint()))
116 return;
117 break;
118
119 case stringt: // any value is valid
120 return;
121 }
122
123 // did not find the defaultValue
124 if (validValues.empty()) defaultValue.clear();
125 else defaultValue = validValues[0];
126}
127
128
129void InfoFilterOptionsResponse_t::clear () {
130 filterOptions.erase(filterOptions.begin(), filterOptions.end());
131}
132
133
134void OptionValue_t::clear () {
135 name.clear();
136 value.clear();
137}
138
139
140void FilterRequest_t::clear () {
141 filterName.clear();
142 filterOptions.erase(filterOptions.begin(), filterOptions.end());
143 docSet.erase(docSet.begin(), docSet.end());
144 filterResultOptions = 0;
145 requestParams.clear();
146 refParams.clear();
147 fields.erase(fields.begin(), fields.end());
148 getParents = false;
149}
150
151
152void TermInfo_t::clear () {
153 term.clear();
154 freq = 0;
155 matchTerms.erase (matchTerms.begin(), matchTerms.end());
156}
157
158
159void MetadataInfo_t::clear () {
160 params.clear();
161 isRef = false;
162 values.erase(values.begin(), values.end());
163}
164
165
166void ResultDocInfo_t::clear () {
167 OID.clear ();
168 ranking = 0;
169 docFreq.erase(docFreq.begin(), docFreq.end());
170 metadata.erase(metadata.begin(), metadata.end());
171}
172
173ResultDocInfo_t &ResultDocInfo_t::operator=(const ResultDocInfo_t &x) {
174 OID=x.OID;
175 ranking=x.ranking;
176 docFreq=x.docFreq;
177 metadata=x.metadata;
178 return *this;
179}
180
181
182void FilterResponse_t::clear () {
183 numDocs = 0;
184 isApprox = false;
185 termInfo.erase (termInfo.begin(), termInfo.end());
186 docInfo.erase (docInfo.begin(), docInfo.end());
187}
188
189
190void DocumentRequest_t::clear () {
191 OID.clear();
192 docType.clear();
193 docFormat.clear();
194}
195
196void DocumentResponse_t::clear () {
197 doc.clear();
198}
199
200
201
Note: See TracBrowser for help on using the repository browser.