modules/up/src/gnug++/int.int.Map.cc

/* [<][>]
[^][v][top][bottom][index][help] */

FUNCTIONS

This source file includes following functions.
  1. seek
  2. owns
  3. clear
  4. contains
  5. error

   1 // This may look like C code, but it is really -*- C++ -*-
   2 /* 
   3 Copyright (C) 1988 Free Software Foundation
   4     written by Doug Lea (dl@rocky.oswego.edu)
   5 
   6 This file is part of the GNU C++ Library.  This library is free
   7 software; you can redistribute it and/or modify it under the terms of
   8 the GNU Library General Public License as published by the Free
   9 Software Foundation; either version 2 of the License, or (at your
  10 option) any later version.  This library is distributed in the hope
  11 that it will be useful, but WITHOUT ANY WARRANTY; without even the
  12 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13 PURPOSE.  See the GNU Library General Public License for more details.
  14 You should have received a copy of the GNU Library General Public
  15 License along with this library; if not, write to the Free Software
  16 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  17 */
  18 
  19 #ifdef __GNUG__
  20 #pragma implementation
  21 #endif
  22 #include "config.h"
  23 #include <builtin.h>
  24 #include "int.int.Map.h"
  25 
  26 
  27 Pix intintMap::seek(int  item)
     /* [<][>][^][v][top][bottom][index][help] */
  28 {
  29    Pix i;
  30    for (i = first(); i != 0 && !(intEQ(key(i), item)); next(i));
  31    return i;
  32 }
  33 
  34 int intintMap::owns(Pix idx)
     /* [<][>][^][v][top][bottom][index][help] */
  35 {
  36   if (idx == 0) return 0;
  37   for (Pix i = first(); i; next(i)) if (i == idx) return 1;
  38   return 0;
  39 }
  40 
  41 void intintMap::clear()
     /* [<][>][^][v][top][bottom][index][help] */
  42 {
  43   Pix i = first(); 
  44   while (i != 0)
  45   {
  46     del(key(i));
  47     i = first();
  48   }
  49 }
  50 
  51 int intintMap::contains (int  item)
     /* [<][>][^][v][top][bottom][index][help] */
  52 {
  53   return seek(item) != 0;
  54 }
  55 
  56 
  57 void intintMap::error(const char* msg)
     /* [<][>][^][v][top][bottom][index][help] */
  58 {
  59   (*lib_error_handler)("Map", msg);
  60 }

/* [<][>][^][v][top][bottom][index][help] */