home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warphead.zip / H / TOKNTABL.H < prev    next >
C/C++ Source or Header  |  1997-02-28  |  4KB  |  133 lines

  1. /* @(#)Z 1.4 com/src/core/ToknTabl.h, odcore, od96os2, odos29646d 96/11/15 15:29:16 (96/10/29 09:21:50) */
  2. /*====START_GENERATED_PROLOG======================================
  3.  */
  4. /*
  5.  *   COMPONENT_NAME: odcore
  6.  *
  7.  *   CLASSES:   TokenTable
  8.  *
  9.  *   ORIGINS: 82,27
  10.  *
  11.  *
  12.  *   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  13.  *   All Rights Reserved
  14.  *   Licensed Materials - Property of IBM
  15.  *   US Government Users Restricted Rights - Use, duplication or
  16.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17.  *       
  18.  *   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  19.  *   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  20.  *   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  21.  *   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  22.  *   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  23.  *   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  24.  *   OR PERFORMANCE OF THIS SOFTWARE.
  25.  */
  26. /*====END_GENERATED_PROLOG========================================
  27.  */
  28.  
  29. /*
  30.     File:        ToknTabl.h
  31.  
  32.     Contains:    The TokenTable class.
  33.  
  34.     Owned by:    Nick Pilch
  35.  
  36.     Copyright:    ⌐ 1993 by Apple Computer, Inc., all rights reserved.
  37.  
  38.     Change History (most recent first):
  39.  
  40.          <4>     8/19/94    NP        1181622: Ownership fix.
  41.          <3>     7/29/94    CG        NameSpace API changes.
  42.          <2>     6/27/94    CG        Removed fEv - not thread safe.
  43.          <1>      6/7/94    CG        first checked in
  44.          <3>    11/15/93    NP        Changed ODSymbols to ODNameSpaceManager.
  45.          <2>    10/28/93    NP        GetType returns a boolean instead of
  46.                                     throwing an exception.
  47.          <1>    10/25/93    NP        first checked in
  48.          <4>      8/9/93    NP        Added class id string.
  49.          <3>     7/21/93    NP        Added a virtual keyword (temporary for
  50.                                     ASLM).
  51.          <2>     6/23/93    RCR        Moved ODTypeToken to ODTypes.h
  52.          <1>     6/22/93    NP        first checked in
  53.  
  54.     To Do:
  55. */
  56.  
  57. #ifndef _ODTOKNTABL_
  58. #define _ODTOKNTABL_
  59.  
  60. #ifndef _PLFMDEF_
  61. #include "PlfmDef.h"
  62. #endif
  63.  
  64. #ifndef _ODTYPES_
  65. #include "ODTypes.h"
  66. #endif
  67.  
  68. //==============================================================================
  69. // Theory of Operation
  70. //==============================================================================
  71.  
  72. /*
  73.     This class keeps a table of ODTypes and their corresponding unique tokens.
  74. */
  75.  
  76. //==============================================================================
  77. // Scalar Types
  78. //==============================================================================
  79.  
  80.  
  81. //==============================================================================
  82. // Classes defined in this interface
  83. //==============================================================================
  84.  
  85. class TokenTable;
  86.  
  87. //==============================================================================
  88. // Classes used by this interface
  89. //==============================================================================
  90.  
  91. class ODValueNameSpace;
  92. class ODNameSpaceManager;
  93.  
  94. //==============================================================================
  95. // ODClass
  96. //==============================================================================
  97.  
  98. #define kODTokenTableID "appl:TokenTable$class,1.0.0"
  99.  
  100. class TokenTable
  101. {
  102.   public:
  103.  
  104.     TokenTable(ODNameSpaceManager* mgr);
  105.     ODVMethod void Initialize();
  106.     virtual ~TokenTable();
  107.  
  108.     ODVMethod ODTypeToken    Tokenize(ODType type);
  109.         
  110.         // Returns a unique token for type. If the type was previously
  111.         //    tokenized, the original token is returned. Throws kODErrOutOfMemory
  112.         //    if tokenization fails.
  113.     
  114.     ODVMethod void            RemoveEntry(ODType type);
  115.         
  116.         // Removes type from the table. If type was not
  117.         //    previously tokenized, no error is signalled.
  118.     
  119.     ODVMethod ODBoolean    GetType(ODTypeToken token, ODType* type);
  120.         
  121.         // Returns type, given token. If token does not exist in the table,
  122.         //    kODFalse is returned. Otherwise, kODTrue is returned.
  123.     
  124.   protected:
  125.  
  126.     ODNameSpaceManager*    fNameSpaceManager;
  127.     ODValueNameSpace*    fNameSpace;
  128.     ODULong                fNextUniqueID;
  129. };
  130.  
  131.  
  132. #endif // _ODTOKNTABL_
  133.