afx.inl 19 KB

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