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 199 1999-03-11 00:11:19Z rjmcnab $
|
---|
9 | *
|
---|
10 | *********************************************************************/
|
---|
11 |
|
---|
12 | /*
|
---|
13 | $Log$
|
---|
14 | Revision 1.4 1999/03/11 00:11:19 rjmcnab
|
---|
15 | Added a function to get a string version of comerror_t
|
---|
16 |
|
---|
17 | Revision 1.3 1999/03/09 21:00:47 rjmcnab
|
---|
18 | Reorganised the statusaction, added more functions to comtypes.
|
---|
19 |
|
---|
20 | Revision 1.2 1999/03/04 21:19:15 rjmcnab
|
---|
21 |
|
---|
22 | Added clear() functions to all the data types.
|
---|
23 |
|
---|
24 | Revision 1.1 1999/02/21 22:35:25 rjmcnab
|
---|
25 |
|
---|
26 | Initial revision.
|
---|
27 |
|
---|
28 | */
|
---|
29 |
|
---|
30 |
|
---|
31 | #include "comtypes.h"
|
---|
32 |
|
---|
33 |
|
---|
34 | text_t get_comerror_string (comerror_t err) {
|
---|
35 | if (err == noError) return "no error";
|
---|
36 | else if (err == authenticationFailure) return "authentication failure";
|
---|
37 | else if (err == protocolError) return "protocol error";
|
---|
38 | else if (err == systemProblem) return "system problem";
|
---|
39 |
|
---|
40 | return "unknown problem";
|
---|
41 | }
|
---|
42 |
|
---|
43 |
|
---|
44 | void ShortColInfo_t::clear() {
|
---|
45 | name.clear();
|
---|
46 | host.clear();
|
---|
47 | port = 0;
|
---|
48 | }
|
---|
49 |
|
---|
50 | void ColInfoResponse_t::clear () {
|
---|
51 | shortInfo.clear();
|
---|
52 | isPublic=false;
|
---|
53 | isBeta=false;
|
---|
54 | buildDate=0;
|
---|
55 | numDocs=0;
|
---|
56 | numWords=0;
|
---|
57 | numBytes=0;
|
---|
58 | }
|
---|
59 |
|
---|
60 | void FilterOption_t::clear () {
|
---|
61 | name.clear();
|
---|
62 | type = booleant;
|
---|
63 | repeatable = onePerQuery;
|
---|
64 | defaultValue.clear();
|
---|
65 | validValues.erase(validValues.begin(), validValues.end());
|
---|
66 | }
|
---|
67 |
|
---|
68 | void FilterOption_t::check_defaultValue () {
|
---|
69 | if (validValues.empty()) {
|
---|
70 | // nothing to check against
|
---|
71 | defaultValue.clear();
|
---|
72 | return;
|
---|
73 | }
|
---|
74 |
|
---|
75 | text_tarray::iterator here = validValues.begin ();
|
---|
76 | text_tarray::iterator end = validValues.end ();
|
---|
77 | while (here != end) {
|
---|
78 | if (*here == defaultValue) {
|
---|
79 | // found the default value in the list of valid values
|
---|
80 | // now there is nothing more to do
|
---|
81 | return;
|
---|
82 | }
|
---|
83 |
|
---|
84 | here++;
|
---|
85 | }
|
---|
86 |
|
---|
87 | // did not find the defaultValue, set it to be the
|
---|
88 | // first option in the list
|
---|
89 | defaultValue = validValues[0];
|
---|
90 | }
|
---|
91 |
|
---|
92 | void FilterDescript_t::clear () {
|
---|
93 | filterName.clear();
|
---|
94 | filterOptions.erase(filterOptions.begin(), filterOptions.end());
|
---|
95 | }
|
---|
96 |
|
---|
97 | void InfoFilterOptionsResponse_t::clear () {
|
---|
98 | filterOptions.erase(filterOptions.begin(), filterOptions.end());
|
---|
99 | }
|
---|
100 |
|
---|
101 | void OptionValue_t::clear () {
|
---|
102 | name.clear();
|
---|
103 | value.clear();
|
---|
104 | }
|
---|
105 |
|
---|
106 | void FilterRequest_t::clear () {
|
---|
107 | filterName.clear();
|
---|
108 | filterOptions.erase(filterOptions.begin(), filterOptions.end());
|
---|
109 | docSet.erase(docSet.begin(), docSet.end());
|
---|
110 | filterResultOptions = 0;
|
---|
111 | }
|
---|
112 |
|
---|
113 | void TermInfo_t::clear () {
|
---|
114 | term.clear();
|
---|
115 | freq = 0;
|
---|
116 | matchTerms.erase (matchTerms.begin(), matchTerms.end());
|
---|
117 | }
|
---|
118 |
|
---|
119 |
|
---|
120 | void ResultDocInfo_t::clear () {
|
---|
121 | OID.clear ();
|
---|
122 | subCol.erase (subCol.begin(), subCol.end());
|
---|
123 | ranking = 0.0;
|
---|
124 | docFreq.erase(docFreq.begin(), docFreq.end());
|
---|
125 | }
|
---|
126 |
|
---|
127 | ResultDocInfo_t &ResultDocInfo_t::operator=(const ResultDocInfo_t &x) {
|
---|
128 | OID=x.OID;
|
---|
129 | subCol=x.subCol;
|
---|
130 | ranking=x.ranking;
|
---|
131 | docFreq=x.docFreq;
|
---|
132 | return *this;
|
---|
133 | }
|
---|
134 |
|
---|
135 |
|
---|
136 | void FilterResponse_t::clear () {
|
---|
137 | docsFound = 0;
|
---|
138 | isApprox = false;
|
---|
139 | termInfo.erase (termInfo.begin(), termInfo.end());
|
---|
140 | docInfo.erase (docInfo.begin(), docInfo.end());
|
---|
141 | }
|
---|
142 |
|
---|
143 | void MetadataInfoResponse_t::clear () {
|
---|
144 | supportedFields.erase (supportedFields.begin(), supportedFields.end());
|
---|
145 | supportedLanguages.erase (supportedLanguages.begin(), supportedLanguages.end());
|
---|
146 | }
|
---|
147 |
|
---|
148 | void MetadataRequest_t::clear () {
|
---|
149 | OIDs.erase (OIDs.begin(), OIDs.end());
|
---|
150 | fields.erase (fields.begin(), fields.end());
|
---|
151 | languages.erase (languages.begin(), languages.end());
|
---|
152 | }
|
---|
153 |
|
---|
154 | void MetadataResponse_t::clear () {
|
---|
155 | metadata.erase (metadata.begin(), metadata.end());
|
---|
156 | };
|
---|
157 |
|
---|