| 1606 | } |
| 1607 | |
| 1608 | void 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; |
nothing calls this directly
no test coverage detected