Ignore:
Timestamp:
1999-04-07T10:20:35+12:00 (25 years ago)
Author:
rjmcnab
Message:

Got browsefilter working.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/comtypes.cpp

    r220 r226  
    1212/*
    1313   $Log$
     14   Revision 1.6  1999/04/06 22:20:34  rjmcnab
     15   Got browsefilter working.
     16
    1417   Revision 1.5  1999/03/31 23:44:47  rjmcnab
    1518   Altered the protocol so that the metadata is part of the filter.
     
    3942  else if (err == authenticationFailure) return "authentication failure";
    4043  else if (err == protocolError) return "protocol error";
     44  else if (err == configurationError) return "configuration error";
    4145  else if (err == systemProblem) return "system problem";
    4246
     
    9498
    9599void FilterOption_t::check_defaultValue () {
    96   if (validValues.empty()) {
    97     // nothing to check against
    98     defaultValue.clear();
    99     return;
     100  text_tarray::iterator here, end;
     101
     102  // how the default is interpreted depends on the option type
     103  switch (type) {
     104  case booleant:
     105  case enumeratedt: // has to be one of the validValues
     106    here = validValues.begin ();
     107    end = validValues.end ();
     108    while (here != end) {
     109      if (*here == defaultValue) return;
     110      here++;
     111    }
     112   
     113    break;
     114
     115  case integert: // has to be in the validValues range
     116    if ((validValues.size() >= 2) &&
     117    (validValues[0].getint() <= defaultValue.getint()) &&
     118    (validValues[1].getint() >= defaultValue.getint()))
     119      return;
     120    break;
     121
     122  case stringt: // any value is valid
     123    return;
    100124  }
    101125
    102   text_tarray::iterator here = validValues.begin ();
    103   text_tarray::iterator end = validValues.end ();
    104   while (here != end) {
    105     if (*here == defaultValue) {
    106       // found the default value in the list of valid values
    107       // now there is nothing more to do
    108       return;
    109     }
    110 
    111     here++;
    112   }
    113 
    114   // did not find the defaultValue, set it to be the
    115   // first option in the list
    116   defaultValue = validValues[0];
     126  // did not find the defaultValue
     127  if (validValues.empty()) defaultValue.clear();
     128  else defaultValue = validValues[0];
    117129}
    118130
Note: See TracChangeset for help on using the changeset viewer.