MCPcopy Create free account
hub / github.com/ajkhoury/ReClassEx / ReplaceSelectedWithType

Method ReplaceSelectedWithType

ReClass/CClassView.cpp:1608–1713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1606}
1607
1608void CClassView::ReplaceSelectedWithType( NodeType Type )
1609{
1610 std::vector<CNodeBase*> newSelected;
1611
1612 PrintOut( _T( "Replace Node Type %s" ), NodeTypeToString( Type ) );
1613
1614 for (size_t i = 0; i < m_Selected.size( ); i++)
1615 {
1616 if (!g_ReClassApp.IsNodeValid( m_Selected[i].Object ))
1617 continue;
1618
1619 if (m_Selected[i].Object->GetParent( )->GetType( ) == nt_vtable)
1620 {
1621 Type = nt_functionptr;
1622 }
1623
1624 CNodeBase* pNewNode = g_ReClassApp.CreateNewNode( Type );
1625
1626 if (Type == nt_class)
1627 {
1628 MakeBasicClass( (CNodeClass*)pNewNode );
1629 }
1630 if (Type == nt_custom)
1631 {
1632 ((CNodeCustom*)pNewNode)->SetSize( m_Selected[i].Object->GetMemorySize( ) );
1633 }
1634 if (Type == nt_text)
1635 {
1636 ((CNodeText*)pNewNode)->SetSize( m_Selected[i].Object->GetMemorySize( ) );
1637 }
1638 if (Type == nt_unicode)
1639 {
1640 ((CNodeUnicode*)pNewNode)->SetSize( m_Selected[i].Object->GetMemorySize( ) );
1641 }
1642 if (Type == nt_vtable)
1643 {
1644 for (int i = 0; i < 10; i++)
1645 {
1646 CNodeVTable* pVTable = (CNodeVTable*)pNewNode;
1647 pVTable->Initialize( static_cast<CWnd*>(this) );
1648
1649 CNodeFunctionPtr* pFunctionPtr = new CNodeFunctionPtr( static_cast<CWnd*>(this), pVTable->GetOffset( ) + (i * sizeof( size_t )) );
1650 pFunctionPtr->SetOffset( pVTable->GetOffset( ) + (i * sizeof( size_t )) );
1651 pFunctionPtr->SetParent( pVTable );
1652
1653 pVTable->AddNode( pFunctionPtr );
1654 }
1655 }
1656 if (Type == nt_pointer)
1657 {
1658 CNodePtr* pPtr = (CNodePtr*)pNewNode;
1659 CNodeClass* pClass = (CNodeClass*)g_ReClassApp.CreateNewNode( nt_class );
1660 MakeBasicClass( pClass );
1661 pPtr->SetClass( pClass );
1662 }
1663 if (Type == nt_array)
1664 {
1665 CNodeArray* pArray = (CNodeArray*)pNewNode;

Callers

nothing calls this directly

Calls 15

NodeTypeToStringFunction · 0.85
MakeBasicClassFunction · 0.85
IsNodeValidMethod · 0.80
GetTypeMethod · 0.80
GetParentMethod · 0.80
CreateNewNodeMethod · 0.80
GetOffsetMethod · 0.80
SetOffsetMethod · 0.80
SetParentMethod · 0.80
AddNodeMethod · 0.80
clearMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected