Ignore:
Timestamp:
1999-08-25T16:50:00+12:00 (25 years ago)
Author:
sjboddie
Message:

changed FilterRequest_t::docSet into an array

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/colservr/filter.cpp

    r398 r472  
    1212/*
    1313   $Log$
     14   Revision 1.7  1999/08/25 04:49:33  sjboddie
     15   changed FilterRequest_t::docSet into an array
     16
    1417   Revision 1.6  1999/07/16 03:42:23  sjboddie
    1518   changed isApprox
     
    111114      (request.filterResultOptions & FRmetadata)) {
    112115    // copy the OIDs from the request to the response
    113     text_tset::const_iterator here = request.docSet.begin();
    114     text_tset::const_iterator end = request.docSet.end();
     116    text_tarray::const_iterator here = request.docSet.begin();
     117    text_tarray::const_iterator end = request.docSet.end();
    115118    while (here != end) {
    116119      resultdoc.OID = (*here);
     
    244247}
    245248
     249void intersect (text_tarray &set1, const text_tarray &set2) {
     250  text_tarray resultset;
     251
     252  text_tarray::const_iterator set1_here = set1.begin();
     253  text_tarray::const_iterator set1_end = set1.end();
     254
     255  while (set1_here != set1_end) {
     256    if (in_set (set2, *set1_here))
     257      resultset.push_back (*set1_here);
     258    set1_here ++;
     259  }
     260  set1 = resultset;
     261}
    246262
    247263// tests to see if el is in set
     
    267283  return false;
    268284}
     285
     286bool in_set (const text_tarray &set1, const text_t &el) {
     287  text_t::const_iterator here = el.begin();
     288  text_t::const_iterator end = el.begin();
     289  text_t tryel, tryel_add;
     290  bool first = true;
     291
     292  // the element is in the set if any of its parents are
     293  // in the set
     294  do {
     295    // get next possible element to try
     296    here = getdelimitstr (here, end, '.', tryel_add);
     297    if (!first) tryel += ".";
     298    first = false;
     299    tryel += tryel_add;
     300
     301    // see if this element is in the set
     302    text_tarray::const_iterator here = set1.begin();
     303    text_tarray::const_iterator end = set1.end();
     304    while (here != end) {
     305      if (*here == tryel) break;
     306      here ++;
     307    }
     308    if (here != end) return true;
     309  } while (here != end);
     310
     311  return false;
     312}
Note: See TracChangeset for help on using the changeset viewer.