home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / NeoIntroTCL3.0 folder / TCL / Laughs / Includes / CNameIndex.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-07  |  2.0 KB  |  64 lines  |  [TEXT/MMCC]

  1. /************************************************************
  2.  *
  3.  *    Created: Sunday, January 20, 1991 4:11:08 PM
  4.  *    CNameIndex.h
  5.  *    C++ class definition for file index objects
  6.  *
  7.  *    Copyright Neologic Systems 1992
  8.  *    All rights reserved
  9.  *
  10.  * Within a class, references to permanent objects are kept in a sorted list called a
  11.  * file index. The default sorting order in an index is ascending by ID value, however
  12.  * other sorting orders are possible. The class CNameIndex implements a sample
  13.  * secondary index.
  14.  *
  15.  ***********************************************************/
  16. #pragma once            /* Include this file only once */
  17. #ifndef __CNameIndex__
  18. #define __CNameIndex__ 1
  19.  
  20. #include "NeoTypes.h"
  21. #include CNeoNodeH
  22.  
  23. typedef struct {
  24.     NeoID            fID;                    // identity of the offspring this entry refers to
  25.     CNeoString        fName;                    // name of the offspring this entry refers to
  26. } NameIndexEntry;
  27.  
  28. const NeoID    kNameIndexID    = 20;
  29.  
  30. class CNameIndex : public CNeoNode {
  31. public:
  32.                         /** Instance Methods **/
  33.                         CNameIndex(const short aCount, CNeoNode *aParent, const NeoID aID);
  34.     static CNeoPersist *New(void);
  35.     virtual NeoID        getClassID(void) const;
  36.     virtual OSErr        getEntryValue(const short aIndex, const NeoTag aName, const NeoTag aType, void *aValue);
  37.     virtual long        getFileLength(void) const;
  38.     virtual long        getLength(void) const;
  39.  
  40.                         /** I/O Methods **/
  41.     virtual void        readObject(CNeoStream *aStream, const NeoTag aTag);
  42.     virtual void        writeObject(CNeoStream *aStream, const NeoTag aTag);
  43.  
  44.                         /** Object List Management Methods **/
  45.     virtual CNeoPersist *
  46.                         getObject(const short aIndex);
  47.     virtual CNeoNode *    insertObject(const short aIndex, CNeoPersist *aObject);
  48.     static void *        KeyManager(const NeoKeyOp aOp, ...);
  49.  
  50.                         /** Entry Methods **/
  51.     virtual short        getEntrySize(void) const;
  52.  
  53. protected:
  54. #ifdef qNeoDebug
  55.                         /** Debugging Methods **/
  56.     virtual const void *verify(const void *aValue) const;
  57. #endif
  58.  
  59.                         /** Instance Variables **/
  60. public:
  61.     NameIndexEntry        fEntry[kNeoDefaultNodeEntryCount];            // references to objects in the list
  62. };
  63. #endif
  64.