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.

446 lines
19 KiB

  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. // Inlines for AFX.H
  11. #ifdef _AFX_INLINE
  12. // CObject
  13. _AFX_INLINE CObject::CObject()
  14. { }
  15. _AFX_INLINE CObject::~CObject()
  16. { }
  17. _AFX_INLINE void CObject::Serialize(CArchive&)
  18. { /* CObject does not serialize anything by default */ }
  19. _AFX_INLINE void* PASCAL CObject::operator new(size_t, void* p)
  20. { return p; }
  21. #ifndef _DEBUG
  22. // _DEBUG versions in afxmem.cpp
  23. _AFX_INLINE void PASCAL CObject::operator delete(void* p)
  24. { ::operator delete(p); }
  25. #if _MSC_VER >= 1200
  26. _AFX_INLINE void PASCAL CObject::operator delete(void* p, void*)
  27. { ::operator delete(p); }
  28. #endif
  29. _AFX_INLINE void* PASCAL CObject::operator new(size_t nSize)
  30. { return ::operator new(nSize); }
  31. // _DEBUG versions in objcore.cpp
  32. #if defined(_AFXDLL) || (_MFC_VER < 0x0600)
  33. _AFX_INLINE void CObject::AssertValid() const
  34. { /* no asserts in release builds */ }
  35. _AFX_INLINE void CObject::Dump(CDumpContext&) const
  36. { /* no dumping in release builds */ }
  37. #endif //_AFXDLL
  38. #endif //!_DEBUG
  39. _AFX_INLINE const CObject* AFX_CDECL AfxDynamicDownCast(CRuntimeClass* pClass, const CObject* pObject)
  40. { return (const CObject*)AfxDynamicDownCast(pClass, (CObject*)pObject); }
  41. #ifdef _DEBUG
  42. _AFX_INLINE const CObject* AFX_CDECL AfxStaticDownCast(CRuntimeClass* pClass, const CObject* pObject)
  43. { return (const CObject*)AfxStaticDownCast(pClass, (CObject*)pObject); }
  44. #endif
  45. // exceptions
  46. _AFX_INLINE CException::~CException()
  47. { }
  48. _AFX_INLINE CSimpleException::CSimpleException()
  49. { m_bInitialized = FALSE; m_bLoaded = FALSE; }
  50. _AFX_INLINE CSimpleException::CSimpleException(BOOL bAutoDelete)
  51. : CException(bAutoDelete) { m_bInitialized = FALSE; m_bLoaded = FALSE; }
  52. #if !defined(_AFX_CORE_IMPL) || !defined(_AFXDLL) || defined(_DEBUG)
  53. _AFX_INLINE CSimpleException::~CSimpleException()
  54. { }
  55. #endif
  56. _AFX_INLINE CMemoryException::CMemoryException()
  57. : CSimpleException() { }
  58. _AFX_INLINE CMemoryException::CMemoryException(BOOL bAutoDelete, UINT nResourceID)
  59. : CSimpleException(bAutoDelete) { m_nResourceID = nResourceID; }
  60. _AFX_INLINE CMemoryException::~CMemoryException()
  61. { }
  62. _AFX_INLINE CNotSupportedException::CNotSupportedException()
  63. : CSimpleException() { }
  64. _AFX_INLINE CNotSupportedException::CNotSupportedException(BOOL bAutoDelete, UINT nResourceID)
  65. : CSimpleException(bAutoDelete) { m_nResourceID = nResourceID; }
  66. _AFX_INLINE CNotSupportedException::~CNotSupportedException()
  67. { }
  68. _AFX_INLINE CArchiveException::CArchiveException(int cause,
  69. LPCTSTR lpszFileName /* = NULL */)
  70. { m_cause = cause; m_strFileName = lpszFileName; }
  71. _AFX_INLINE CArchiveException::~CArchiveException()
  72. { }
  73. _AFX_INLINE CFileException::CFileException(int cause, LONG lOsError,
  74. LPCTSTR pstrFileName /* = NULL */)
  75. { m_cause = cause; m_lOsError = lOsError; m_strFileName = pstrFileName; }
  76. _AFX_INLINE CFileException::~CFileException()
  77. { }
  78. // CFile
  79. _AFX_INLINE CFile::operator HFILE() const
  80. { return (UINT)m_hFile; }
  81. _AFX_INLINE DWORD CFile::ReadHuge(void* lpBuffer, DWORD dwCount)
  82. { return (DWORD)Read(lpBuffer, (UINT)dwCount); }
  83. _AFX_INLINE void CFile::WriteHuge(const void* lpBuffer, DWORD dwCount)
  84. { Write(lpBuffer, (UINT)dwCount); }
  85. _AFX_INLINE DWORD CFile::SeekToEnd()
  86. { return Seek(0, CFile::end); }
  87. _AFX_INLINE void CFile::SeekToBegin()
  88. { Seek(0, CFile::begin); }
  89. _AFX_INLINE void CFile::SetFilePath(LPCTSTR lpszNewName)
  90. {
  91. ASSERT_VALID(this);
  92. #if _MFC_VER >= 0x0600
  93. ASSERT(AfxIsValidString(lpszNewName));
  94. #else
  95. ASSERT(AfxIsValidString(lpszNewName, FALSE));
  96. #endif
  97. m_strFileName = lpszNewName;
  98. }
  99. // CFileFind
  100. _AFX_INLINE BOOL CFileFind::IsReadOnly() const
  101. { return MatchesMask(FILE_ATTRIBUTE_READONLY); }
  102. _AFX_INLINE BOOL CFileFind::IsDirectory() const
  103. { return MatchesMask(FILE_ATTRIBUTE_DIRECTORY); }
  104. _AFX_INLINE BOOL CFileFind::IsCompressed() const
  105. { return MatchesMask(FILE_ATTRIBUTE_COMPRESSED); }
  106. _AFX_INLINE BOOL CFileFind::IsSystem() const
  107. { return MatchesMask(FILE_ATTRIBUTE_SYSTEM); }
  108. _AFX_INLINE BOOL CFileFind::IsHidden() const
  109. { return MatchesMask(FILE_ATTRIBUTE_HIDDEN); }
  110. _AFX_INLINE BOOL CFileFind::IsTemporary() const
  111. { return MatchesMask(FILE_ATTRIBUTE_TEMPORARY); }
  112. _AFX_INLINE BOOL CFileFind::IsNormal() const
  113. { return MatchesMask(FILE_ATTRIBUTE_NORMAL); }
  114. _AFX_INLINE BOOL CFileFind::IsArchived() const
  115. { return MatchesMask(FILE_ATTRIBUTE_ARCHIVE); }
  116. // CString
  117. _AFX_INLINE CStringData* CString::GetData() const
  118. { ASSERT(m_pchData != NULL); return ((CStringData*)m_pchData)-1; }
  119. _AFX_INLINE void CString::Init()
  120. { m_pchData = afxEmptyString.m_pchData; }
  121. #if !defined( _AFXDLL) && _MFC_VER >= 0x0600
  122. _AFX_INLINE CString::CString()
  123. { m_pchData = afxEmptyString.m_pchData; }
  124. #endif
  125. _AFX_INLINE CString::CString(const unsigned char* lpsz)
  126. { Init(); *this = (LPCSTR)lpsz; }
  127. _AFX_INLINE const CString& CString::operator=(const unsigned char* lpsz)
  128. { *this = (LPCSTR)lpsz; return *this; }
  129. #ifdef _UNICODE
  130. _AFX_INLINE const CString& CString::operator+=(char ch)
  131. { *this += (TCHAR)ch; return *this; }
  132. _AFX_INLINE const CString& CString::operator=(char ch)
  133. { *this = (TCHAR)ch; return *this; }
  134. _AFX_INLINE CString AFXAPI operator+(const CString& string, char ch)
  135. { return string + (TCHAR)ch; }
  136. _AFX_INLINE CString AFXAPI operator+(char ch, const CString& string)
  137. { return (TCHAR)ch + string; }
  138. #endif
  139. _AFX_INLINE int CString::GetLength() const
  140. { return GetData()->nDataLength; }
  141. _AFX_INLINE int CString::GetAllocLength() const
  142. { return GetData()->nAllocLength; }
  143. _AFX_INLINE BOOL CString::IsEmpty() const
  144. { return GetData()->nDataLength == 0; }
  145. _AFX_INLINE CString::operator LPCTSTR() const
  146. { return m_pchData; }
  147. _AFX_INLINE int PASCAL CString::SafeStrlen(LPCTSTR lpsz)
  148. { return (lpsz == NULL) ? 0 : lstrlen(lpsz); }
  149. // CString support (windows specific)
  150. _AFX_INLINE int CString::Compare(LPCTSTR lpsz) const
  151. { ASSERT(AfxIsValidString(lpsz)); return _tcscmp(m_pchData, lpsz); } // MBCS/Unicode aware
  152. _AFX_INLINE int CString::CompareNoCase(LPCTSTR lpsz) const
  153. { ASSERT(AfxIsValidString(lpsz)); return _tcsicmp(m_pchData, lpsz); } // MBCS/Unicode aware
  154. // CString::Collate is often slower than Compare but is MBSC/Unicode
  155. // aware as well as locale-sensitive with respect to sort order.
  156. _AFX_INLINE int CString::Collate(LPCTSTR lpsz) const
  157. { ASSERT(AfxIsValidString(lpsz)); return _tcscoll(m_pchData, lpsz); } // locale sensitive
  158. #if _MFC_VER >= 0x0600
  159. _AFX_INLINE int CString::CollateNoCase(LPCTSTR lpsz) const
  160. { ASSERT(AfxIsValidString(lpsz)); return _tcsicoll(m_pchData, lpsz); } // locale sensitive
  161. #endif
  162. _AFX_INLINE TCHAR CString::GetAt(int nIndex) const
  163. {
  164. ASSERT(nIndex >= 0);
  165. ASSERT(nIndex < GetData()->nDataLength);
  166. return m_pchData[nIndex];
  167. }
  168. _AFX_INLINE TCHAR CString::operator[](int nIndex) const
  169. {
  170. // same as GetAt
  171. ASSERT(nIndex >= 0);
  172. ASSERT(nIndex < GetData()->nDataLength);
  173. return m_pchData[nIndex];
  174. }
  175. _AFX_INLINE bool AFXAPI operator==(const CString& s1, const CString& s2)
  176. { return s1.Compare(s2) == 0; }
  177. _AFX_INLINE bool AFXAPI operator==(const CString& s1, LPCTSTR s2)
  178. { return s1.Compare(s2) == 0; }
  179. _AFX_INLINE bool AFXAPI operator==(LPCTSTR s1, const CString& s2)
  180. { return s2.Compare(s1) == 0; }
  181. _AFX_INLINE bool AFXAPI operator!=(const CString& s1, const CString& s2)
  182. { return s1.Compare(s2) != 0; }
  183. _AFX_INLINE bool AFXAPI operator!=(const CString& s1, LPCTSTR s2)
  184. { return s1.Compare(s2) != 0; }
  185. _AFX_INLINE bool AFXAPI operator!=(LPCTSTR s1, const CString& s2)
  186. { return s2.Compare(s1) != 0; }
  187. _AFX_INLINE bool AFXAPI operator<(const CString& s1, const CString& s2)
  188. { return s1.Compare(s2) < 0; }
  189. _AFX_INLINE bool AFXAPI operator<(const CString& s1, LPCTSTR s2)
  190. { return s1.Compare(s2) < 0; }
  191. _AFX_INLINE bool AFXAPI operator<(LPCTSTR s1, const CString& s2)
  192. { return s2.Compare(s1) > 0; }
  193. _AFX_INLINE bool AFXAPI operator>(const CString& s1, const CString& s2)
  194. { return s1.Compare(s2) > 0; }
  195. _AFX_INLINE bool AFXAPI operator>(const CString& s1, LPCTSTR s2)
  196. { return s1.Compare(s2) > 0; }
  197. _AFX_INLINE bool AFXAPI operator>(LPCTSTR s1, const CString& s2)
  198. { return s2.Compare(s1) < 0; }
  199. _AFX_INLINE bool AFXAPI operator<=(const CString& s1, const CString& s2)
  200. { return s1.Compare(s2) <= 0; }
  201. _AFX_INLINE bool AFXAPI operator<=(const CString& s1, LPCTSTR s2)
  202. { return s1.Compare(s2) <= 0; }
  203. _AFX_INLINE bool AFXAPI operator<=(LPCTSTR s1, const CString& s2)
  204. { return s2.Compare(s1) >= 0; }
  205. _AFX_INLINE bool AFXAPI operator>=(const CString& s1, const CString& s2)
  206. { return s1.Compare(s2) >= 0; }
  207. _AFX_INLINE bool AFXAPI operator>=(const CString& s1, LPCTSTR s2)
  208. { return s1.Compare(s2) >= 0; }
  209. _AFX_INLINE bool AFXAPI operator>=(LPCTSTR s1, const CString& s2)
  210. { return s2.Compare(s1) <= 0; }
  211. // CTime and CTimeSpan
  212. #if !defined(_AFX_CORE_IMPL) || !defined(_AFXDLL) || defined(_DEBUG)
  213. _AFX_INLINE CTimeSpan::CTimeSpan()
  214. { }
  215. #endif
  216. _AFX_INLINE CTimeSpan::CTimeSpan(time_t time)
  217. { m_timeSpan = time; }
  218. _AFX_INLINE CTimeSpan::CTimeSpan(LONG lDays, int nHours, int nMins, int nSecs)
  219. { m_timeSpan = nSecs + 60* (nMins + 60* (nHours + 24* lDays)); }
  220. _AFX_INLINE CTimeSpan::CTimeSpan(const CTimeSpan& timeSpanSrc)
  221. { m_timeSpan = timeSpanSrc.m_timeSpan; }
  222. _AFX_INLINE const CTimeSpan& CTimeSpan::operator=(const CTimeSpan& timeSpanSrc)
  223. { m_timeSpan = timeSpanSrc.m_timeSpan; return *this; }
  224. _AFX_INLINE LONG_PTR CTimeSpan::GetDays() const
  225. { return m_timeSpan / (24*3600L); }
  226. _AFX_INLINE LONG_PTR CTimeSpan::GetTotalHours() const
  227. { return m_timeSpan/3600; }
  228. _AFX_INLINE int CTimeSpan::GetHours() const
  229. { return (int)(GetTotalHours() - GetDays()*24); }
  230. _AFX_INLINE LONG_PTR CTimeSpan::GetTotalMinutes() const
  231. { return m_timeSpan/60; }
  232. _AFX_INLINE int CTimeSpan::GetMinutes() const
  233. { return (int)(GetTotalMinutes() - GetTotalHours()*60); }
  234. _AFX_INLINE LONG_PTR CTimeSpan::GetTotalSeconds() const
  235. { return m_timeSpan; }
  236. _AFX_INLINE int CTimeSpan::GetSeconds() const
  237. { return (int)(GetTotalSeconds() - GetTotalMinutes()*60); }
  238. _AFX_INLINE CTimeSpan CTimeSpan::operator-(CTimeSpan timeSpan) const
  239. { return CTimeSpan(m_timeSpan - timeSpan.m_timeSpan); }
  240. _AFX_INLINE CTimeSpan CTimeSpan::operator+(CTimeSpan timeSpan) const
  241. { return CTimeSpan(m_timeSpan + timeSpan.m_timeSpan); }
  242. _AFX_INLINE const CTimeSpan& CTimeSpan::operator+=(CTimeSpan timeSpan)
  243. { m_timeSpan += timeSpan.m_timeSpan; return *this; }
  244. _AFX_INLINE const CTimeSpan& CTimeSpan::operator-=(CTimeSpan timeSpan)
  245. { m_timeSpan -= timeSpan.m_timeSpan; return *this; }
  246. _AFX_INLINE BOOL CTimeSpan::operator==(CTimeSpan timeSpan) const
  247. { return m_timeSpan == timeSpan.m_timeSpan; }
  248. _AFX_INLINE BOOL CTimeSpan::operator!=(CTimeSpan timeSpan) const
  249. { return m_timeSpan != timeSpan.m_timeSpan; }
  250. _AFX_INLINE BOOL CTimeSpan::operator<(CTimeSpan timeSpan) const
  251. { return m_timeSpan < timeSpan.m_timeSpan; }
  252. _AFX_INLINE BOOL CTimeSpan::operator>(CTimeSpan timeSpan) const
  253. { return m_timeSpan > timeSpan.m_timeSpan; }
  254. _AFX_INLINE BOOL CTimeSpan::operator<=(CTimeSpan timeSpan) const
  255. { return m_timeSpan <= timeSpan.m_timeSpan; }
  256. _AFX_INLINE BOOL CTimeSpan::operator>=(CTimeSpan timeSpan) const
  257. { return m_timeSpan >= timeSpan.m_timeSpan; }
  258. #if !defined(_AFX_CORE_IMPL) || !defined(_AFXDLL) || defined(_DEBUG)
  259. _AFX_INLINE CTime::CTime()
  260. { }
  261. #endif
  262. _AFX_INLINE CTime::CTime(time_t time)
  263. { m_time = time; }
  264. #if !defined(_AFX_CORE_IMPL) || !defined(_AFXDLL) || defined(_DEBUG)
  265. _AFX_INLINE CTime::CTime(const CTime& timeSrc)
  266. { m_time = timeSrc.m_time; }
  267. #endif
  268. _AFX_INLINE const CTime& CTime::operator=(const CTime& timeSrc)
  269. { m_time = timeSrc.m_time; return *this; }
  270. _AFX_INLINE const CTime& CTime::operator=(time_t t)
  271. { m_time = t; return *this; }
  272. _AFX_INLINE time_t CTime::GetTime() const
  273. { return m_time; }
  274. _AFX_INLINE int CTime::GetYear() const
  275. { return (GetLocalTm(NULL)->tm_year) + 1900; }
  276. _AFX_INLINE int CTime::GetMonth() const
  277. { return GetLocalTm(NULL)->tm_mon + 1; }
  278. _AFX_INLINE int CTime::GetDay() const
  279. { return GetLocalTm(NULL)->tm_mday; }
  280. _AFX_INLINE int CTime::GetHour() const
  281. { return GetLocalTm(NULL)->tm_hour; }
  282. _AFX_INLINE int CTime::GetMinute() const
  283. { return GetLocalTm(NULL)->tm_min; }
  284. _AFX_INLINE int CTime::GetSecond() const
  285. { return GetLocalTm(NULL)->tm_sec; }
  286. _AFX_INLINE int CTime::GetDayOfWeek() const
  287. { return GetLocalTm(NULL)->tm_wday + 1; }
  288. _AFX_INLINE CTimeSpan CTime::operator-(CTime time) const
  289. { return CTimeSpan(m_time - time.m_time); }
  290. _AFX_INLINE CTime CTime::operator-(CTimeSpan timeSpan) const
  291. { return CTime(m_time - timeSpan.m_timeSpan); }
  292. _AFX_INLINE CTime CTime::operator+(CTimeSpan timeSpan) const
  293. { return CTime(m_time + timeSpan.m_timeSpan); }
  294. _AFX_INLINE const CTime& CTime::operator+=(CTimeSpan timeSpan)
  295. { m_time += timeSpan.m_timeSpan; return *this; }
  296. _AFX_INLINE const CTime& CTime::operator-=(CTimeSpan timeSpan)
  297. { m_time -= timeSpan.m_timeSpan; return *this; }
  298. _AFX_INLINE BOOL CTime::operator==(CTime time) const
  299. { return m_time == time.m_time; }
  300. _AFX_INLINE BOOL CTime::operator!=(CTime time) const
  301. { return m_time != time.m_time; }
  302. _AFX_INLINE BOOL CTime::operator<(CTime time) const
  303. { return m_time < time.m_time; }
  304. _AFX_INLINE BOOL CTime::operator>(CTime time) const
  305. { return m_time > time.m_time; }
  306. _AFX_INLINE BOOL CTime::operator<=(CTime time) const
  307. { return m_time <= time.m_time; }
  308. _AFX_INLINE BOOL CTime::operator>=(CTime time) const
  309. { return m_time >= time.m_time; }
  310. // CArchive
  311. _AFX_INLINE BOOL CArchive::IsLoading() const
  312. { return (m_nMode & CArchive::load) != 0; }
  313. _AFX_INLINE BOOL CArchive::IsStoring() const
  314. { return (m_nMode & CArchive::load) == 0; }
  315. _AFX_INLINE BOOL CArchive::IsByteSwapping() const
  316. { return (m_nMode & CArchive::bNoByteSwap) == 0; }
  317. _AFX_INLINE BOOL CArchive::IsBufferEmpty() const
  318. { return m_lpBufCur == m_lpBufMax; }
  319. _AFX_INLINE CFile* CArchive::GetFile() const
  320. { return m_pFile; }
  321. _AFX_INLINE void CArchive::SetObjectSchema(UINT nSchema)
  322. { m_nObjectSchema = nSchema; }
  323. _AFX_INLINE void CArchive::SetStoreParams(UINT nHashSize, UINT nBlockSize)
  324. {
  325. ASSERT(IsStoring());
  326. ASSERT(m_pStoreMap == NULL); // must be before first object written
  327. m_nHashSize = nHashSize;
  328. m_nGrowSize = nBlockSize;
  329. }
  330. _AFX_INLINE void CArchive::SetLoadParams(UINT nGrowBy)
  331. {
  332. ASSERT(IsLoading());
  333. ASSERT(m_pLoadArray == NULL); // must be before first object read
  334. m_nGrowSize = nGrowBy;
  335. }
  336. _AFX_INLINE CArchive& CArchive::operator<<(int i)
  337. { return CArchive::operator<<((LONG)i); }
  338. _AFX_INLINE CArchive& CArchive::operator<<(unsigned u)
  339. { return CArchive::operator<<((LONG)u); }
  340. _AFX_INLINE CArchive& CArchive::operator<<(short w)
  341. { return CArchive::operator<<((WORD)w); }
  342. _AFX_INLINE CArchive& CArchive::operator<<(char ch)
  343. { return CArchive::operator<<((BYTE)ch); }
  344. _AFX_INLINE CArchive& CArchive::operator<<(BYTE by)
  345. { if (m_lpBufCur + sizeof(BYTE) > m_lpBufMax) Flush();
  346. *(UNALIGNED BYTE*)m_lpBufCur = by; m_lpBufCur += sizeof(BYTE); return *this; }
  347. #ifndef _AFX_BYTESWAP
  348. _AFX_INLINE CArchive& CArchive::operator<<(WORD w)
  349. { if (m_lpBufCur + sizeof(WORD) > m_lpBufMax) Flush();
  350. *(UNALIGNED WORD*)m_lpBufCur = w; m_lpBufCur += sizeof(WORD); return *this; }
  351. _AFX_INLINE CArchive& CArchive::operator<<(LONG l)
  352. { if (m_lpBufCur + sizeof(LONG) > m_lpBufMax) Flush();
  353. *(UNALIGNED LONG*)m_lpBufCur = l; m_lpBufCur += sizeof(LONG); return *this; }
  354. _AFX_INLINE CArchive& CArchive::operator<<(DWORD dw)
  355. { if (m_lpBufCur + sizeof(DWORD) > m_lpBufMax) Flush();
  356. *(UNALIGNED DWORD*)m_lpBufCur = dw; m_lpBufCur += sizeof(DWORD); return *this; }
  357. _AFX_INLINE CArchive& CArchive::operator<<(ULONGLONG qw)
  358. { if (m_lpBufCur + sizeof(ULONGLONG) > m_lpBufMax) Flush();
  359. *(UNALIGNED ULONGLONG*)m_lpBufCur = qw; m_lpBufCur += sizeof(ULONGLONG); return *this; }
  360. _AFX_INLINE CArchive& CArchive::operator<<(float f)
  361. { if (m_lpBufCur + sizeof(float) > m_lpBufMax) Flush();
  362. *(UNALIGNED _AFX_FLOAT*)m_lpBufCur = *(_AFX_FLOAT*)&f; m_lpBufCur += sizeof(float); return *this;
  363. }
  364. _AFX_INLINE CArchive& CArchive::operator<<(double d)
  365. { if (m_lpBufCur + sizeof(double) > m_lpBufMax) Flush();
  366. *(UNALIGNED _AFX_DOUBLE*)m_lpBufCur = *(_AFX_DOUBLE*)&d; m_lpBufCur += sizeof(double); return *this; }
  367. #endif
  368. _AFX_INLINE CArchive& CArchive::operator>>(int& i)
  369. { return CArchive::operator>>((LONG&)i); }
  370. _AFX_INLINE CArchive& CArchive::operator>>(unsigned& u)
  371. { return CArchive::operator>>((LONG&)u); }
  372. _AFX_INLINE CArchive& CArchive::operator>>(short& w)
  373. { return CArchive::operator>>((WORD&)w); }
  374. _AFX_INLINE CArchive& CArchive::operator>>(char& ch)
  375. { return CArchive::operator>>((BYTE&)ch); }
  376. _AFX_INLINE CArchive& CArchive::operator>>(BYTE& by)
  377. { if (m_lpBufCur + sizeof(BYTE) > m_lpBufMax)
  378. FillBuffer(UINT(sizeof(BYTE) - (m_lpBufMax - m_lpBufCur)));
  379. by = *(UNALIGNED BYTE*)m_lpBufCur; m_lpBufCur += sizeof(BYTE); return *this; }
  380. #ifndef _AFX_BYTESWAP
  381. _AFX_INLINE CArchive& CArchive::operator>>(WORD& w)
  382. { if (m_lpBufCur + sizeof(WORD) > m_lpBufMax)
  383. FillBuffer(UINT(sizeof(WORD) - (m_lpBufMax - m_lpBufCur)));
  384. w = *(UNALIGNED WORD*)m_lpBufCur; m_lpBufCur += sizeof(WORD); return *this; }
  385. _AFX_INLINE CArchive& CArchive::operator>>(DWORD& dw)
  386. { if (m_lpBufCur + sizeof(DWORD) > m_lpBufMax)
  387. FillBuffer(UINT(sizeof(DWORD) - (m_lpBufMax - m_lpBufCur)));
  388. dw = *(UNALIGNED DWORD*)m_lpBufCur; m_lpBufCur += sizeof(DWORD); return *this; }
  389. _AFX_INLINE CArchive& CArchive::operator>>(ULONGLONG& qw)
  390. { if (m_lpBufCur + sizeof(ULONGLONG) > m_lpBufMax)
  391. FillBuffer(UINT(sizeof(ULONGLONG) - (m_lpBufMax - m_lpBufCur)));
  392. qw = *(UNALIGNED ULONGLONG*)m_lpBufCur; m_lpBufCur += sizeof(ULONGLONG); return *this; }
  393. _AFX_INLINE CArchive& CArchive::operator>>(float& f)
  394. { if (m_lpBufCur + sizeof(float) > m_lpBufMax)
  395. FillBuffer(UINT(sizeof(float) - (m_lpBufMax - m_lpBufCur)));
  396. *(_AFX_FLOAT*)&f = *(UNALIGNED _AFX_FLOAT*)m_lpBufCur; m_lpBufCur += sizeof(float); return *this; }
  397. _AFX_INLINE CArchive& CArchive::operator>>(double& d)
  398. { if (m_lpBufCur + sizeof(double) > m_lpBufMax)
  399. FillBuffer(UINT(sizeof(double) - (m_lpBufMax - m_lpBufCur)));
  400. *(_AFX_DOUBLE*)&d = *(UNALIGNED _AFX_DOUBLE*)m_lpBufCur; m_lpBufCur += sizeof(double); return *this; }
  401. _AFX_INLINE CArchive& CArchive::operator>>(LONG& l)
  402. { if (m_lpBufCur + sizeof(LONG) > m_lpBufMax)
  403. FillBuffer(UINT(sizeof(LONG) - (m_lpBufMax - m_lpBufCur)));
  404. l = *(UNALIGNED LONG*)m_lpBufCur; m_lpBufCur += sizeof(LONG); return *this; }
  405. #endif
  406. _AFX_INLINE CArchive::CArchive(const CArchive& /* arSrc */)
  407. { }
  408. _AFX_INLINE void CArchive::operator=(const CArchive& /* arSrc */)
  409. { }
  410. _AFX_INLINE CArchive& AFXAPI operator<<(CArchive& ar, const CObject* pOb)
  411. { ar.WriteObject(pOb); return ar; }
  412. _AFX_INLINE CArchive& AFXAPI operator>>(CArchive& ar, CObject*& pOb)
  413. { pOb = ar.ReadObject(NULL); return ar; }
  414. _AFX_INLINE CArchive& AFXAPI operator>>(CArchive& ar, const CObject*& pOb)
  415. { pOb = ar.ReadObject(NULL); return ar; }
  416. // CDumpContext
  417. _AFX_INLINE int CDumpContext::GetDepth() const
  418. { return m_nDepth; }
  419. _AFX_INLINE void CDumpContext::SetDepth(int nNewDepth)
  420. { m_nDepth = nNewDepth; }
  421. _AFX_INLINE CDumpContext::CDumpContext(const CDumpContext& /* dcSrc */)
  422. { }
  423. _AFX_INLINE void CDumpContext::operator=(const CDumpContext& /* dcSrc */)
  424. { }
  425. /////////////////////////////////////////////////////////////////////////////
  426. #endif //_AFX_INLINE