Skip to content

Commit 2516fed

Browse files
authored
Merge pull request #2121 from mikeblome/mb-1290
formatted mfc snippets through exceptions-using-mfc-macros
2 parents 6fe4c1a + d7e6bd8 commit 2516fed

476 files changed

Lines changed: 3626 additions & 3585 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
CTypedPtrArray<CObArray, CPerson*> myArray;
1+
CTypedPtrArray<CObArray, CPerson*> myArray;
22

3-
myArray.Add(new CPerson());
4-
for (int i = 0; i < myArray.GetSize();i++)
5-
{
6-
CPerson* thePerson = myArray.GetAt(i);
7-
thePerson->AssertValid();
8-
}
3+
myArray.Add(new CPerson());
4+
for (int i = 0; i < myArray.GetSize(); i++)
5+
{
6+
CPerson* thePerson = myArray.GetAt(i);
7+
thePerson->AssertValid();
8+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
CPerson* thePerson = myArray[i];
1+
CPerson* thePerson = myArray[i];
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
CTypedPtrList<CObList, CPerson*> myList;
1+
CTypedPtrList<CObList, CPerson*> myList;
22

3-
myList.AddHead(new CPerson());
4-
POSITION pos = myList.GetHeadPosition();
5-
while(pos != NULL)
6-
{
7-
CPerson* thePerson = myList.GetNext(pos);
8-
thePerson->AssertValid();
9-
}
3+
myList.AddHead(new CPerson());
4+
POSITION pos = myList.GetHeadPosition();
5+
while (pos != NULL)
6+
{
7+
CPerson* thePerson = myList.GetNext(pos);
8+
thePerson->AssertValid();
9+
}
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
CMap<CString, LPCTSTR, CPerson*, CPerson*> myMap;
2-
CPerson myPerson;
1+
CMap<CString, LPCTSTR, CPerson*, CPerson*> myMap;
2+
CPerson myPerson;
33

4-
myMap.SetAt(_T("Bill"), &myPerson);
5-
POSITION pos = myMap.GetStartPosition();
6-
while(pos != NULL)
7-
{
8-
CPerson* pPerson;
9-
CString string;
10-
// Get key (string) and value (pPerson)
11-
myMap.GetNextAssoc(pos, string, pPerson);
12-
// Use string and pPerson
13-
}
4+
myMap.SetAt(_T("Bill"), &myPerson);
5+
POSITION pos = myMap.GetStartPosition();
6+
while (pos != NULL)
7+
{
8+
CPerson* pPerson;
9+
CString string;
10+
// Get key (string) and value (pPerson)
11+
myMap.GetNextAssoc(pos, string, pPerson);
12+
// Use string and pPerson
13+
}
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
CMapStringToOb myMap; // A nontemplate collection class
2-
CPerson myPerson;
3-
myMap.SetAt(_T("Bill"), &myPerson);
1+
CMapStringToOb myMap; // A nontemplate collection class
2+
CPerson myPerson;
3+
myMap.SetAt(_T("Bill"), &myPerson);
44

5-
POSITION pos = myMap.GetStartPosition();
6-
while(pos != NULL)
7-
{
8-
CPerson* pPerson;
9-
CString string;
10-
// Gets key (string) and value (pPerson)
11-
myMap.GetNextAssoc(pos, string,
12-
(CObject*&)pPerson);
13-
ASSERT(pPerson->IsKindOf(
14-
RUNTIME_CLASS(CPerson)));
15-
// Use string and pPerson
16-
}
5+
POSITION pos = myMap.GetStartPosition();
6+
while (pos != NULL)
7+
{
8+
CPerson* pPerson;
9+
CString string;
10+
// Gets key (string) and value (pPerson)
11+
myMap.GetNextAssoc(pos, string,
12+
(CObject * &)pPerson);
13+
ASSERT(pPerson->IsKindOf(
14+
RUNTIME_CLASS(CPerson)));
15+
// Use string and pPerson
16+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
CRuntimeClass* pClass = RUNTIME_CLASS( CObject );
1+
CRuntimeClass* pClass = RUNTIME_CLASS(CObject);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
class CPerson : public CObject
1+
class CPerson : public CObject
22
{
3-
DECLARE_DYNAMIC( CPerson )
3+
DECLARE_DYNAMIC(CPerson)
44

55
// other declarations
66
};

docs/mfc/codesnippet/CPP/accessing-run-time-class-information_3.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
IMPLEMENT_DYNAMIC( CPerson, CObject )
1+
IMPLEMENT_DYNAMIC(CPerson, CObject)
22

33
IMPLEMENT_DYNCREATE(CMyDynCreateObj, CObject)
44

@@ -18,11 +18,11 @@ void SomeFunction(void)
1818
{
1919
CObject* pMyObject = new CPerson;
2020

21-
if(NULL != pMyObject &&
22-
pMyObject->IsKindOf( RUNTIME_CLASS( CPerson ) ) )
21+
if (NULL != pMyObject &&
22+
pMyObject->IsKindOf(RUNTIME_CLASS(CPerson)))
2323
{
2424
//if IsKindOf is true, then cast is all right
25-
CPerson* pmyPerson = (CPerson*) pMyObject ;
25+
CPerson* pmyPerson = (CPerson*)pMyObject;
2626
pmyPerson->AssertValid();
2727
// other code goes here...
2828
}
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
2-
//create and initialize the font to be used
3-
LOGFONT logFont = {0};
4-
logFont.lfHeight = -12;
5-
logFont.lfWeight = FW_NORMAL;
6-
logFont.lfCharSet = DEFAULT_CHARSET;
7-
_tcscpy_s(logFont.lfFaceName, _countof(logFont.lfFaceName),
8-
_T("Verdana"));
91

10-
m_MonthCalFont.CreateFontIndirect(&logFont);
11-
m_DateTimeCtrl.SetMonthCalFont(m_MonthCalFont);
2+
//create and initialize the font to be used
3+
LOGFONT logFont = { 0 };
4+
logFont.lfHeight = -12;
5+
logFont.lfWeight = FW_NORMAL;
6+
logFont.lfCharSet = DEFAULT_CHARSET;
7+
_tcscpy_s(logFont.lfFaceName, _countof(logFont.lfFaceName),
8+
_T("Verdana"));
9+
10+
m_MonthCalFont.CreateFontIndirect(&logFont);
11+
m_DateTimeCtrl.SetMonthCalFont(m_MonthCalFont);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// COleContainerApp initialization
22
BOOL COleContainerApp::InitInstance()
33
{
4-
AfxEnableControlContainer();
4+
AfxEnableControlContainer();

0 commit comments

Comments
 (0)