Annotation of mstools/mfc/include/afx.inl, revision 1.1

1.1     ! root        1: // Microsoft Foundation Classes C++ library.
        !             2: // Copyright (C) 1992 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 Microsoft
        !             7: // QuickHelp documentation provided with the library.
        !             8: // See these sources for detailed information regarding the
        !             9: // Microsoft Foundation Classes product.
        !            10: 
        !            11: #ifndef __AFX_INL__
        !            12: #define __AFX_INL__
        !            13: 
        !            14: #ifdef _DEBUG
        !            15: extern char BASED_CODE _afxSzAfxInl[]; // defined in dumpcont.cpp
        !            16: #undef THIS_FILE
        !            17: #define THIS_FILE _afxSzAfxInl
        !            18: #endif
        !            19: 
        !            20: // CObject inline functions
        !            21: inline CObject::~CObject() 
        !            22:        { }
        !            23: 
        !            24: inline void* CObject::operator new(size_t, void* p) 
        !            25:        { return p; } 
        !            26: 
        !            27: #ifndef _DEBUG
        !            28: // _DEBUG versions in memory.cpp
        !            29: inline void CObject::operator delete(void* p) 
        !            30:        { ::operator delete(p); }
        !            31: inline void* CObject::operator new(size_t nSize) 
        !            32:        { return ::operator new(nSize); }
        !            33: #endif
        !            34: 
        !            35: inline CObject::CObject() 
        !            36:        { }
        !            37: inline CObject::CObject(const CObject& /* objectSrc */) 
        !            38:        { }
        !            39: inline void CObject::operator=(const CObject& /* objectSrc */) 
        !            40:        { }
        !            41: inline void CObject::Serialize(CArchive&)
        !            42:        { /* CObject does not defaultly serialize anything */ }
        !            43: 
        !            44: 
        !            45: 
        !            46: // CException inline functions
        !            47: inline CExceptionLink::CExceptionLink(CExceptionLink* NEAR& rLinkTop)
        !            48:        {
        !            49:                m_pLinkPrev = rLinkTop;
        !            50:                rLinkTop = this;
        !            51:        }
        !            52: 
        !            53: inline CMemoryException::CMemoryException() 
        !            54:        { }
        !            55: inline CNotSupportedException::CNotSupportedException() 
        !            56:        { }
        !            57: inline CArchiveException::CArchiveException(int cause /* = CArchiveException::none */)
        !            58:        { m_cause = cause; }
        !            59: inline CFileException::CFileException(int cause /* = CFileException::none */, LONG lOsError /* = -1 */)
        !            60:        { m_cause = cause; m_lOsError = lOsError; }
        !            61: 
        !            62: 
        !            63: // CFile inline functions
        !            64: inline DWORD CFile::SeekToEnd()
        !            65:        { return this->Seek(0, CFile::end); }
        !            66: inline void CFile::SeekToBegin()
        !            67:        { this->Seek(0, CFile::begin); }
        !            68: 
        !            69: // CString inline functions
        !            70: inline int CString::GetLength() const
        !            71:        { return m_nDataLength; }
        !            72: inline BOOL CString::IsEmpty() const
        !            73:        { return m_nDataLength == 0; }
        !            74: inline CString::operator const char*() const
        !            75:        { return (const char*)m_pchData; }
        !            76: inline int CString::Compare(const char* psz) const
        !            77:        { return strcmp(m_pchData, psz); }
        !            78: inline int CString::CompareNoCase(const char* psz) const
        !            79:        { return _stricmp(m_pchData, psz); }
        !            80: inline int CString::Collate(const char* psz) const
        !            81:        { return strcoll(m_pchData, psz); }
        !            82: inline void CString::MakeUpper()
        !            83:        { _strupr(m_pchData); }
        !            84: inline void CString::MakeLower()
        !            85:        { _strlwr(m_pchData); }
        !            86: inline void CString::MakeReverse()
        !            87:        { _strrev(m_pchData); }
        !            88: inline char CString::GetAt(int nIndex) const
        !            89:        {
        !            90:                ASSERT(nIndex >= 0);
        !            91:                ASSERT(nIndex < m_nDataLength);
        !            92: 
        !            93:                return m_pchData[nIndex];
        !            94:        }
        !            95: inline char CString::operator[](int nIndex) const
        !            96:        {
        !            97:                // same as GetAt
        !            98: 
        !            99:                ASSERT(nIndex >= 0);
        !           100:                ASSERT(nIndex < m_nDataLength);
        !           101: 
        !           102:                return m_pchData[nIndex];
        !           103:        }
        !           104: inline void CString::SetAt(int nIndex, char ch)
        !           105:        {
        !           106:                ASSERT(nIndex >= 0);
        !           107:                ASSERT(nIndex < m_nDataLength);
        !           108:                ASSERT(ch != 0);
        !           109: 
        !           110:                m_pchData[nIndex] = ch;
        !           111:        }
        !           112: inline BOOL operator==(const CString& s1, const CString& s2)
        !           113:        { return s1.Compare(s2) == 0; }
        !           114: inline BOOL operator==(const CString& s1, const char* s2)
        !           115:        { return s1.Compare(s2) == 0; }
        !           116: inline BOOL operator==(const char* s1, const CString& s2)
        !           117:        { return s2.Compare(s1) == 0; }
        !           118: inline BOOL operator!=(const CString& s1, const CString& s2)
        !           119:        { return s1.Compare(s2) != 0; }
        !           120: inline BOOL operator!=(const CString& s1, const char* s2)
        !           121:        { return s1.Compare(s2) != 0; }
        !           122: inline BOOL operator!=(const char* s1, const CString& s2)
        !           123:        { return s2.Compare(s1) != 0; }
        !           124: inline BOOL operator<(const CString& s1, const CString& s2)
        !           125:        { return s1.Compare(s2) < 0; }
        !           126: inline BOOL operator<(const CString& s1, const char* s2)
        !           127:        { return s1.Compare(s2) < 0; }
        !           128: inline BOOL operator<(const char* s1, const CString& s2)
        !           129:        { return s2.Compare(s1) > 0; }
        !           130: inline BOOL operator>(const CString& s1, const CString& s2)
        !           131:        { return s1.Compare(s2) > 0; }
        !           132: inline BOOL operator>(const CString& s1, const char* s2)
        !           133:        { return s1.Compare(s2) > 0; }
        !           134: inline BOOL operator>(const char* s1, const CString& s2)
        !           135:        { return s2.Compare(s1) < 0; }
        !           136: inline BOOL operator<=(const CString& s1, const CString& s2)
        !           137:        { return s1.Compare(s2) <= 0; }
        !           138: inline BOOL operator<=(const CString& s1, const char* s2)
        !           139:        { return s1.Compare(s2) <= 0; }
        !           140: inline BOOL operator<=(const char* s1, const CString& s2)
        !           141:        { return s2.Compare(s1) >= 0; }
        !           142: inline BOOL operator>=(const CString& s1, const CString& s2)
        !           143:        { return s1.Compare(s2) >= 0; }
        !           144: inline BOOL operator>=(const CString& s1, const char* s2)
        !           145:        { return s1.Compare(s2) >= 0; }
        !           146: inline BOOL operator>=(const char* s1, const CString& s2)
        !           147:        { return s2.Compare(s1) <= 0; }
        !           148: 
        !           149: // CTime and CTimeSpan inline functions
        !           150: inline CTimeSpan::CTimeSpan() 
        !           151:        { }
        !           152: inline CTimeSpan::CTimeSpan(time_t time) 
        !           153:        { m_timeSpan = time; }
        !           154: inline CTimeSpan::CTimeSpan(LONG lDays, int nHours, int nMins, int nSecs)
        !           155:        { m_timeSpan = nSecs + 60* (nMins + 60* (nHours + 24* lDays)); }
        !           156: inline CTimeSpan::CTimeSpan(const CTimeSpan& timeSpanSrc) 
        !           157:        { m_timeSpan = timeSpanSrc.m_timeSpan; }
        !           158: inline const CTimeSpan& CTimeSpan::operator=(const CTimeSpan& timeSpanSrc)
        !           159:        { m_timeSpan = timeSpanSrc.m_timeSpan; return *this; }
        !           160: inline LONG CTimeSpan::GetDays() const
        !           161:        { return m_timeSpan / (24*3600L); }
        !           162: inline LONG CTimeSpan::GetTotalHours() const
        !           163:        { return m_timeSpan/3600; }
        !           164: inline int CTimeSpan::GetHours() const
        !           165:        { return (int)(GetTotalHours() - GetDays()*24); }
        !           166: inline LONG CTimeSpan::GetTotalMinutes() const
        !           167:        { return m_timeSpan/60; }
        !           168: inline int CTimeSpan::GetMinutes() const
        !           169:        { return (int)(GetTotalMinutes() - GetTotalHours()*60); }
        !           170: inline LONG CTimeSpan::GetTotalSeconds() const
        !           171:        { return m_timeSpan; }
        !           172: inline int CTimeSpan::GetSeconds() const
        !           173:        { return (int)(GetTotalSeconds() - GetTotalMinutes()*60); }
        !           174: inline CTimeSpan CTimeSpan::operator-(CTimeSpan timeSpan) const
        !           175:        { return CTimeSpan(m_timeSpan - timeSpan.m_timeSpan); }
        !           176: inline CTimeSpan CTimeSpan::operator+(CTimeSpan timeSpan) const
        !           177:        { return CTimeSpan(m_timeSpan + timeSpan.m_timeSpan); }
        !           178: inline const CTimeSpan& CTimeSpan::operator+=(CTimeSpan timeSpan)
        !           179:        { m_timeSpan += timeSpan.m_timeSpan; return *this; }
        !           180: inline const CTimeSpan& CTimeSpan::operator-=(CTimeSpan timeSpan)
        !           181:        { m_timeSpan -= timeSpan.m_timeSpan; return *this; }
        !           182: inline BOOL CTimeSpan::operator==(CTimeSpan timeSpan) const
        !           183:        { return m_timeSpan == timeSpan.m_timeSpan; }
        !           184: inline BOOL CTimeSpan::operator!=(CTimeSpan timeSpan) const
        !           185:        { return m_timeSpan != timeSpan.m_timeSpan; }
        !           186: inline BOOL CTimeSpan::operator<(CTimeSpan timeSpan) const
        !           187:        { return m_timeSpan < timeSpan.m_timeSpan; }
        !           188: inline BOOL CTimeSpan::operator>(CTimeSpan timeSpan) const
        !           189:        { return m_timeSpan > timeSpan.m_timeSpan; }
        !           190: inline BOOL CTimeSpan::operator<=(CTimeSpan timeSpan) const
        !           191:        { return m_timeSpan <= timeSpan.m_timeSpan; }
        !           192: inline BOOL CTimeSpan::operator>=(CTimeSpan timeSpan) const
        !           193:        { return m_timeSpan >= timeSpan.m_timeSpan; }
        !           194: 
        !           195: 
        !           196: inline CTime::CTime()
        !           197:        { }
        !           198: inline CTime::CTime(time_t time) 
        !           199:        { m_time = time; }
        !           200: inline CTime::CTime(const CTime& timeSrc) 
        !           201:        { m_time = timeSrc.m_time; }
        !           202: inline const CTime& CTime::operator=(const CTime& timeSrc)
        !           203:        { m_time = timeSrc.m_time; return *this; }
        !           204: inline const CTime& CTime::operator=(time_t t)
        !           205:        { m_time = t; return *this; }
        !           206: inline time_t   CTime::GetTime() const
        !           207:        { return m_time; }
        !           208: inline int CTime::GetYear() const
        !           209:        { return (GetLocalTm(NULL)->tm_year) + 1900; }
        !           210: inline int CTime::GetMonth() const
        !           211:        { return GetLocalTm(NULL)->tm_mon + 1; }
        !           212: inline int CTime::GetDay() const 
        !           213:        { return GetLocalTm(NULL)->tm_mday; }
        !           214: inline int CTime::GetHour() const
        !           215:        { return GetLocalTm(NULL)->tm_hour; }
        !           216: inline int CTime::GetMinute() const
        !           217:        { return GetLocalTm(NULL)->tm_min; }
        !           218: inline int CTime::GetSecond() const
        !           219:        { return GetLocalTm(NULL)->tm_sec; }
        !           220: inline int CTime::GetDayOfWeek() const  
        !           221:        { return GetLocalTm(NULL)->tm_wday + 1; }
        !           222: inline CTimeSpan CTime::operator-(CTime time) const
        !           223:        { return CTimeSpan(m_time - time.m_time); }
        !           224: inline CTime CTime::operator-(CTimeSpan timeSpan) const
        !           225:        { return CTime(m_time - timeSpan.m_timeSpan); }
        !           226: inline CTime CTime::operator+(CTimeSpan timeSpan) const
        !           227:        { return CTime(m_time + timeSpan.m_timeSpan); }
        !           228: inline const CTime& CTime::operator+=(CTimeSpan timeSpan)
        !           229:        { m_time += timeSpan.m_timeSpan; return *this; }
        !           230: inline const CTime& CTime::operator-=(CTimeSpan timeSpan)
        !           231:        { m_time -= timeSpan.m_timeSpan; return *this; }
        !           232: inline BOOL CTime::operator==(CTime time) const
        !           233:        { return m_time == time.m_time; }
        !           234: inline BOOL CTime::operator!=(CTime time) const
        !           235:        { return m_time != time.m_time; }
        !           236: inline BOOL CTime::operator<(CTime time) const
        !           237:        { return m_time < time.m_time; }
        !           238: inline BOOL CTime::operator>(CTime time) const
        !           239:        { return m_time > time.m_time; }
        !           240: inline BOOL CTime::operator<=(CTime time) const
        !           241:        { return m_time <= time.m_time; }
        !           242: inline BOOL CTime::operator>=(CTime time) const
        !           243:        { return m_time >= time.m_time; }
        !           244: 
        !           245: 
        !           246: #ifdef _DEBUG
        !           247: inline CMemoryState::CMemoryState()
        !           248:        { m_pBlockHeader = NULL; }
        !           249: #endif
        !           250: 
        !           251: // CArchive inline functions
        !           252: inline BOOL CArchive::IsLoading() const
        !           253:        { return (m_nMode == CArchive::load); }
        !           254: inline BOOL CArchive::IsStoring() const
        !           255:        { return (m_nMode == CArchive::store); }
        !           256: inline CFile* CArchive::GetFile() const
        !           257:        { return m_pFile; }
        !           258: inline CArchive& CArchive::operator<<(BYTE by)
        !           259:        { if (m_lpBufCur + sizeof(BYTE) > m_lpBufMax) Flush();
        !           260:                *(BYTE FAR*)m_lpBufCur = by; m_lpBufCur += sizeof(BYTE); return *this; }
        !           261: inline CArchive& CArchive::operator<<(WORD w)
        !           262:        { if (m_lpBufCur + sizeof(WORD) > m_lpBufMax) Flush();
        !           263:                *(WORD FAR*)m_lpBufCur = w; m_lpBufCur += sizeof(WORD); return *this; }
        !           264: inline CArchive& CArchive::operator<<(LONG l)
        !           265:        { if (m_lpBufCur + sizeof(LONG) > m_lpBufMax) Flush();
        !           266:                *(LONG FAR*)m_lpBufCur = l; m_lpBufCur += sizeof(LONG); return *this; }
        !           267: inline CArchive& CArchive::operator<<(DWORD dw)
        !           268:        { if (m_lpBufCur + sizeof(DWORD) > m_lpBufMax) Flush();
        !           269:                *(DWORD FAR*)m_lpBufCur = dw; m_lpBufCur += sizeof(DWORD); return *this; }
        !           270: inline CArchive& CArchive::operator>>(BYTE& by)
        !           271:        { if (m_lpBufCur + sizeof(BYTE) > m_lpBufMax)
        !           272:                        FillBuffer(sizeof(BYTE) - (m_lpBufMax - m_lpBufCur));
        !           273:                by = *(BYTE FAR*)m_lpBufCur; m_lpBufCur += sizeof(BYTE); return *this; }
        !           274: inline CArchive& CArchive::operator>>(WORD& w)
        !           275:        { if (m_lpBufCur + sizeof(WORD) > m_lpBufMax)
        !           276:                        FillBuffer(sizeof(WORD) - (m_lpBufMax - m_lpBufCur));
        !           277:                w = *(WORD FAR*)m_lpBufCur; m_lpBufCur += sizeof(WORD); return *this; }
        !           278: inline CArchive& CArchive::operator>>(DWORD& dw)
        !           279:        { if (m_lpBufCur + sizeof(DWORD) > m_lpBufMax)
        !           280:                        FillBuffer(sizeof(DWORD) - (m_lpBufMax - m_lpBufCur));
        !           281:                dw = *(DWORD FAR*)m_lpBufCur; m_lpBufCur += sizeof(DWORD); return *this; }
        !           282: inline CArchive& CArchive::operator>>(LONG& l)
        !           283:        { if (m_lpBufCur + sizeof(LONG) > m_lpBufMax)
        !           284:                        FillBuffer(sizeof(LONG) - (m_lpBufMax - m_lpBufCur));
        !           285:                l = *(LONG FAR*)m_lpBufCur; m_lpBufCur += sizeof(LONG); return *this; }
        !           286: inline CArchive::CArchive(const CArchive& /* arSrc */) 
        !           287:        { }
        !           288: inline void CArchive::operator=(const CArchive& /* arSrc */) 
        !           289:        { }
        !           290: inline CArchive& operator<<(CArchive& ar, const CObject* pOb)
        !           291:        { ar.WriteObject(pOb); return ar; }
        !           292: inline CArchive& operator>>(CArchive& ar, CObject*& pOb)
        !           293:        { pOb = ar.ReadObject(NULL); return ar; }
        !           294: inline CArchive& operator>>(CArchive& ar, const CObject*& pOb)
        !           295:        { pOb = ar.ReadObject(NULL); return ar; }
        !           296: 
        !           297: 
        !           298: // CDumpContext inline functions
        !           299: inline int CDumpContext::GetDepth() const
        !           300:        { return m_nDepth; }
        !           301: inline void CDumpContext::SetDepth(int nNewDepth)
        !           302:        { m_nDepth = nNewDepth; }
        !           303: inline CDumpContext::CDumpContext(const CDumpContext& /* dcSrc */) 
        !           304:        { }
        !           305: inline void CDumpContext::operator=(const CDumpContext& /* dcSrc */) 
        !           306:        { }
        !           307: 
        !           308: #undef THIS_FILE
        !           309: #define THIS_FILE __FILE__
        !           310: #endif //__AFX_INL__
        !           311: 
        !           312: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.