home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / TEKST / TXI2IPF1 / SOURCE.ZIP / gen / String_Name_Map.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1993-02-04  |  2.2 KB  |  74 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. // $Id: String_Name_Map.cc,v 1.1.1.1 1993/02/04 15:18:12 ak Exp $
  3. ///////////////////////////////////////////////////////////////////////////////
  4. // $Log: String_Name_Map.cc,v $
  5. // Revision 1.1.1.1  1993/02/04  15:18:12  ak
  6. // Please Edit this file to contain the RCS log information
  7. // to be associated with this file (please remove these lines)
  8. //
  9. // Revision 1.1  1993/02/04  15:18:10  ak
  10. // Initial revision
  11. //
  12. ///////////////////////////////////////////////////////////////////////////////
  13.  
  14. static char *rcsid = "$Id: String_Name_Map.cc,v 1.1.1.1 1993/02/04 15:18:12 ak Exp $";
  15.  
  16. // This may look like C code, but it is really -*- C++ -*-
  17. /*
  18. Copyright (C) 1988 Free Software Foundation
  19.     written by Doug Lea (dl@rocky.oswego.edu)
  20.  
  21. This file is part of the GNU C++ Library.  This library is free
  22. software; you can redistribute it and/or modify it under the terms of
  23. the GNU Library General Public License as published by the Free
  24. Software Foundation; either version 2 of the License, or (at your
  25. option) any later version.  This library is distributed in the hope
  26. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  27. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  28. PURPOSE.  See the GNU Library General Public License for more details.
  29. You should have received a copy of the GNU Library General Public
  30. License along with this library; if not, write to the Free Software
  31. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  32. */
  33.  
  34. #ifdef __GNUG__
  35. #pragma implementation
  36. #endif
  37. #include <builtin.h>
  38. #include "info.h"
  39.  
  40.  
  41. Pix StringNameMap::seek(String& item)
  42. {
  43.   for (Pix i = first(); i != 0 && !(StringEQ(key(i), item)); next(i));
  44.   return i;
  45. }
  46.  
  47. int StringNameMap::owns(Pix idx)
  48. {
  49.   if (idx == 0) return 0;
  50.   for (Pix i = first(); i; next(i)) if (i == idx) return 1;
  51.   return 0;
  52. }
  53.  
  54. void StringNameMap::clear()
  55. {
  56.   Pix i = first();
  57.   while (i != 0)
  58.   {
  59.     del(key(i));
  60.     i = first();
  61.   }
  62. }
  63.  
  64. int StringNameMap::contains (String& item)
  65. {
  66.   return seek(item) != 0;
  67. }
  68.  
  69.  
  70. void StringNameMap::error(const char* msg)
  71. {
  72.   (*lib_error_handler)("Map", msg);
  73. }
  74.