/********************************************************************** * * comtypes.cpp -- * Copyright (C) 1999 The New Zealand Digital Library Project * * PUT COPYRIGHT NOTICE HERE * * $Id: comtypes.cpp 459 1999-08-13 04:19:05Z sjboddie $ * *********************************************************************/ /* $Log$ Revision 1.16 1999/08/13 04:19:05 sjboddie added name attribute to metadata Revision 1.15 1999/08/03 03:31:43 sjboddie added ability to set receptionist from configuration files Revision 1.14 1999/07/16 03:41:29 sjboddie changed isApprox Revision 1.13 1999/07/08 20:46:45 rjmcnab Added the result number to the ResultDocInfo_t Revision 1.12 1999/07/07 06:11:33 rjmcnab Slight change for multiple phrase matching. Revision 1.11 1999/07/01 22:47:49 sjboddie added format option to collection info Revision 1.10 1999/06/29 22:05:01 rjmcnab Added a couple of fields to ResultDocInfo_t to handle a special version of mg. Revision 1.9 1999/06/16 02:01:22 sjboddie Few changes to get getParents filter option to return metadata of parents as well as current OID Revision 1.8 1999/05/10 03:40:33 sjboddie lots of changes - slowly getting document action sorted out Revision 1.7 1999/04/21 05:23:14 sjboddie Changed the way metadata is returned Revision 1.6 1999/04/06 22:20:34 rjmcnab Got browsefilter working. Revision 1.5 1999/03/31 23:44:47 rjmcnab Altered the protocol so that the metadata is part of the filter. Revision 1.4 1999/03/11 00:11:19 rjmcnab Added a function to get a string version of comerror_t Revision 1.3 1999/03/09 21:00:47 rjmcnab Reorganised the statusaction, added more functions to comtypes. Revision 1.2 1999/03/04 21:19:15 rjmcnab Added clear() functions to all the data types. Revision 1.1 1999/02/21 22:35:25 rjmcnab Initial revision. */ #include "comtypes.h" text_t get_comerror_string (comerror_t err) { if (err == noError) return "no error"; else if (err == authenticationFailure) return "authentication failure"; else if (err == protocolError) return "protocol error"; else if (err == configurationError) return "configuration error"; else if (err == systemProblem) return "system problem"; return "unknown problem"; } void ShortColInfo_t::clear() { name.clear(); host.clear(); port = 0; } void ColInfoResponse_t::clear () { shortInfo.clear(); isPublic=false; isBeta=false; buildDate=0; numDocs=0; numWords=0; numBytes=0; format.erase(format.begin(), format.end()); receptionist.clear(); } void InfoFiltersResponse_t::clear () { filterNames.erase(filterNames.begin(), filterNames.end()); } void InfoFilterOptionsRequest_t::clear () { filterName.clear(); } void FilterOption_t::clear () { name.clear(); type = booleant; repeatable = onePerQuery; defaultValue.clear(); validValues.erase(validValues.begin(), validValues.end()); } void FilterOption_t::check_defaultValue () { text_tarray::iterator here, end; // how the default is interpreted depends on the option type switch (type) { case booleant: case enumeratedt: // has to be one of the validValues here = validValues.begin (); end = validValues.end (); while (here != end) { if (*here == defaultValue) return; here++; } break; case integert: // has to be in the validValues range if ((validValues.size() >= 2) && (validValues[0].getint() <= defaultValue.getint()) && (validValues[1].getint() >= defaultValue.getint())) return; break; case stringt: // any value is valid return; } // did not find the defaultValue if (validValues.empty()) defaultValue.clear(); else defaultValue = validValues[0]; } void InfoFilterOptionsResponse_t::clear () { filterOptions.erase(filterOptions.begin(), filterOptions.end()); } void OptionValue_t::clear () { name.clear(); value.clear(); } void FilterRequest_t::clear () { filterName.clear(); filterOptions.erase(filterOptions.begin(), filterOptions.end()); docSet.erase(docSet.begin(), docSet.end()); filterResultOptions = 0; requestParams.clear(); refParams.clear(); fields.erase(fields.begin(), fields.end()); getParents = false; } void TermInfo_t::clear () { term.clear(); freq = 0; matchTerms.erase (matchTerms.begin(), matchTerms.end()); } void MetadataInfo_t::clear () { params.clear(); isRef = false; values.erase(values.begin(), values.end()); name.clear(); } void ResultDocInfo_t::clear () { OID.clear (); ranking = 0; result_num = 0; num_terms_matched = 0; num_phrase_match = 0; docFreq.erase(docFreq.begin(), docFreq.end()); metadata.erase(metadata.begin(), metadata.end()); } ResultDocInfo_t &ResultDocInfo_t::operator=(const ResultDocInfo_t &x) { OID=x.OID; ranking=x.ranking; result_num=x.result_num; num_terms_matched=x.num_terms_matched; num_phrase_match = x.num_phrase_match; docFreq=x.docFreq; metadata=x.metadata; return *this; } void FilterResponse_t::clear () { numDocs = 0; isApprox = Exact; termInfo.erase (termInfo.begin(), termInfo.end()); docInfo.erase (docInfo.begin(), docInfo.end()); } void DocumentRequest_t::clear () { OID.clear(); docType.clear(); docFormat.clear(); } void DocumentResponse_t::clear () { doc.clear(); }