home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / pascal / rehack / contain / sortlist.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-21  |  490 b   |  32 lines

  1. #include "sortlist.h"
  2.  
  3. int sorted_index::find(sortable &arg)
  4.  {
  5.   rewind();
  6.   while (data != NULL && *value() < arg)
  7.     (*this)++;
  8.   return data != NULL;
  9.  }
  10.  
  11. void sorted_list::put(containable *arg)
  12.  {
  13.   sorted_index i(*this);
  14.  
  15.   i.find(*(sortable *)arg);
  16.   if (i == 0)
  17.     i.to_end();
  18.    else
  19.     i--;
  20.   i.put(arg);
  21.  }
  22.  
  23. sortable *sorted_list::find(sortable &arg)
  24.  {
  25.   sorted_index i(*this);
  26.   if (i.find(arg))
  27.     return i.value();
  28.    else
  29.     return NULL;
  30.  }
  31.  
  32.