home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / mfc / include / afxcoll.h < prev    next >
C/C++ Source or Header  |  1998-06-16  |  35KB  |  1,497 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. #ifndef __AFXCOLL_H__
  12. #define __AFXCOLL_H__
  13.  
  14. #ifndef __AFX_H__
  15.     #include <afx.h>
  16. #endif
  17.  
  18. #ifdef _AFX_MINREBUILD
  19. #pragma component(minrebuild, off)
  20. #endif
  21. #ifndef _AFX_FULLTYPEINFO
  22. #pragma component(mintypeinfo, on)
  23. #endif
  24.  
  25. #ifdef _AFX_PACKING
  26. #pragma pack(push, _AFX_PACKING)
  27. #endif
  28.  
  29. /////////////////////////////////////////////////////////////////////////////
  30. // Classes declared in this file
  31.  
  32. //CObject
  33.     // Arrays
  34.     class CByteArray;           // array of BYTE
  35.     class CWordArray;           // array of WORD
  36.     class CDWordArray;          // array of DWORD
  37.     class CUIntArray;           // array of UINT
  38.     class CPtrArray;            // array of void*
  39.     class CObArray;             // array of CObject*
  40.  
  41.     // Lists
  42.     class CPtrList;             // list of void*
  43.     class CObList;              // list of CObject*
  44.  
  45.     // Maps (aka Dictionaries)
  46.     class CMapWordToOb;         // map from WORD to CObject*
  47.     class CMapWordToPtr;        // map from WORD to void*
  48.     class CMapPtrToWord;        // map from void* to WORD
  49.     class CMapPtrToPtr;         // map from void* to void*
  50.  
  51.     // Special String variants
  52.     class CStringArray;         // array of CStrings
  53.     class CStringList;          // list of CStrings
  54.     class CMapStringToPtr;      // map from CString to void*
  55.     class CMapStringToOb;       // map from CString to CObject*
  56.     class CMapStringToString;   // map from CString to CString
  57.  
  58. /////////////////////////////////////////////////////////////////////////////
  59.  
  60. #undef AFX_DATA
  61. #define AFX_DATA AFX_CORE_DATA
  62.  
  63. ////////////////////////////////////////////////////////////////////////////
  64.  
  65. class CByteArray : public CObject
  66. {
  67.  
  68.     DECLARE_SERIAL(CByteArray)
  69. public:
  70.  
  71. // Construction
  72.     CByteArray();
  73.  
  74. // Attributes
  75.     int GetSize() const;
  76.     int GetUpperBound() const;
  77.     void SetSize(int nNewSize, int nGrowBy = -1);
  78.  
  79. // Operations
  80.     // Clean up
  81.     void FreeExtra();
  82.     void RemoveAll();
  83.  
  84.     // Accessing elements
  85.     BYTE GetAt(int nIndex) const;
  86.     void SetAt(int nIndex, BYTE newElement);
  87.  
  88.     BYTE& ElementAt(int nIndex);
  89.  
  90.     // Direct Access to the element data (may return NULL)
  91.     const BYTE* GetData() const;
  92.     BYTE* GetData();
  93.  
  94.     // Potentially growing the array
  95.     void SetAtGrow(int nIndex, BYTE newElement);
  96.  
  97.     int Add(BYTE newElement);
  98.  
  99.     int Append(const CByteArray& src);
  100.     void Copy(const CByteArray& src);
  101.  
  102.     // overloaded operator helpers
  103.     BYTE operator[](int nIndex) const;
  104.     BYTE& operator[](int nIndex);
  105.  
  106.     // Operations that move elements around
  107.     void InsertAt(int nIndex, BYTE newElement, int nCount = 1);
  108.  
  109.     void RemoveAt(int nIndex, int nCount = 1);
  110.     void InsertAt(int nStartIndex, CByteArray* pNewArray);
  111.  
  112. // Implementation
  113. protected:
  114.     BYTE* m_pData;   // the actual array of data
  115.     int m_nSize;     // # of elements (upperBound - 1)
  116.     int m_nMaxSize;  // max allocated
  117.     int m_nGrowBy;   // grow amount
  118.  
  119.  
  120. public:
  121.     ~CByteArray();
  122.  
  123.     void Serialize(CArchive&);
  124. #ifdef _DEBUG
  125.     void Dump(CDumpContext&) const;
  126.     void AssertValid() const;
  127. #endif
  128.  
  129. protected:
  130.     // local typedefs for class templates
  131.     typedef BYTE BASE_TYPE;
  132.     typedef BYTE BASE_ARG_TYPE;
  133. };
  134.  
  135.  
  136. ////////////////////////////////////////////////////////////////////////////
  137.  
  138. class CWordArray : public CObject
  139. {
  140.  
  141.     DECLARE_SERIAL(CWordArray)
  142. public:
  143.  
  144. // Construction
  145.     CWordArray();
  146.  
  147. // Attributes
  148.     int GetSize() const;
  149.     int GetUpperBound() const;
  150.     void SetSize(int nNewSize, int nGrowBy = -1);
  151.  
  152. // Operations
  153.     // Clean up
  154.     void FreeExtra();
  155.     void RemoveAll();
  156.  
  157.     // Accessing elements
  158.     WORD GetAt(int nIndex) const;
  159.     void SetAt(int nIndex, WORD newElement);
  160.  
  161.     WORD& ElementAt(int nIndex);
  162.  
  163.     // Direct Access to the element data (may return NULL)
  164.     const WORD* GetData() const;
  165.     WORD* GetData();
  166.  
  167.     // Potentially growing the array
  168.     void SetAtGrow(int nIndex, WORD newElement);
  169.  
  170.     int Add(WORD newElement);
  171.  
  172.     int Append(const CWordArray& src);
  173.     void Copy(const CWordArray& src);
  174.  
  175.     // overloaded operator helpers
  176.     WORD operator[](int nIndex) const;
  177.     WORD& operator[](int nIndex);
  178.  
  179.     // Operations that move elements around
  180.     void InsertAt(int nIndex, WORD newElement, int nCount = 1);
  181.  
  182.     void RemoveAt(int nIndex, int nCount = 1);
  183.     void InsertAt(int nStartIndex, CWordArray* pNewArray);
  184.  
  185. // Implementation
  186. protected:
  187.     WORD* m_pData;   // the actual array of data
  188.     int m_nSize;     // # of elements (upperBound - 1)
  189.     int m_nMaxSize;  // max allocated
  190.     int m_nGrowBy;   // grow amount
  191.  
  192.  
  193. public:
  194.     ~CWordArray();
  195.  
  196.     void Serialize(CArchive&);
  197. #ifdef _DEBUG
  198.     void Dump(CDumpContext&) const;
  199.     void AssertValid() const;
  200. #endif
  201.  
  202. protected:
  203.     // local typedefs for class templates
  204.     typedef WORD BASE_TYPE;
  205.     typedef WORD BASE_ARG_TYPE;
  206. };
  207.  
  208.  
  209. ////////////////////////////////////////////////////////////////////////////
  210.  
  211. class CDWordArray : public CObject
  212. {
  213.  
  214.     DECLARE_SERIAL(CDWordArray)
  215. public:
  216.  
  217. // Construction
  218.     CDWordArray();
  219.  
  220. // Attributes
  221.     int GetSize() const;
  222.     int GetUpperBound() const;
  223.     void SetSize(int nNewSize, int nGrowBy = -1);
  224.  
  225. // Operations
  226.     // Clean up
  227.     void FreeExtra();
  228.     void RemoveAll();
  229.  
  230.     // Accessing elements
  231.     DWORD GetAt(int nIndex) const;
  232.     void SetAt(int nIndex, DWORD newElement);
  233.  
  234.     DWORD& ElementAt(int nIndex);
  235.  
  236.     // Direct Access to the element data (may return NULL)
  237.     const DWORD* GetData() const;
  238.     DWORD* GetData();
  239.  
  240.     // Potentially growing the array
  241.     void SetAtGrow(int nIndex, DWORD newElement);
  242.  
  243.     int Add(DWORD newElement);
  244.  
  245.     int Append(const CDWordArray& src);
  246.     void Copy(const CDWordArray& src);
  247.  
  248.     // overloaded operator helpers
  249.     DWORD operator[](int nIndex) const;
  250.     DWORD& operator[](int nIndex);
  251.  
  252.     // Operations that move elements around
  253.     void InsertAt(int nIndex, DWORD newElement, int nCount = 1);
  254.  
  255.     void RemoveAt(int nIndex, int nCount = 1);
  256.     void InsertAt(int nStartIndex, CDWordArray* pNewArray);
  257.  
  258. // Implementation
  259. protected:
  260.     DWORD* m_pData;   // the actual array of data
  261.     int m_nSize;     // # of elements (upperBound - 1)
  262.     int m_nMaxSize;  // max allocated
  263.     int m_nGrowBy;   // grow amount
  264.  
  265.  
  266. public:
  267.     ~CDWordArray();
  268.  
  269.     void Serialize(CArchive&);
  270. #ifdef _DEBUG
  271.     void Dump(CDumpContext&) const;
  272.     void AssertValid() const;
  273. #endif
  274.  
  275. protected:
  276.     // local typedefs for class templates
  277.     typedef DWORD BASE_TYPE;
  278.     typedef DWORD BASE_ARG_TYPE;
  279. };
  280.  
  281.  
  282. ////////////////////////////////////////////////////////////////////////////
  283.  
  284. class CUIntArray : public CObject
  285. {
  286.  
  287.     DECLARE_DYNAMIC(CUIntArray)
  288. public:
  289.  
  290. // Construction
  291.     CUIntArray();
  292.  
  293. // Attributes
  294.     int GetSize() const;
  295.     int GetUpperBound() const;
  296.     void SetSize(int nNewSize, int nGrowBy = -1);
  297.  
  298. // Operations
  299.     // Clean up
  300.     void FreeExtra();
  301.     void RemoveAll();
  302.  
  303.     // Accessing elements
  304.     UINT GetAt(int nIndex) const;
  305.     void SetAt(int nIndex, UINT newElement);
  306.  
  307.     UINT& ElementAt(int nIndex);
  308.  
  309.     // Direct Access to the element data (may return NULL)
  310.     const UINT* GetData() const;
  311.     UINT* GetData();
  312.  
  313.     // Potentially growing the array
  314.     void SetAtGrow(int nIndex, UINT newElement);
  315.  
  316.     int Add(UINT newElement);
  317.  
  318.     int Append(const CUIntArray& src);
  319.     void Copy(const CUIntArray& src);
  320.  
  321.     // overloaded operator helpers
  322.     UINT operator[](int nIndex) const;
  323.     UINT& operator[](int nIndex);
  324.  
  325.     // Operations that move elements around
  326.     void InsertAt(int nIndex, UINT newElement, int nCount = 1);
  327.  
  328.     void RemoveAt(int nIndex, int nCount = 1);
  329.     void InsertAt(int nStartIndex, CUIntArray* pNewArray);
  330.  
  331. // Implementation
  332. protected:
  333.     UINT* m_pData;   // the actual array of data
  334.     int m_nSize;     // # of elements (upperBound - 1)
  335.     int m_nMaxSize;  // max allocated
  336.     int m_nGrowBy;   // grow amount
  337.  
  338.  
  339. public:
  340.     ~CUIntArray();
  341. #ifdef _DEBUG
  342.     void Dump(CDumpContext&) const;
  343.     void AssertValid() const;
  344. #endif
  345.  
  346. protected:
  347.     // local typedefs for class templates
  348.     typedef UINT BASE_TYPE;
  349.     typedef UINT BASE_ARG_TYPE;
  350. };
  351.  
  352.  
  353. ////////////////////////////////////////////////////////////////////////////
  354.  
  355. class CPtrArray : public CObject
  356. {
  357.  
  358.     DECLARE_DYNAMIC(CPtrArray)
  359. public:
  360.  
  361. // Construction
  362.     CPtrArray();
  363.  
  364. // Attributes
  365.     int GetSize() const;
  366.     int GetUpperBound() const;
  367.     void SetSize(int nNewSize, int nGrowBy = -1);
  368.  
  369. // Operations
  370.     // Clean up
  371.     void FreeExtra();
  372.     void RemoveAll();
  373.  
  374.     // Accessing elements
  375.     void* GetAt(int nIndex) const;
  376.     void SetAt(int nIndex, void* newElement);
  377.  
  378.     void*& ElementAt(int nIndex);
  379.  
  380.     // Direct Access to the element data (may return NULL)
  381.     const void** GetData() const;
  382.     void** GetData();
  383.  
  384.     // Potentially growing the array
  385.     void SetAtGrow(int nIndex, void* newElement);
  386.  
  387.     int Add(void* newElement);
  388.  
  389.     int Append(const CPtrArray& src);
  390.     void Copy(const CPtrArray& src);
  391.  
  392.     // overloaded operator helpers
  393.     void* operator[](int nIndex) const;
  394.     void*& operator[](int nIndex);
  395.  
  396.     // Operations that move elements around
  397.     void InsertAt(int nIndex, void* newElement, int nCount = 1);
  398.  
  399.     void RemoveAt(int nIndex, int nCount = 1);
  400.     void InsertAt(int nStartIndex, CPtrArray* pNewArray);
  401.  
  402. // Implementation
  403. protected:
  404.     void** m_pData;   // the actual array of data
  405.     int m_nSize;     // # of elements (upperBound - 1)
  406.     int m_nMaxSize;  // max allocated
  407.     int m_nGrowBy;   // grow amount
  408.  
  409.  
  410. public:
  411.     ~CPtrArray();
  412. #ifdef _DEBUG
  413.     void Dump(CDumpContext&) const;
  414.     void AssertValid() const;
  415. #endif
  416.  
  417. protected:
  418.     // local typedefs for class templates
  419.     typedef void* BASE_TYPE;
  420.     typedef void* BASE_ARG_TYPE;
  421. };
  422.  
  423.  
  424. ////////////////////////////////////////////////////////////////////////////
  425.  
  426. class CObArray : public CObject
  427. {
  428.  
  429.     DECLARE_SERIAL(CObArray)
  430. public:
  431.  
  432. // Construction
  433.     CObArray();
  434.  
  435. // Attributes
  436.     int GetSize() const;
  437.     int GetUpperBound() const;
  438.     void SetSize(int nNewSize, int nGrowBy = -1);
  439.  
  440. // Operations
  441.     // Clean up
  442.     void FreeExtra();
  443.     void RemoveAll();
  444.  
  445.     // Accessing elements
  446.     CObject* GetAt(int nIndex) const;
  447.     void SetAt(int nIndex, CObject* newElement);
  448.  
  449.     CObject*& ElementAt(int nIndex);
  450.  
  451.     // Direct Access to the element data (may return NULL)
  452.     const CObject** GetData() const;
  453.     CObject** GetData();
  454.  
  455.     // Potentially growing the array
  456.     void SetAtGrow(int nIndex, CObject* newElement);
  457.  
  458.     int Add(CObject* newElement);
  459.  
  460.     int Append(const CObArray& src);
  461.     void Copy(const CObArray& src);
  462.  
  463.     // overloaded operator helpers
  464.     CObject* operator[](int nIndex) const;
  465.     CObject*& operator[](int nIndex);
  466.  
  467.     // Operations that move elements around
  468.     void InsertAt(int nIndex, CObject* newElement, int nCount = 1);
  469.  
  470.     void RemoveAt(int nIndex, int nCount = 1);
  471.     void InsertAt(int nStartIndex, CObArray* pNewArray);
  472.  
  473. // Implementation
  474. protected:
  475.     CObject** m_pData;   // the actual array of data
  476.     int m_nSize;     // # of elements (upperBound - 1)
  477.     int m_nMaxSize;  // max allocated
  478.     int m_nGrowBy;   // grow amount
  479.  
  480.  
  481. public:
  482.     ~CObArray();
  483.  
  484.     void Serialize(CArchive&);
  485. #ifdef _DEBUG
  486.     void Dump(CDumpContext&) const;
  487.     void AssertValid() const;
  488. #endif
  489.  
  490. protected:
  491.     // local typedefs for class templates
  492.     typedef CObject* BASE_TYPE;
  493.     typedef CObject* BASE_ARG_TYPE;
  494. };
  495.  
  496.  
  497. ////////////////////////////////////////////////////////////////////////////
  498.  
  499. class CStringArray : public CObject
  500. {
  501.  
  502.     DECLARE_SERIAL(CStringArray)
  503. public:
  504.  
  505. // Construction
  506.     CStringArray();
  507.  
  508. // Attributes
  509.     int GetSize() const;
  510.     int GetUpperBound() const;
  511.     void SetSize(int nNewSize, int nGrowBy = -1);
  512.  
  513. // Operations
  514.     // Clean up
  515.     void FreeExtra();
  516.     void RemoveAll();
  517.  
  518.     // Accessing elements
  519.     CString GetAt(int nIndex) const;
  520.     void SetAt(int nIndex, LPCTSTR newElement);
  521.  
  522.     void SetAt(int nIndex, const CString& newElement);
  523.  
  524.     CString& ElementAt(int nIndex);
  525.  
  526.     // Direct Access to the element data (may return NULL)
  527.     const CString* GetData() const;
  528.     CString* GetData();
  529.  
  530.     // Potentially growing the array
  531.     void SetAtGrow(int nIndex, LPCTSTR newElement);
  532.  
  533.     void SetAtGrow(int nIndex, const CString& newElement);
  534.  
  535.     int Add(LPCTSTR newElement);
  536.  
  537.     int Add(const CString& newElement);
  538.  
  539.     int Append(const CStringArray& src);
  540.     void Copy(const CStringArray& src);
  541.  
  542.     // overloaded operator helpers
  543.     CString operator[](int nIndex) const;
  544.     CString& operator[](int nIndex);
  545.  
  546.     // Operations that move elements around
  547.     void InsertAt(int nIndex, LPCTSTR newElement, int nCount = 1);
  548.  
  549.     void InsertAt(int nIndex, const CString& newElement, int nCount = 1);
  550.  
  551.     void RemoveAt(int nIndex, int nCount = 1);
  552.     void InsertAt(int nStartIndex, CStringArray* pNewArray);
  553.  
  554. // Implementation
  555. protected:
  556.     CString* m_pData;   // the actual array of data
  557.     int m_nSize;     // # of elements (upperBound - 1)
  558.     int m_nMaxSize;  // max allocated
  559.     int m_nGrowBy;   // grow amount
  560.  
  561.     void InsertEmpty(int nIndex, int nCount);
  562.  
  563.  
  564. public:
  565.     ~CStringArray();
  566.  
  567.     void Serialize(CArchive&);
  568. #ifdef _DEBUG
  569.     void Dump(CDumpContext&) const;
  570.     void AssertValid() const;
  571. #endif
  572.  
  573. protected:
  574.     // local typedefs for class templates
  575.     typedef CString BASE_TYPE;
  576.     typedef LPCTSTR BASE_ARG_TYPE;
  577. };
  578.  
  579.  
  580. /////////////////////////////////////////////////////////////////////////////
  581.  
  582. class CPtrList : public CObject
  583. {
  584.  
  585.     DECLARE_DYNAMIC(CPtrList)
  586.  
  587. protected:
  588.     struct CNode
  589.     {
  590.         CNode* pNext;
  591.         CNode* pPrev;
  592.         void* data;
  593.     };
  594. public:
  595.  
  596. // Construction
  597.     CPtrList(int nBlockSize = 10);
  598.  
  599. // Attributes (head and tail)
  600.     // count of elements
  601.     int GetCount() const;
  602.     BOOL IsEmpty() const;
  603.  
  604.     // peek at head or tail
  605.     void*& GetHead();
  606.     void* GetHead() const;
  607.     void*& GetTail();
  608.     void* GetTail() const;
  609.  
  610. // Operations
  611.     // get head or tail (and remove it) - don't call on empty list!
  612.     void* RemoveHead();
  613.     void* RemoveTail();
  614.  
  615.     // add before head or after tail
  616.     POSITION AddHead(void* newElement);
  617.     POSITION AddTail(void* newElement);
  618.  
  619.  
  620.     // add another list of elements before head or after tail
  621.     void AddHead(CPtrList* pNewList);
  622.     void AddTail(CPtrList* pNewList);
  623.  
  624.     // remove all elements
  625.     void RemoveAll();
  626.  
  627.     // iteration
  628.     POSITION GetHeadPosition() const;
  629.     POSITION GetTailPosition() const;
  630.     void*& GetNext(POSITION& rPosition); // return *Position++
  631.     void* GetNext(POSITION& rPosition) const; // return *Position++
  632.     void*& GetPrev(POSITION& rPosition); // return *Position--
  633.     void* GetPrev(POSITION& rPosition) const; // return *Position--
  634.  
  635.     // getting/modifying an element at a given position
  636.     void*& GetAt(POSITION position);
  637.     void* GetAt(POSITION position) const;
  638.     void SetAt(POSITION pos, void* newElement);
  639.  
  640.     void RemoveAt(POSITION position);
  641.  
  642.     // inserting before or after a given position
  643.     POSITION InsertBefore(POSITION position, void* newElement);
  644.     POSITION InsertAfter(POSITION position, void* newElement);
  645.  
  646.  
  647.     // helper functions (note: O(n) speed)
  648.     POSITION Find(void* searchValue, POSITION startAfter = NULL) const;
  649.                         // defaults to starting at the HEAD
  650.                         // return NULL if not found
  651.     POSITION FindIndex(int nIndex) const;
  652.                         // get the 'nIndex'th element (may return NULL)
  653.  
  654. // Implementation
  655. protected:
  656.     CNode* m_pNodeHead;
  657.     CNode* m_pNodeTail;
  658.     int m_nCount;
  659.     CNode* m_pNodeFree;
  660.     struct CPlex* m_pBlocks;
  661.     int m_nBlockSize;
  662.  
  663.     CNode* NewNode(CNode*, CNode*);
  664.     void FreeNode(CNode*);
  665.  
  666. public:
  667.     ~CPtrList();
  668. #ifdef _DEBUG
  669.     void Dump(CDumpContext&) const;
  670.     void AssertValid() const;
  671. #endif
  672.     // local typedefs for class templates
  673.     typedef void* BASE_TYPE;
  674.     typedef void* BASE_ARG_TYPE;
  675. };
  676.  
  677.  
  678. /////////////////////////////////////////////////////////////////////////////
  679.  
  680. class CObList : public CObject
  681. {
  682.  
  683.     DECLARE_SERIAL(CObList)
  684.  
  685. protected:
  686.     struct CNode
  687.     {
  688.         CNode* pNext;
  689.         CNode* pPrev;
  690.         CObject* data;
  691.     };
  692. public:
  693.  
  694. // Construction
  695.     CObList(int nBlockSize = 10);
  696.  
  697. // Attributes (head and tail)
  698.     // count of elements
  699.     int GetCount() const;
  700.     BOOL IsEmpty() const;
  701.  
  702.     // peek at head or tail
  703.     CObject*& GetHead();
  704.     CObject* GetHead() const;
  705.     CObject*& GetTail();
  706.     CObject* GetTail() const;
  707.  
  708. // Operations
  709.     // get head or tail (and remove it) - don't call on empty list!
  710.     CObject* RemoveHead();
  711.     CObject* RemoveTail();
  712.  
  713.     // add before head or after tail
  714.     POSITION AddHead(CObject* newElement);
  715.     POSITION AddTail(CObject* newElement);
  716.  
  717.  
  718.     // add another list of elements before head or after tail
  719.     void AddHead(CObList* pNewList);
  720.     void AddTail(CObList* pNewList);
  721.  
  722.     // remove all elements
  723.     void RemoveAll();
  724.  
  725.     // iteration
  726.     POSITION GetHeadPosition() const;
  727.     POSITION GetTailPosition() const;
  728.     CObject*& GetNext(POSITION& rPosition); // return *Position++
  729.     CObject* GetNext(POSITION& rPosition) const; // return *Position++
  730.     CObject*& GetPrev(POSITION& rPosition); // return *Position--
  731.     CObject* GetPrev(POSITION& rPosition) const; // return *Position--
  732.  
  733.     // getting/modifying an element at a given position
  734.     CObject*& GetAt(POSITION position);
  735.     CObject* GetAt(POSITION position) const;
  736.     void SetAt(POSITION pos, CObject* newElement);
  737.  
  738.     void RemoveAt(POSITION position);
  739.  
  740.     // inserting before or after a given position
  741.     POSITION InsertBefore(POSITION position, CObject* newElement);
  742.     POSITION InsertAfter(POSITION position, CObject* newElement);
  743.  
  744.  
  745.     // helper functions (note: O(n) speed)
  746.     POSITION Find(CObject* searchValue, POSITION startAfter = NULL) const;
  747.                         // defaults to starting at the HEAD
  748.                         // return NULL if not found
  749.     POSITION FindIndex(int nIndex) const;
  750.                         // get the 'nIndex'th element (may return NULL)
  751.  
  752. // Implementation
  753. protected:
  754.     CNode* m_pNodeHead;
  755.     CNode* m_pNodeTail;
  756.     int m_nCount;
  757.     CNode* m_pNodeFree;
  758.     struct CPlex* m_pBlocks;
  759.     int m_nBlockSize;
  760.  
  761.     CNode* NewNode(CNode*, CNode*);
  762.     void FreeNode(CNode*);
  763.  
  764. public:
  765.     ~CObList();
  766.  
  767.     void Serialize(CArchive&);
  768. #ifdef _DEBUG
  769.     void Dump(CDumpContext&) const;
  770.     void AssertValid() const;
  771. #endif
  772.     // local typedefs for class templates
  773.     typedef CObject* BASE_TYPE;
  774.     typedef CObject* BASE_ARG_TYPE;
  775. };
  776.  
  777.  
  778. /////////////////////////////////////////////////////////////////////////////
  779.  
  780. class CStringList : public CObject
  781. {
  782.  
  783.     DECLARE_SERIAL(CStringList)
  784.  
  785. protected:
  786.     struct CNode
  787.     {
  788.         CNode* pNext;
  789.         CNode* pPrev;
  790.         CString data;
  791.     };
  792. public:
  793.  
  794. // Construction
  795.     CStringList(int nBlockSize = 10);
  796.  
  797. // Attributes (head and tail)
  798.     // count of elements
  799.     int GetCount() const;
  800.     BOOL IsEmpty() const;
  801.  
  802.     // peek at head or tail
  803.     CString& GetHead();
  804.     CString GetHead() const;
  805.     CString& GetTail();
  806.     CString GetTail() const;
  807.  
  808. // Operations
  809.     // get head or tail (and remove it) - don't call on empty list!
  810.     CString RemoveHead();
  811.     CString RemoveTail();
  812.  
  813.     // add before head or after tail
  814.     POSITION AddHead(LPCTSTR newElement);
  815.     POSITION AddTail(LPCTSTR newElement);
  816.  
  817.     POSITION AddHead(const CString& newElement);
  818.     POSITION AddTail(const CString& newElement);
  819.  
  820.  
  821.     // add another list of elements before head or after tail
  822.     void AddHead(CStringList* pNewList);
  823.     void AddTail(CStringList* pNewList);
  824.  
  825.     // remove all elements
  826.     void RemoveAll();
  827.  
  828.     // iteration
  829.     POSITION GetHeadPosition() const;
  830.     POSITION GetTailPosition() const;
  831.     CString& GetNext(POSITION& rPosition); // return *Position++
  832.     CString GetNext(POSITION& rPosition) const; // return *Position++
  833.     CString& GetPrev(POSITION& rPosition); // return *Position--
  834.     CString GetPrev(POSITION& rPosition) const; // return *Position--
  835.  
  836.     // getting/modifying an element at a given position
  837.     CString& GetAt(POSITION position);
  838.     CString GetAt(POSITION position) const;
  839.     void SetAt(POSITION pos, LPCTSTR newElement);
  840.  
  841.     void SetAt(POSITION pos, const CString& newElement);
  842.  
  843.     void RemoveAt(POSITION position);
  844.  
  845.     // inserting before or after a given position
  846.     POSITION InsertBefore(POSITION position, LPCTSTR newElement);
  847.     POSITION InsertAfter(POSITION position, LPCTSTR newElement);
  848.  
  849.     POSITION InsertBefore(POSITION position, const CString& newElement);
  850.     POSITION InsertAfter(POSITION position, const CString& newElement);
  851.  
  852.  
  853.     // helper functions (note: O(n) speed)
  854.     POSITION Find(LPCTSTR searchValue, POSITION startAfter = NULL) const;
  855.                         // defaults to starting at the HEAD
  856.                         // return NULL if not found
  857.     POSITION FindIndex(int nIndex) const;
  858.                         // get the 'nIndex'th element (may return NULL)
  859.  
  860. // Implementation
  861. protected:
  862.     CNode* m_pNodeHead;
  863.     CNode* m_pNodeTail;
  864.     int m_nCount;
  865.     CNode* m_pNodeFree;
  866.     struct CPlex* m_pBlocks;
  867.     int m_nBlockSize;
  868.  
  869.     CNode* NewNode(CNode*, CNode*);
  870.     void FreeNode(CNode*);
  871.  
  872. public:
  873.     ~CStringList();
  874.  
  875.     void Serialize(CArchive&);
  876. #ifdef _DEBUG
  877.     void Dump(CDumpContext&) const;
  878.     void AssertValid() const;
  879. #endif
  880.     // local typedefs for class templates
  881.     typedef CString BASE_TYPE;
  882.     typedef LPCTSTR BASE_ARG_TYPE;
  883. };
  884.  
  885.  
  886. /////////////////////////////////////////////////////////////////////////////
  887.  
  888. class CMapWordToPtr : public CObject
  889. {
  890.  
  891.     DECLARE_DYNAMIC(CMapWordToPtr)
  892. protected:
  893.     // Association
  894.     struct CAssoc
  895.     {
  896.         CAssoc* pNext;
  897.  
  898.         WORD key;
  899.         void* value;
  900.     };
  901.  
  902. public:
  903.  
  904. // Construction
  905.     CMapWordToPtr(int nBlockSize = 10);
  906.  
  907. // Attributes
  908.     // number of elements
  909.     int GetCount() const;
  910.     BOOL IsEmpty() const;
  911.  
  912.     // Lookup
  913.     BOOL Lookup(WORD key, void*& rValue) const;
  914.  
  915. // Operations
  916.     // Lookup and add if not there
  917.     void*& operator[](WORD key);
  918.  
  919.     // add a new (key, value) pair
  920.     void SetAt(WORD key, void* newValue);
  921.  
  922.     // removing existing (key, ?) pair
  923.     BOOL RemoveKey(WORD key);
  924.     void RemoveAll();
  925.  
  926.     // iterating all (key, value) pairs
  927.     POSITION GetStartPosition() const;
  928.     void GetNextAssoc(POSITION& rNextPosition, WORD& rKey, void*& rValue) const;
  929.  
  930.     // advanced features for derived classes
  931.     UINT GetHashTableSize() const;
  932.     void InitHashTable(UINT hashSize, BOOL bAllocNow = TRUE);
  933.  
  934. // Overridables: special non-virtual (see map implementation for details)
  935.     // Routine used to user-provided hash keys
  936.     UINT HashKey(WORD key) const;
  937.  
  938. // Implementation
  939. protected:
  940.     CAssoc** m_pHashTable;
  941.     UINT m_nHashTableSize;
  942.     int m_nCount;
  943.     CAssoc* m_pFreeList;
  944.     struct CPlex* m_pBlocks;
  945.     int m_nBlockSize;
  946.  
  947.     CAssoc* NewAssoc();
  948.     void FreeAssoc(CAssoc*);
  949.     CAssoc* GetAssocAt(WORD, UINT&) const;
  950.  
  951. public:
  952.     ~CMapWordToPtr();
  953. #ifdef _DEBUG
  954.     void Dump(CDumpContext&) const;
  955.     void AssertValid() const;
  956. #endif
  957.  
  958.  
  959. protected:
  960.     // local typedefs for CTypedPtrMap class template
  961.     typedef WORD BASE_KEY;
  962.     typedef WORD BASE_ARG_KEY;
  963.     typedef void* BASE_VALUE;
  964.     typedef void* BASE_ARG_VALUE;
  965. };
  966.  
  967.  
  968. /////////////////////////////////////////////////////////////////////////////
  969.  
  970. class CMapPtrToWord : public CObject
  971. {
  972.  
  973.     DECLARE_DYNAMIC(CMapPtrToWord)
  974. protected:
  975.     // Association
  976.     struct CAssoc
  977.     {
  978.         CAssoc* pNext;
  979.  
  980.         void* key;
  981.         WORD value;
  982.     };
  983.  
  984. public:
  985.  
  986. // Construction
  987.     CMapPtrToWord(int nBlockSize = 10);
  988.  
  989. // Attributes
  990.     // number of elements
  991.     int GetCount() const;
  992.     BOOL IsEmpty() const;
  993.  
  994.     // Lookup
  995.     BOOL Lookup(void* key, WORD& rValue) const;
  996.  
  997. // Operations
  998.     // Lookup and add if not there
  999.     WORD& operator[](void* key);
  1000.  
  1001.     // add a new (key, value) pair
  1002.     void SetAt(void* key, WORD newValue);
  1003.  
  1004.     // removing existing (key, ?) pair
  1005.     BOOL RemoveKey(void* key);
  1006.     void RemoveAll();
  1007.  
  1008.     // iterating all (key, value) pairs
  1009.     POSITION GetStartPosition() const;
  1010.     void GetNextAssoc(POSITION& rNextPosition, void*& rKey, WORD& rValue) const;
  1011.  
  1012.     // advanced features for derived classes
  1013.     UINT GetHashTableSize() const;
  1014.     void InitHashTable(UINT hashSize, BOOL bAllocNow = TRUE);
  1015.  
  1016. // Overridables: special non-virtual (see map implementation for details)
  1017.     // Routine used to user-provided hash keys
  1018.     UINT HashKey(void* key) const;
  1019.  
  1020. // Implementation
  1021. protected:
  1022.     CAssoc** m_pHashTable;
  1023.     UINT m_nHashTableSize;
  1024.     int m_nCount;
  1025.     CAssoc* m_pFreeList;
  1026.     struct CPlex* m_pBlocks;
  1027.     int m_nBlockSize;
  1028.  
  1029.     CAssoc* NewAssoc();
  1030.     void FreeAssoc(CAssoc*);
  1031.     CAssoc* GetAssocAt(void*, UINT&) const;
  1032.  
  1033. public:
  1034.     ~CMapPtrToWord();
  1035. #ifdef _DEBUG
  1036.     void Dump(CDumpContext&) const;
  1037.     void AssertValid() const;
  1038. #endif
  1039.  
  1040.  
  1041. protected:
  1042.     // local typedefs for CTypedPtrMap class template
  1043.     typedef void* BASE_KEY;
  1044.     typedef void* BASE_ARG_KEY;
  1045.     typedef WORD BASE_VALUE;
  1046.     typedef WORD BASE_ARG_VALUE;
  1047. };
  1048.  
  1049.  
  1050. /////////////////////////////////////////////////////////////////////////////
  1051.  
  1052. class CMapPtrToPtr : public CObject
  1053. {
  1054.  
  1055.     DECLARE_DYNAMIC(CMapPtrToPtr)
  1056. protected:
  1057.     // Association
  1058.     struct CAssoc
  1059.     {
  1060.         CAssoc* pNext;
  1061.  
  1062.         void* key;
  1063.         void* value;
  1064.     };
  1065.  
  1066. public:
  1067.  
  1068. // Construction
  1069.     CMapPtrToPtr(int nBlockSize = 10);
  1070.  
  1071. // Attributes
  1072.     // number of elements
  1073.     int GetCount() const;
  1074.     BOOL IsEmpty() const;
  1075.  
  1076.     // Lookup
  1077.     BOOL Lookup(void* key, void*& rValue) const;
  1078.  
  1079. // Operations
  1080.     // Lookup and add if not there
  1081.     void*& operator[](void* key);
  1082.  
  1083.     // add a new (key, value) pair
  1084.     void SetAt(void* key, void* newValue);
  1085.  
  1086.     // removing existing (key, ?) pair
  1087.     BOOL RemoveKey(void* key);
  1088.     void RemoveAll();
  1089.  
  1090.     // iterating all (key, value) pairs
  1091.     POSITION GetStartPosition() const;
  1092.     void GetNextAssoc(POSITION& rNextPosition, void*& rKey, void*& rValue) const;
  1093.  
  1094.     // advanced features for derived classes
  1095.     UINT GetHashTableSize() const;
  1096.     void InitHashTable(UINT hashSize, BOOL bAllocNow = TRUE);
  1097.  
  1098. // Overridables: special non-virtual (see map implementation for details)
  1099.     // Routine used to user-provided hash keys
  1100.     UINT HashKey(void* key) const;
  1101.  
  1102. // Implementation
  1103. protected:
  1104.     CAssoc** m_pHashTable;
  1105.     UINT m_nHashTableSize;
  1106.     int m_nCount;
  1107.     CAssoc* m_pFreeList;
  1108.     struct CPlex* m_pBlocks;
  1109.     int m_nBlockSize;
  1110.  
  1111.     CAssoc* NewAssoc();
  1112.     void FreeAssoc(CAssoc*);
  1113.     CAssoc* GetAssocAt(void*, UINT&) const;
  1114.  
  1115. public:
  1116.     ~CMapPtrToPtr();
  1117. #ifdef _DEBUG
  1118.     void Dump(CDumpContext&) const;
  1119.     void AssertValid() const;
  1120. #endif
  1121.  
  1122.     void* GetValueAt(void* key) const;
  1123.  
  1124.  
  1125. protected:
  1126.     // local typedefs for CTypedPtrMap class template
  1127.     typedef void* BASE_KEY;
  1128.     typedef void* BASE_ARG_KEY;
  1129.     typedef void* BASE_VALUE;
  1130.     typedef void* BASE_ARG_VALUE;
  1131. };
  1132.  
  1133.  
  1134. /////////////////////////////////////////////////////////////////////////////
  1135.  
  1136. class CMapWordToOb : public CObject
  1137. {
  1138.  
  1139.     DECLARE_SERIAL(CMapWordToOb)
  1140. protected:
  1141.     // Association
  1142.     struct CAssoc
  1143.     {
  1144.         CAssoc* pNext;
  1145.  
  1146.         WORD key;
  1147.         CObject* value;
  1148.     };
  1149.  
  1150. public:
  1151.  
  1152. // Construction
  1153.     CMapWordToOb(int nBlockSize = 10);
  1154.  
  1155. // Attributes
  1156.     // number of elements
  1157.     int GetCount() const;
  1158.     BOOL IsEmpty() const;
  1159.  
  1160.     // Lookup
  1161.     BOOL Lookup(WORD key, CObject*& rValue) const;
  1162.  
  1163. // Operations
  1164.     // Lookup and add if not there
  1165.     CObject*& operator[](WORD key);
  1166.  
  1167.     // add a new (key, value) pair
  1168.     void SetAt(WORD key, CObject* newValue);
  1169.  
  1170.     // removing existing (key, ?) pair
  1171.     BOOL RemoveKey(WORD key);
  1172.     void RemoveAll();
  1173.  
  1174.     // iterating all (key, value) pairs
  1175.     POSITION GetStartPosition() const;
  1176.     void GetNextAssoc(POSITION& rNextPosition, WORD& rKey, CObject*& rValue) const;
  1177.  
  1178.     // advanced features for derived classes
  1179.     UINT GetHashTableSize() const;
  1180.     void InitHashTable(UINT hashSize, BOOL bAllocNow = TRUE);
  1181.  
  1182. // Overridables: special non-virtual (see map implementation for details)
  1183.     // Routine used to user-provided hash keys
  1184.     UINT HashKey(WORD key) const;
  1185.  
  1186. // Implementation
  1187. protected:
  1188.     CAssoc** m_pHashTable;
  1189.     UINT m_nHashTableSize;
  1190.     int m_nCount;
  1191.     CAssoc* m_pFreeList;
  1192.     struct CPlex* m_pBlocks;
  1193.     int m_nBlockSize;
  1194.  
  1195.     CAssoc* NewAssoc();
  1196.     void FreeAssoc(CAssoc*);
  1197.     CAssoc* GetAssocAt(WORD, UINT&) const;
  1198.  
  1199. public:
  1200.     ~CMapWordToOb();
  1201.  
  1202.     void Serialize(CArchive&);
  1203. #ifdef _DEBUG
  1204.     void Dump(CDumpContext&) const;
  1205.     void AssertValid() const;
  1206. #endif
  1207.  
  1208.  
  1209. protected:
  1210.     // local typedefs for CTypedPtrMap class template
  1211.     typedef WORD BASE_KEY;
  1212.     typedef WORD BASE_ARG_KEY;
  1213.     typedef CObject* BASE_VALUE;
  1214.     typedef CObject* BASE_ARG_VALUE;
  1215. };
  1216.  
  1217.  
  1218. /////////////////////////////////////////////////////////////////////////////
  1219.  
  1220. class CMapStringToPtr : public CObject
  1221. {
  1222.  
  1223.     DECLARE_DYNAMIC(CMapStringToPtr)
  1224. protected:
  1225.     // Association
  1226.     struct CAssoc
  1227.     {
  1228.         CAssoc* pNext;
  1229.         UINT nHashValue;  // needed for efficient iteration
  1230.         CString key;
  1231.         void* value;
  1232.     };
  1233.  
  1234. public:
  1235.  
  1236. // Construction
  1237.     CMapStringToPtr(int nBlockSize = 10);
  1238.  
  1239. // Attributes
  1240.     // number of elements
  1241.     int GetCount() const;
  1242.     BOOL IsEmpty() const;
  1243.  
  1244.     // Lookup
  1245.     BOOL Lookup(LPCTSTR key, void*& rValue) const;
  1246.     BOOL LookupKey(LPCTSTR key, LPCTSTR& rKey) const;
  1247.  
  1248. // Operations
  1249.     // Lookup and add if not there
  1250.     void*& operator[](LPCTSTR key);
  1251.  
  1252.     // add a new (key, value) pair
  1253.     void SetAt(LPCTSTR key, void* newValue);
  1254.  
  1255.     // removing existing (key, ?) pair
  1256.     BOOL RemoveKey(LPCTSTR key);
  1257.     void RemoveAll();
  1258.  
  1259.     // iterating all (key, value) pairs
  1260.     POSITION GetStartPosition() const;
  1261.     void GetNextAssoc(POSITION& rNextPosition, CString& rKey, void*& rValue) const;
  1262.  
  1263.     // advanced features for derived classes
  1264.     UINT GetHashTableSize() const;
  1265.     void InitHashTable(UINT hashSize, BOOL bAllocNow = TRUE);
  1266.  
  1267. // Overridables: special non-virtual (see map implementation for details)
  1268.     // Routine used to user-provided hash keys
  1269.     UINT HashKey(LPCTSTR key) const;
  1270.  
  1271. // Implementation
  1272. protected:
  1273.     CAssoc** m_pHashTable;
  1274.     UINT m_nHashTableSize;
  1275.     int m_nCount;
  1276.     CAssoc* m_pFreeList;
  1277.     struct CPlex* m_pBlocks;
  1278.     int m_nBlockSize;
  1279.  
  1280.     CAssoc* NewAssoc();
  1281.     void FreeAssoc(CAssoc*);
  1282.     CAssoc* GetAssocAt(LPCTSTR, UINT&) const;
  1283.  
  1284. public:
  1285.     ~CMapStringToPtr();
  1286. #ifdef _DEBUG
  1287.     void Dump(CDumpContext&) const;
  1288.     void AssertValid() const;
  1289. #endif
  1290.  
  1291. protected:
  1292.     // local typedefs for CTypedPtrMap class template
  1293.     typedef CString BASE_KEY;
  1294.     typedef LPCTSTR BASE_ARG_KEY;
  1295.     typedef void* BASE_VALUE;
  1296.     typedef void* BASE_ARG_VALUE;
  1297. };
  1298.  
  1299.  
  1300. /////////////////////////////////////////////////////////////////////////////
  1301.  
  1302. class CMapStringToOb : public CObject
  1303. {
  1304.  
  1305.     DECLARE_SERIAL(CMapStringToOb)
  1306. protected:
  1307.     // Association
  1308.     struct CAssoc
  1309.     {
  1310.         CAssoc* pNext;
  1311.         UINT nHashValue;  // needed for efficient iteration
  1312.         CString key;
  1313.         CObject* value;
  1314.     };
  1315.  
  1316. public:
  1317.  
  1318. // Construction
  1319.     CMapStringToOb(int nBlockSize = 10);
  1320.  
  1321. // Attributes
  1322.     // number of elements
  1323.     int GetCount() const;
  1324.     BOOL IsEmpty() const;
  1325.  
  1326.     // Lookup
  1327.     BOOL Lookup(LPCTSTR key, CObject*& rValue) const;
  1328.     BOOL LookupKey(LPCTSTR key, LPCTSTR& rKey) const;
  1329.  
  1330. // Operations
  1331.     // Lookup and add if not there
  1332.     CObject*& operator[](LPCTSTR key);
  1333.  
  1334.     // add a new (key, value) pair
  1335.     void SetAt(LPCTSTR key, CObject* newValue);
  1336.  
  1337.     // removing existing (key, ?) pair
  1338.     BOOL RemoveKey(LPCTSTR key);
  1339.     void RemoveAll();
  1340.  
  1341.     // iterating all (key, value) pairs
  1342.     POSITION GetStartPosition() const;
  1343.     void GetNextAssoc(POSITION& rNextPosition, CString& rKey, CObject*& rValue) const;
  1344.  
  1345.     // advanced features for derived classes
  1346.     UINT GetHashTableSize() const;
  1347.     void InitHashTable(UINT hashSize, BOOL bAllocNow = TRUE);
  1348.  
  1349. // Overridables: special non-virtual (see map implementation for details)
  1350.     // Routine used to user-provided hash keys
  1351.     UINT HashKey(LPCTSTR key) const;
  1352.  
  1353. // Implementation
  1354. protected:
  1355.     CAssoc** m_pHashTable;
  1356.     UINT m_nHashTableSize;
  1357.     int m_nCount;
  1358.     CAssoc* m_pFreeList;
  1359.     struct CPlex* m_pBlocks;
  1360.     int m_nBlockSize;
  1361.  
  1362.     CAssoc* NewAssoc();
  1363.     void FreeAssoc(CAssoc*);
  1364.     CAssoc* GetAssocAt(LPCTSTR, UINT&) const;
  1365.  
  1366. public:
  1367.     ~CMapStringToOb();
  1368.  
  1369.     void Serialize(CArchive&);
  1370. #ifdef _DEBUG
  1371.     void Dump(CDumpContext&) const;
  1372.     void AssertValid() const;
  1373. #endif
  1374.  
  1375. protected:
  1376.     // local typedefs for CTypedPtrMap class template
  1377.     typedef CString BASE_KEY;
  1378.     typedef LPCTSTR BASE_ARG_KEY;
  1379.     typedef CObject* BASE_VALUE;
  1380.     typedef CObject* BASE_ARG_VALUE;
  1381. };
  1382.  
  1383.  
  1384. /////////////////////////////////////////////////////////////////////////////
  1385.  
  1386. class CMapStringToString : public CObject
  1387. {
  1388.  
  1389.     DECLARE_SERIAL(CMapStringToString)
  1390. protected:
  1391.     // Association
  1392.     struct CAssoc
  1393.     {
  1394.         CAssoc* pNext;
  1395.         UINT nHashValue;  // needed for efficient iteration
  1396.         CString key;
  1397.         CString value;
  1398.     };
  1399.  
  1400. public:
  1401.  
  1402. // Construction
  1403.     CMapStringToString(int nBlockSize = 10);
  1404.  
  1405. // Attributes
  1406.     // number of elements
  1407.     int GetCount() const;
  1408.     BOOL IsEmpty() const;
  1409.  
  1410.     // Lookup
  1411.     BOOL Lookup(LPCTSTR key, CString& rValue) const;
  1412.     BOOL LookupKey(LPCTSTR key, LPCTSTR& rKey) const;
  1413.  
  1414. // Operations
  1415.     // Lookup and add if not there
  1416.     CString& operator[](LPCTSTR key);
  1417.  
  1418.     // add a new (key, value) pair
  1419.     void SetAt(LPCTSTR key, LPCTSTR newValue);
  1420.  
  1421.     // removing existing (key, ?) pair
  1422.     BOOL RemoveKey(LPCTSTR key);
  1423.     void RemoveAll();
  1424.  
  1425.     // iterating all (key, value) pairs
  1426.     POSITION GetStartPosition() const;
  1427.     void GetNextAssoc(POSITION& rNextPosition, CString& rKey, CString& rValue) const;
  1428.  
  1429.     // advanced features for derived classes
  1430.     UINT GetHashTableSize() const;
  1431.     void InitHashTable(UINT hashSize, BOOL bAllocNow = TRUE);
  1432.  
  1433. // Overridables: special non-virtual (see map implementation for details)
  1434.     // Routine used to user-provided hash keys
  1435.     UINT HashKey(LPCTSTR key) const;
  1436.  
  1437. // Implementation
  1438. protected:
  1439.     CAssoc** m_pHashTable;
  1440.     UINT m_nHashTableSize;
  1441.     int m_nCount;
  1442.     CAssoc* m_pFreeList;
  1443.     struct CPlex* m_pBlocks;
  1444.     int m_nBlockSize;
  1445.  
  1446.     CAssoc* NewAssoc();
  1447.     void FreeAssoc(CAssoc*);
  1448.     CAssoc* GetAssocAt(LPCTSTR, UINT&) const;
  1449.  
  1450. public:
  1451.     ~CMapStringToString();
  1452.  
  1453.     void Serialize(CArchive&);
  1454. #ifdef _DEBUG
  1455.     void Dump(CDumpContext&) const;
  1456.     void AssertValid() const;
  1457. #endif
  1458.  
  1459. protected:
  1460.     // local typedefs for CTypedPtrMap class template
  1461.     typedef CString BASE_KEY;
  1462.     typedef LPCTSTR BASE_ARG_KEY;
  1463.     typedef CString BASE_VALUE;
  1464.     typedef LPCTSTR BASE_ARG_VALUE;
  1465. };
  1466.  
  1467.  
  1468. #ifdef _AFX_PACKING
  1469. #pragma pack(pop)
  1470. #endif
  1471.  
  1472. #ifndef __AFXSTATE_H__
  1473.     #include <afxstat_.h>   // for MFC private state structures
  1474. #endif
  1475.  
  1476. /////////////////////////////////////////////////////////////////////////////
  1477. // Inline function declarations
  1478.  
  1479. #ifdef _AFX_ENABLE_INLINES
  1480. #define _AFXCOLL_INLINE AFX_INLINE
  1481. #include <afxcoll.inl>
  1482. #endif
  1483.  
  1484. #undef AFX_DATA
  1485. #define AFX_DATA
  1486.  
  1487. #ifdef _AFX_MINREBUILD
  1488. #pragma component(minrebuild, on)
  1489. #endif
  1490. #ifndef _AFX_FULLTYPEINFO
  1491. #pragma component(mintypeinfo, off)
  1492. #endif
  1493.  
  1494. #endif //!__AFXCOLL_H__
  1495.  
  1496. /////////////////////////////////////////////////////////////////////////////
  1497.