Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

715 lines
20 KiB

  1. /*++
  2. Copyright (C) 1992-2001 Microsoft Corporation
  3. Module Name:
  4. MINIAFX.H
  5. Abstract:
  6. History:
  7. --*/
  8. ///////////////////////////////////////////////////////////////////////////
  9. //
  10. // MINIAFX.H
  11. //
  12. // MFC Subset declarations.
  13. //
  14. // CString, CWordArray, CDWordArray, CPtrArray, CStringArray, CPtrList
  15. //
  16. // 09/25/94 TSE
  17. //
  18. ///////////////////////////////////////////////////////////////////////////
  19. #ifndef _MINIAFX_H_
  20. #define _MINIAFX_H_
  21. #include <stdio.h>
  22. #include <string.h>
  23. typedef void* POSITION; // abstract iteration position
  24. #ifndef DWORD
  25. typedef unsigned char BYTE; // 8-bit unsigned entity
  26. typedef unsigned short WORD; // 16-bit unsigned number
  27. typedef unsigned int UINT; // machine sized unsigned number (preferred)
  28. typedef long LONG; // 32-bit signed number
  29. typedef unsigned long DWORD; // 32-bit unsigned number
  30. typedef int BOOL; // BOOLean (0 or !=0)
  31. typedef char * LPSTR; // far pointer to a string
  32. typedef const char * LPCSTR; // far pointer to a read-only string
  33. #endif
  34. #ifndef NULL
  35. #define NULL 0
  36. #endif
  37. #ifndef TRUE
  38. #define TRUE 1
  39. #endif
  40. #ifndef FALSE
  41. #define FALSE 0
  42. #endif
  43. ////////////////////////////////////////////////////////////////////////////
  44. class CString
  45. {
  46. public:
  47. // Constructors
  48. CString();
  49. CString(const CString& stringSrc);
  50. CString(char ch, int nRepeat = 1);
  51. CString(const char* psz);
  52. CString(const char* pch, int nLength);
  53. ~CString();
  54. // Attributes & Operations
  55. // as an array of characters
  56. int GetLength() const { return m_nDataLength; }
  57. BOOL IsEmpty() const;
  58. void Empty(); // free up the data
  59. char GetAt(int nIndex) const; // 0 based
  60. char operator[](int nIndex) const; // same as GetAt
  61. void SetAt(int nIndex, char ch);
  62. operator const char*() const // as a C string
  63. { return (const char*)m_pchData; }
  64. // overloaded assignment
  65. const CString& operator=(const CString& stringSrc);
  66. const CString& operator=(char ch);
  67. const CString& operator=(const char* psz);
  68. // string concatenation
  69. const CString& operator+=(const CString& string);
  70. const CString& operator+=(char ch);
  71. const CString& operator+=(const char* psz);
  72. friend CString operator+(const CString& string1,
  73. const CString& string2);
  74. friend CString operator+(const CString& string, char ch);
  75. friend CString operator+(char ch, const CString& string);
  76. friend CString operator+(const CString& string, const char* psz);
  77. friend CString operator+(const char* psz, const CString& string);
  78. // string comparison
  79. int Compare(const char* psz) const; // straight character
  80. int CompareNoCase(const char* psz) const; // ignore case
  81. int Collate(const char* psz) const; // NLS aware
  82. // simple sub-string extraction
  83. CString Mid(int nFirst, int nCount) const;
  84. CString Mid(int nFirst) const;
  85. CString Left(int nCount) const;
  86. CString Right(int nCount) const;
  87. CString SpanIncluding(const char* pszCharSet) const;
  88. CString SpanExcluding(const char* pszCharSet) const;
  89. // upper/lower/reverse conversion
  90. void MakeUpper();
  91. void MakeLower();
  92. void MakeReverse();
  93. // searching (return starting index, or -1 if not found)
  94. // look for a single character match
  95. int Find(char ch) const; // like "C" strchr
  96. int ReverseFind(char ch) const;
  97. int FindOneOf(const char* pszCharSet) const;
  98. // look for a specific sub-string
  99. int Find(const char* pszSub) const; // like "C" strstr
  100. // Windows support
  101. #ifdef _WINDOWS
  102. BOOL LoadString(UINT nID); // load from string resource
  103. // 255 chars max
  104. // ANSI<->OEM support (convert string in place)
  105. void AnsiToOem();
  106. void OemToAnsi();
  107. #endif //_WINDOWS
  108. // Access to string implementation buffer as "C" character array
  109. char* GetBuffer(int nMinBufLength);
  110. void ReleaseBuffer(int nNewLength = -1);
  111. char* GetBufferSetLength(int nNewLength);
  112. // Implementation
  113. public:
  114. int GetAllocLength() const;
  115. protected:
  116. // lengths/sizes in characters
  117. // (note: an extra character is always allocated)
  118. char* m_pchData; // actual string (zero terminated)
  119. int m_nDataLength; // does not include terminating 0
  120. int m_nAllocLength; // does not include terminating 0
  121. // implementation helpers
  122. void Init();
  123. void AllocCopy(CString& dest, int nCopyLen, int nCopyIndex, int nExtraLen) const;
  124. void AllocBuffer(int nLen);
  125. void AssignCopy(int nSrcLen, const char* pszSrcData);
  126. void ConcatCopy(int nSrc1Len, const char* pszSrc1Data, int nSrc2Len, const char* pszSrc2Data);
  127. void ConcatInPlace(int nSrcLen, const char* pszSrcData);
  128. static void SafeDelete(char* pch);
  129. static int SafeStrlen(const char* psz);
  130. };
  131. // Compare helpers
  132. BOOL operator==(const CString& s1, const CString& s2);
  133. BOOL operator==(const CString& s1, const char* s2);
  134. BOOL operator==(const char* s1, const CString& s2);
  135. BOOL operator!=(const CString& s1, const CString& s2);
  136. BOOL operator!=(const CString& s1, const char* s2);
  137. BOOL operator!=(const char* s1, const CString& s2);
  138. BOOL operator<(const CString& s1, const CString& s2);
  139. BOOL operator<(const CString& s1, const char* s2);
  140. BOOL operator<(const char* s1, const CString& s2);
  141. BOOL operator>(const CString& s1, const CString& s2);
  142. BOOL operator>(const CString& s1, const char* s2);
  143. BOOL operator>(const char* s1, const CString& s2);
  144. BOOL operator<=(const CString& s1, const CString& s2);
  145. BOOL operator<=(const CString& s1, const char* s2);
  146. BOOL operator<=(const char* s1, const CString& s2);
  147. BOOL operator>=(const CString& s1, const CString& s2);
  148. BOOL operator>=(const CString& s1, const char* s2);
  149. BOOL operator>=(const char* s1, const CString& s2);
  150. ////////////////////////////////////////////////////////////////////////////
  151. class CDWordArray
  152. {
  153. public:
  154. // Construction
  155. CDWordArray();
  156. // Attributes
  157. int GetSize() const { return m_nSize; }
  158. int GetUpperBound() const;
  159. void SetSize(int nNewSize, int nGrowBy = -1);
  160. // Operations
  161. // Clean up
  162. void FreeExtra();
  163. void RemoveAll();
  164. // Accessing elements
  165. DWORD GetAt(int nIndex) const { return m_pData[nIndex]; }
  166. void SetAt(int nIndex, DWORD newElement)
  167. { m_pData[nIndex] = newElement; }
  168. DWORD& ElementAt(int nIndex);
  169. // Potentially growing the array
  170. void SetAtGrow(int nIndex, DWORD newElement);
  171. int Add(DWORD newElement);
  172. // overloaded operator helpers
  173. DWORD operator[](int nIndex) const;
  174. DWORD& operator[](int nIndex);
  175. // Operations that move elements around
  176. void InsertAt(int nIndex, DWORD newElement, int nCount = 1);
  177. void RemoveAt(int nIndex, int nCount = 1);
  178. void InsertAt(int nStartIndex, CDWordArray* pNewArray);
  179. // Implementation
  180. protected:
  181. DWORD* m_pData; // the actual array of data
  182. int m_nSize; // # of elements (upperBound - 1)
  183. int m_nMaxSize; // max allocated
  184. int m_nGrowBy; // grow amount
  185. public:
  186. ~CDWordArray();
  187. };
  188. ////////////////////////////////////////////////////////////////////////////
  189. class CPtrArray
  190. {
  191. public:
  192. // Construction
  193. CPtrArray();
  194. // Attributes
  195. int GetSize() const { return m_nSize; }
  196. int GetUpperBound() const;
  197. BOOL SetSize(int nNewSize, int nGrowBy = -1);
  198. // Operations
  199. // Clean up
  200. void FreeExtra();
  201. void RemoveAll();
  202. // Accessing elements
  203. void* GetAt(int nIndex) const { return m_pData[nIndex]; }
  204. void SetAt(int nIndex, void* newElement)
  205. { m_pData[nIndex] = newElement; }
  206. void*& ElementAt(int nIndex);
  207. // Potentially growing the array
  208. BOOL SetAtGrow(int nIndex, void* newElement);
  209. // returns -1 if failure
  210. int Add(void* newElement)
  211. { int nIndex = m_nSize;
  212. if(SetAtGrow(nIndex, newElement))
  213. return nIndex;
  214. else
  215. return -1;
  216. }
  217. // overloaded operator helpers
  218. void* operator[](int nIndex) const;
  219. void*& operator[](int nIndex);
  220. // Operations that move elements around
  221. void InsertAt(int nIndex, void* newElement, int nCount = 1);
  222. void RemoveAt(int nIndex, int nCount = 1);
  223. void InsertAt(int nStartIndex, CPtrArray* pNewArray);
  224. // Implementation
  225. protected:
  226. void** m_pData; // the actual array of data
  227. int m_nSize; // # of elements (upperBound - 1)
  228. int m_nMaxSize; // max allocated
  229. int m_nGrowBy; // grow amount
  230. public:
  231. ~CPtrArray();
  232. };
  233. ////////////////////////////////////////////////////////////////////////////
  234. class CStringArray
  235. {
  236. public:
  237. // Construction
  238. CStringArray();
  239. // Attributes
  240. int GetSize() const { return m_nSize; }
  241. int GetUpperBound() const;
  242. void SetSize(int nNewSize, int nGrowBy = -1);
  243. // Operations
  244. // Clean up
  245. void FreeExtra();
  246. void RemoveAll();
  247. // Accessing elements
  248. CString GetAt(int nIndex) const { return m_pData[nIndex]; }
  249. void SetAt(int nIndex, const char* newElement)
  250. { m_pData[nIndex] = newElement; }
  251. CString& ElementAt(int nIndex)
  252. { return m_pData[nIndex]; }
  253. // Potentially growing the array
  254. void SetAtGrow(int nIndex, const char* newElement);
  255. int Add(const char* newElement)
  256. { int nIndex = m_nSize;
  257. SetAtGrow(nIndex, newElement);
  258. return nIndex; }
  259. // overloaded operator helpers
  260. CString operator[](int nIndex) const
  261. { return GetAt(nIndex); }
  262. CString& operator[](int nIndex)
  263. { return ElementAt(nIndex); }
  264. // Operations that move elements around
  265. void InsertAt(int nIndex, const char* newElement, int nCount = 1);
  266. void RemoveAt(int nIndex, int nCount = 1);
  267. void InsertAt(int nStartIndex, CStringArray* pNewArray);
  268. // Implementation
  269. protected:
  270. CString* m_pData; // the actual array of data
  271. int m_nSize; // # of elements (upperBound - 1)
  272. int m_nMaxSize; // max allocated
  273. int m_nGrowBy; // grow amount
  274. public:
  275. ~CStringArray();
  276. };
  277. ////////////////////////////////////////////////////////////////////////////
  278. class CWordArray
  279. {
  280. public:
  281. // Construction
  282. CWordArray();
  283. // Attributes
  284. int GetSize() const { return m_nSize; }
  285. int GetUpperBound() const;
  286. void SetSize(int nNewSize, int nGrowBy = -1);
  287. // Operations
  288. // Clean up
  289. void FreeExtra();
  290. void RemoveAll();
  291. // Accessing elements
  292. WORD GetAt(int nIndex) const { return m_pData[nIndex]; }
  293. void SetAt(int nIndex, WORD newElement)
  294. { m_pData[nIndex] = newElement; }
  295. WORD& ElementAt(int nIndex);
  296. // Potentially growing the array
  297. void SetAtGrow(int nIndex, WORD newElement);
  298. int Add(WORD newElement);
  299. // overloaded operator helpers
  300. WORD operator[](int nIndex) const;
  301. WORD& operator[](int nIndex);
  302. // Operations that move elements around
  303. void InsertAt(int nIndex, WORD newElement, int nCount = 1);
  304. void RemoveAt(int nIndex, int nCount = 1);
  305. void InsertAt(int nStartIndex, CWordArray* pNewArray);
  306. // Implementation
  307. protected:
  308. WORD* m_pData; // the actual array of data
  309. int m_nSize; // # of elements (upperBound - 1)
  310. int m_nMaxSize; // max allocated
  311. int m_nGrowBy; // grow amount
  312. public:
  313. ~CWordArray();
  314. };
  315. /////////////////////////////////////////////////////////////////////////////
  316. class CPtrList
  317. {
  318. protected:
  319. struct CNode
  320. {
  321. CNode* pNext;
  322. CNode* pPrev;
  323. void* data;
  324. };
  325. public:
  326. // Construction
  327. CPtrList(int nBlockSize=10);
  328. // Attributes (head and tail)
  329. // count of elements
  330. int GetCount() const;
  331. BOOL IsEmpty() const;
  332. // peek at head or tail
  333. void*& GetHead();
  334. void* GetHead() const;
  335. void*& GetTail();
  336. void* GetTail() const;
  337. // Operations
  338. // get head or tail (and remove it) - don't call on empty list !
  339. void* RemoveHead();
  340. void* RemoveTail();
  341. // add before head or after tail
  342. POSITION AddHead(void* newElement);
  343. POSITION AddTail(void* newElement);
  344. // add another list of elements before head or after tail
  345. void AddHead(CPtrList* pNewList);
  346. void AddTail(CPtrList* pNewList);
  347. // remove all elements
  348. void RemoveAll();
  349. // iteration
  350. POSITION GetHeadPosition() const;
  351. POSITION GetTailPosition() const;
  352. void*& GetNext(POSITION& rPosition); // return *Position++
  353. void* GetNext(POSITION& rPosition) const; // return *Position++
  354. void*& GetPrev(POSITION& rPosition); // return *Position--
  355. void* GetPrev(POSITION& rPosition) const; // return *Position--
  356. // getting/modifying an element at a given position
  357. void*& GetAt(POSITION position);
  358. void* GetAt(POSITION position) const;
  359. void SetAt(POSITION pos, void* newElement);
  360. void RemoveAt(POSITION position);
  361. // inserting before or after a given position
  362. POSITION InsertBefore(POSITION position, void* newElement);
  363. POSITION InsertAfter(POSITION position, void* newElement);
  364. // helper functions (note: O(n) speed)
  365. POSITION Find(void* searchValue, POSITION startAfter = NULL) const;
  366. // defaults to starting at the HEAD
  367. // return NULL if not found
  368. POSITION FindIndex(int nIndex) const;
  369. // get the 'nIndex'th element (may return NULL)
  370. // Implementation
  371. protected:
  372. CNode* m_pNodeHead;
  373. CNode* m_pNodeTail;
  374. int m_nCount;
  375. CNode* m_pNodeFree;
  376. struct CPlex* m_pBlocks;
  377. int m_nBlockSize;
  378. CNode* NewNode(CNode*, CNode*);
  379. void FreeNode(CNode*);
  380. public:
  381. ~CPtrList();
  382. };
  383. //-----------------------------------------------------------------
  384. // Inlines from AFX.INL and AFXCOLL.INL
  385. //
  386. #define _AFX_INLINE inline
  387. #define _AFXCOLL_INLINE inline
  388. // CString
  389. _AFX_INLINE int CString::GetAllocLength() const
  390. { return m_nAllocLength; }
  391. _AFX_INLINE BOOL CString::IsEmpty() const
  392. { return m_nDataLength == 0; }
  393. //_AFX_INLINE int CString::SafeStrlen(const char* psz)
  394. // { return (psz == NULL) ? NULL : strlen(psz); }
  395. #ifndef _WINDOWS
  396. _AFX_INLINE int CString::Compare(const char* psz) const
  397. { return strcmp(m_pchData, psz); }
  398. _AFX_INLINE int CString::CompareNoCase(const char* psz) const
  399. { return stricmp(m_pchData, psz); }
  400. _AFX_INLINE int CString::Collate(const char* psz) const
  401. { return strcoll(m_pchData, psz); }
  402. _AFX_INLINE void CString::MakeUpper()
  403. { strupr(m_pchData); }
  404. _AFX_INLINE void CString::MakeLower()
  405. { strlwr(m_pchData); }
  406. // Windows version in AFXWIN.H
  407. #endif //!_WINDOWS
  408. _AFX_INLINE void CString::MakeReverse()
  409. { strrev(m_pchData); }
  410. _AFX_INLINE char CString::GetAt(int nIndex) const
  411. {
  412. return m_pchData[nIndex];
  413. }
  414. _AFX_INLINE char CString::operator[](int nIndex) const
  415. {
  416. return m_pchData[nIndex];
  417. }
  418. _AFX_INLINE void CString::SetAt(int nIndex, char ch)
  419. {
  420. m_pchData[nIndex] = ch;
  421. }
  422. _AFX_INLINE BOOL operator==(const CString& s1, const CString& s2)
  423. { return s1.Compare(s2) == 0; }
  424. _AFX_INLINE BOOL operator==(const CString& s1, const char* s2)
  425. { return s1.Compare(s2) == 0; }
  426. _AFX_INLINE BOOL operator==(const char* s1, const CString& s2)
  427. { return s2.Compare(s1) == 0; }
  428. _AFX_INLINE BOOL operator!=(const CString& s1, const CString& s2)
  429. { return s1.Compare(s2) != 0; }
  430. _AFX_INLINE BOOL operator!=(const CString& s1, const char* s2)
  431. { return s1.Compare(s2) != 0; }
  432. _AFX_INLINE BOOL operator!=(const char* s1, const CString& s2)
  433. { return s2.Compare(s1) != 0; }
  434. _AFX_INLINE BOOL operator<(const CString& s1, const CString& s2)
  435. { return s1.Compare(s2) < 0; }
  436. _AFX_INLINE BOOL operator<(const CString& s1, const char* s2)
  437. { return s1.Compare(s2) < 0; }
  438. _AFX_INLINE BOOL operator<(const char* s1, const CString& s2)
  439. { return s2.Compare(s1) > 0; }
  440. _AFX_INLINE BOOL operator>(const CString& s1, const CString& s2)
  441. { return s1.Compare(s2) > 0; }
  442. _AFX_INLINE BOOL operator>(const CString& s1, const char* s2)
  443. { return s1.Compare(s2) > 0; }
  444. _AFX_INLINE BOOL operator>(const char* s1, const CString& s2)
  445. { return s2.Compare(s1) < 0; }
  446. _AFX_INLINE BOOL operator<=(const CString& s1, const CString& s2)
  447. { return s1.Compare(s2) <= 0; }
  448. _AFX_INLINE BOOL operator<=(const CString& s1, const char* s2)
  449. { return s1.Compare(s2) <= 0; }
  450. _AFX_INLINE BOOL operator<=(const char* s1, const CString& s2)
  451. { return s2.Compare(s1) >= 0; }
  452. _AFX_INLINE BOOL operator>=(const CString& s1, const CString& s2)
  453. { return s1.Compare(s2) >= 0; }
  454. _AFX_INLINE BOOL operator>=(const CString& s1, const char* s2)
  455. { return s1.Compare(s2) >= 0; }
  456. _AFX_INLINE BOOL operator>=(const char* s1, const CString& s2)
  457. { return s2.Compare(s1) <= 0; }
  458. /////////////////////////////////////////////////////////////////////
  459. ////////////////////////////////////////////////////////////////////////////
  460. _AFXCOLL_INLINE int CWordArray::GetUpperBound() const
  461. { return m_nSize-1; }
  462. _AFXCOLL_INLINE void CWordArray::RemoveAll()
  463. { SetSize(0); }
  464. _AFXCOLL_INLINE WORD& CWordArray::ElementAt(int nIndex)
  465. { return m_pData[nIndex]; }
  466. _AFXCOLL_INLINE int CWordArray::Add(WORD newElement)
  467. { int nIndex = m_nSize;
  468. SetAtGrow(nIndex, newElement);
  469. return nIndex; }
  470. _AFXCOLL_INLINE WORD CWordArray::operator[](int nIndex) const
  471. { return GetAt(nIndex); }
  472. _AFXCOLL_INLINE WORD& CWordArray::operator[](int nIndex)
  473. { return ElementAt(nIndex); }
  474. ////////////////////////////////////////////////////////////////////////////
  475. _AFXCOLL_INLINE int CDWordArray::GetUpperBound() const
  476. { return m_nSize-1; }
  477. _AFXCOLL_INLINE void CDWordArray::RemoveAll()
  478. { SetSize(0); }
  479. _AFXCOLL_INLINE DWORD& CDWordArray::ElementAt(int nIndex)
  480. { return m_pData[nIndex]; }
  481. _AFXCOLL_INLINE int CDWordArray::Add(DWORD newElement)
  482. { int nIndex = m_nSize;
  483. SetAtGrow(nIndex, newElement);
  484. return nIndex; }
  485. _AFXCOLL_INLINE DWORD CDWordArray::operator[](int nIndex) const
  486. { return GetAt(nIndex); }
  487. _AFXCOLL_INLINE DWORD& CDWordArray::operator[](int nIndex)
  488. { return ElementAt(nIndex); }
  489. ////////////////////////////////////////////////////////////////////////////
  490. ////////////////////////////////////////////////////////////////////////////
  491. _AFXCOLL_INLINE int CPtrArray::GetUpperBound() const
  492. { return m_nSize-1; }
  493. _AFXCOLL_INLINE void CPtrArray::RemoveAll()
  494. { SetSize(0); }
  495. _AFXCOLL_INLINE void*& CPtrArray::ElementAt(int nIndex)
  496. { return m_pData[nIndex]; }
  497. _AFXCOLL_INLINE void* CPtrArray::operator[](int nIndex) const
  498. { return GetAt(nIndex); }
  499. _AFXCOLL_INLINE void*& CPtrArray::operator[](int nIndex)
  500. { return ElementAt(nIndex); }
  501. ////////////////////////////////////////////////////////////////////////////
  502. ////////////////////////////////////////////////////////////////////////////
  503. _AFXCOLL_INLINE int CStringArray::GetUpperBound() const
  504. { return m_nSize-1; }
  505. _AFXCOLL_INLINE void CStringArray::RemoveAll()
  506. { SetSize(0); }
  507. ////////////////////////////////////////////////////////////////////////////
  508. _AFXCOLL_INLINE int CPtrList::GetCount() const
  509. { return m_nCount; }
  510. _AFXCOLL_INLINE BOOL CPtrList::IsEmpty() const
  511. { return m_nCount == 0; }
  512. _AFXCOLL_INLINE void*& CPtrList::GetHead()
  513. { return m_pNodeHead->data; }
  514. _AFXCOLL_INLINE void* CPtrList::GetHead() const
  515. { return m_pNodeHead->data; }
  516. _AFXCOLL_INLINE void*& CPtrList::GetTail()
  517. { return m_pNodeTail->data; }
  518. _AFXCOLL_INLINE void* CPtrList::GetTail() const
  519. { return m_pNodeTail->data; }
  520. _AFXCOLL_INLINE POSITION CPtrList::GetHeadPosition() const
  521. { return (POSITION) m_pNodeHead; }
  522. _AFXCOLL_INLINE POSITION CPtrList::GetTailPosition() const
  523. { return (POSITION) m_pNodeTail; }
  524. _AFXCOLL_INLINE void*& CPtrList::GetNext(POSITION& rPosition) // return *Position++
  525. { CNode* pNode = (CNode*) rPosition;
  526. rPosition = (POSITION) pNode->pNext;
  527. return pNode->data; }
  528. _AFXCOLL_INLINE void* CPtrList::GetNext(POSITION& rPosition) const // return *Position++
  529. { CNode* pNode = (CNode*) rPosition;
  530. rPosition = (POSITION) pNode->pNext;
  531. return pNode->data; }
  532. _AFXCOLL_INLINE void*& CPtrList::GetPrev(POSITION& rPosition) // return *Position--
  533. { CNode* pNode = (CNode*) rPosition;
  534. rPosition = (POSITION) pNode->pPrev;
  535. return pNode->data; }
  536. _AFXCOLL_INLINE void* CPtrList::GetPrev(POSITION& rPosition) const // return *Position--
  537. { CNode* pNode = (CNode*) rPosition;
  538. rPosition = (POSITION) pNode->pPrev;
  539. return pNode->data; }
  540. _AFXCOLL_INLINE void*& CPtrList::GetAt(POSITION position)
  541. { CNode* pNode = (CNode*) position;
  542. return pNode->data; }
  543. _AFXCOLL_INLINE void* CPtrList::GetAt(POSITION position) const
  544. { CNode* pNode = (CNode*) position;
  545. return pNode->data; }
  546. _AFXCOLL_INLINE void CPtrList::SetAt(POSITION pos, void* newElement)
  547. { CNode* pNode = (CNode*) pos;
  548. pNode->data = newElement; }
  549. ////////////////////////////////////////////////////////////////////////////
  550. #endif