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

  1. /*****************************************************************************
  2.  * $Id: String_XClass_VHMap.h,v 1.1.1.1 1993/02/04 15:18:38 ak Exp $
  3.  *****************************************************************************
  4.  * $Log: String_XClass_VHMap.h,v $
  5.  * Revision 1.1.1.1  1993/02/04  15:18:38  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:36  ak
  10.  * Initial revision
  11.  *
  12.  *****************************************************************************/
  13.  
  14. // This may look like C code, but it is really -*- C++ -*-
  15. /*
  16. Copyright (C) 1988 Free Software Foundation
  17.     written by Doug Lea (dl@rocky.oswego.edu)
  18.  
  19. This file is part of the GNU C++ Library.  This library is free
  20. software; you can redistribute it and/or modify it under the terms of
  21. the GNU Library General Public License as published by the Free
  22. Software Foundation; either version 2 of the License, or (at your
  23. option) any later version.  This library is distributed in the hope
  24. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  25. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  26. PURPOSE.  See the GNU Library General Public License for more details.
  27. You should have received a copy of the GNU Library General Public
  28. License along with this library; if not, write to the Free Software
  29. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  30. */
  31.  
  32.  
  33. #ifndef _StringXClassVHMap_h
  34. #ifdef __GNUG__
  35. #pragma interface
  36. #endif
  37. #define _StringXClassVHMap_h 1
  38.  
  39. #include "String_XClass_Map.h"
  40.  
  41.  
  42. class StringXClassVHMap : public StringXClassMap
  43. {
  44. protected:
  45.   String*           tab;
  46.   XClass*           cont;
  47.   char*          status;
  48.   unsigned int   size;
  49.  
  50. public:
  51.                 StringXClassVHMap(XClass& dflt,unsigned int sz=DEFAULT_INITIAL_CAPACITY);
  52.                 StringXClassVHMap(StringXClassVHMap& a);
  53.                 ~StringXClassVHMap();
  54.  
  55.   XClass&          operator [] (String& key);
  56.  
  57.   void          del(String& key);
  58.  
  59.   Pix           first();
  60.   void          next(Pix& i);
  61.   String&          key(Pix i);
  62.   XClass&          contents(Pix i);
  63.  
  64.   Pix           seek(String& key);
  65.   int           contains(String& key);
  66.  
  67.   void          clear();
  68.   void          resize(unsigned int newsize = 0);
  69.  
  70.   int           OK();
  71. };
  72.  
  73. inline StringXClassVHMap::~StringXClassVHMap()
  74. {
  75.   delete [] tab;
  76.   delete [] cont;
  77.   delete [] status;
  78. }
  79.  
  80. inline int StringXClassVHMap::contains(String& key)
  81. {
  82.   return seek(key) != 0;
  83. }
  84.  
  85. inline String& StringXClassVHMap::key(Pix i)
  86. {
  87.   if (i == 0) error("null Pix");
  88.   return *((String*)i);
  89. }
  90.  
  91. inline XClass& StringXClassVHMap::contents(Pix i)
  92. {
  93.   if (i == 0) error("null Pix");
  94.   return cont[((unsigned)(i) - (unsigned)(tab)) / sizeof(String)];
  95. }
  96.  
  97. #endif
  98.