当前位置: 首页>>代码示例>>C++>>正文


C++ CElement类代码示例

本文整理汇总了C++中CElement的典型用法代码示例。如果您正苦于以下问题:C++ CElement类的具体用法?C++ CElement怎么用?C++ CElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetChildrenListSnapshot

void CElement::CallEventNoParent ( const char* szName, const CLuaArguments& Arguments, CElement* pSource, CPlayer* pCaller )
{
    // Call it on us if this isn't the same class it was raised on
    if ( pSource != this && m_pEventManager->HasEvents () )
    {
        m_pEventManager->Call ( szName, Arguments, pSource, this, pCaller );
    }

    // Call it on all our children
    CElementListSnapshot* pList = GetChildrenListSnapshot();
    pList->AddRef();    // Keep list alive during use
    for ( CElementListSnapshot::const_iterator iter = pList->begin() ; iter != pList->end() ; iter++ )
    {
        CElement* pElement = *iter;
        if ( !pElement->IsBeingDeleted() )
        {
            if ( !pElement->m_pEventManager || pElement->m_pEventManager->HasEvents () || !pElement->m_Children.empty () )
            {
                pElement->CallEventNoParent ( szName, Arguments, pSource, pCaller );
                if ( m_bIsBeingDeleted )
                    break;
            }
        }
    }
    pList->Release();
}
开发者ID:ljnx86,项目名称:mtasa-blue,代码行数:26,代码来源:CElement.cpp

示例2: assert

void CPerPlayerEntity::RemovePlayersBelow(CElement* pElement, std::set<CPlayer*>& Removed)
{
    assert(pElement);

    // Is this a player?
    if (IS_PLAYER(pElement))
    {
        // Remove the reference
        CPlayer* pPlayer = static_cast<CPlayer*>(pElement);
        RemovePlayerReference(pPlayer);

        // Did we just loose the last reference to that player? Add him to the list over removed players.
        if (!IsVisibleToPlayer(*pPlayer))
        {
            MapInsert(Removed, pPlayer);
        }
    }

    // Call ourself on all our children
    CChildListType ::const_iterator iterChildren = pElement->IterBegin();
    for (; iterChildren != pElement->IterEnd(); iterChildren++)
    {
        CElement* pElement = *iterChildren;
        if (pElement->CountChildren() || IS_PLAYER(pElement))            // This check reduces cpu usage when unloading large maps (due to recursion)
            RemovePlayersBelow(pElement, Removed);
    }
}
开发者ID:ccw808,项目名称:mtasa-blue,代码行数:27,代码来源:CPerPlayerEntity.cpp

示例3: ATTR_METHOD_IMPL

ATTR_METHOD_IMPL(CElementParser, OnMaxOccurs)
{
    TRACE_PARSE_ENTRY();

    if (cchValue==sizeof("unbounded")-1 && !wcsncmp(wszValue, L"unbounded", cchValue))
    {
        CElement * pCurr = GetElement();
        if (pCurr != NULL)
        {
            pCurr->SetMaxOccurs(MAXOCCURS_UNBOUNDED);
            return S_OK;
        }
        return E_FAIL;
    }

    int nMaxOccurs = 0;
    nMaxOccurs = _wtoi(wszValue);
    if (nMaxOccurs >= 0)
    {
        //
        // maxOccurs must be >= 0
        //

        CElement * pCurr = GetElement();
        if (pCurr != NULL)
        {
            pCurr->SetMaxOccurs(nMaxOccurs);
            return S_OK;
        }
    }

    EmitInvalidValue("maxOccurs", wszValue);

    return E_FAIL;
}
开发者ID:sun-friderick,项目名称:splayer,代码行数:35,代码来源:ElementParser.cpp

示例4: it

bool CComponentLibrary::fromXml(const CXmlElement &xmlElement,
                                CXmlSerializingContext &serializingContext)
{
    CXmlElement childElement;

    CXmlElement::CChildIterator it(xmlElement);

    // XML populate all component libraries
    while (it.next(childElement)) {

        // Filter component library/type set elements
        if (childElement.getType() == "ComponentLibrary" ||
            childElement.getType() == "ComponentTypeSet") {

            if (!fromXml(childElement, serializingContext)) {

                return false;
            }
        } else {
            // Regular child creation and populating
            CElement *pChild = createChild(childElement, serializingContext);

            if (!pChild || !pChild->fromXml(childElement, serializingContext)) {

                return false;
            }
        }
    }

    return true;
}
开发者ID:01org,项目名称:parameter-framework,代码行数:31,代码来源:ComponentLibrary.cpp

示例5: GetOwner

void CFreeCameraComponent::Reset()
{
	CElement *owner = GetOwner();


	m_camController->SetPosition( owner->GetPosition() );
}
开发者ID:rcrmn,项目名称:mastervj-basic-engine,代码行数:7,代码来源:FreeCameraComponent.cpp

示例6:

/*****************************************************************
 * 
 * method :void		DrawCurrentPage(CDC *inDC)
 *
 * parameters : inCDC a device context
 *
 * returns : nothing
 *
 * description: Draw the current page
 *
 *
 ****************************************************************/
void		CEasyReport::DrawCurrentPage(CDC *inDC)
{
	int			i,aStart, aMax;
	CElement	*aElem;
	
	if( m_CurPage != 0 )
		aStart = m_PageItems[m_CurPage-1];
	else
		aStart = 0;
	aMax = m_PageItems[m_CurPage];
	for( i =aStart;i< aMax;i++)
	{
		aElem = (CElement *)m_ReportItems[i];
		aElem->Draw(inDC);
	}


/*	
	CRect	aRect(m_LeftMargin, -m_TopMargin, 
				m_PageWidth - m_RightMargin, -(m_PageHeight-m_BottomMargin));
	inDC->MoveTo(aRect.left, aRect.top);
	inDC->LineTo(aRect.right,aRect.top);
	inDC->LineTo(aRect.right, aRect.bottom);
	inDC->LineTo(aRect.left, aRect.bottom);
	inDC->LineTo(aRect.left, aRect.top);
*/	
}
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:39,代码来源:EasyReport.cpp

示例7: assert

void CElement::_GetEntitiesFromRoot ( unsigned int uiTypeHash, std::map < CElement*, int >& mapResults )
{
    t_mapEntitiesFromRoot::iterator find = ms_mapEntitiesFromRoot.find ( uiTypeHash );
    if ( find != ms_mapEntitiesFromRoot.end () )
    {
        CChildListType& listEntities = find->second;
        CElement* pEntity;
        unsigned int uiIndex = 0;

        for ( CChildListType::const_reverse_iterator i = listEntities.rbegin ();
              i != listEntities.rend ();
              ++i )
        {
            pEntity = *i;

            assert ( pEntity );
            ElementID ID = pEntity->GetID ();
            assert ( ID != INVALID_ELEMENT_ID );
            assert ( pEntity == CElementIDs::GetElement ( ID ) );
            if ( pEntity->IsBeingDeleted () )
                OutputDebugString ( SString ( "Server: 0x%08x  %s is flagged as IsBeingDeleted() but is still in GetEntitiesFromRoot\n", pEntity, pEntity->GetTypeName ().c_str () ) );

            assert ( mapResults.find ( pEntity ) == mapResults.end () );
            mapResults [ pEntity ] = 1;
        }
    }    
}
开发者ID:Bargas,项目名称:mtasa-blue,代码行数:27,代码来源:CElement.cpp

示例8: Callback_OnLeave

void CPickup::Callback_OnLeave ( CColShape& Shape, CElement& Element )
{
    if ( IS_PLAYER ( &Element ) )
    {
        CPlayer& Player = static_cast < CPlayer& > ( Element );

        // Matching interior
        if ( GetInterior () == Element.GetInterior () )
        {
            // Matching dimension
            if ( GetDimension () == Element.GetDimension () )
            {
                // Is he alive?
                if ( !Player.IsDead () )
                {
                    // Call the onPickupHit event
                    CLuaArguments Arguments;
                    Arguments.PushElement ( &Player );
                    CallEvent ( "onPickupLeave", Arguments );

                    CLuaArguments Arguments2;
                    Arguments2.PushElement ( this );       // pickup
                    Element.CallEvent ( "onPlayerPickupLeave", Arguments2 );            
                }
            }
        }
    }
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例9: IsPlayerIgnoringElement

bool CPlayer::IsPlayerIgnoringElement( CElement* pElement )
{
    // For each ignored element
    for ( list < CElement* > ::const_iterator iter = m_lstIgnoredList.begin () ; iter != m_lstIgnoredList.end () ; ++iter )
    {
        CElement* pIgnoredElement = *iter;
        if ( IS_TEAM ( pIgnoredElement ) )
        {
            // Check team
            CTeam* pTeam = static_cast < CTeam* > ( pIgnoredElement );
            // If the broadcast-to player is in the ignored team
            list < CPlayer* > ::const_iterator iter = pTeam->PlayersBegin ();
            for ( ; iter != pTeam->PlayersEnd (); iter++ )
            {
                if ( *iter == pElement )
                    return true;
            }
        }
        else if ( IS_PLAYER( pIgnoredElement ) )
        {
            // Check player
            if ( pIgnoredElement == pElement )
                return true;
        }
        else
        {
            // Check element decendants
            if ( pIgnoredElement->IsMyChild ( pElement , true ) )
                return true;
        }
    }
    return false;
}
开发者ID:pombredanne,项目名称:openvice,代码行数:33,代码来源:CPlayer.cpp

示例10: TAG_METHOD_IMPL

TAG_METHOD_IMPL(CElementParser, OnComplexType)
{
    TRACE_PARSE_ENTRY();

    CElement * pCurr = GetElement();
    if (pCurr != NULL)
    {
        CComplexType * pElem = pCurr->AddComplexType();
        if (pElem != NULL)
        {
            SetXSDElementInfo(pElem, pCurr, GetLocator());

            CAutoPtr<CComplexTypeParser> p( new CComplexTypeParser(GetReader(), this, GetLevel(), pElem) );
            if (p != NULL)
            {
                if (g_ParserList.AddHead(p) != NULL)
                {
                    return p.Detach()->GetAttributes(pAttributes);
                }
            }
        }
    }

    EmitErrorHr(E_OUTOFMEMORY);
    return E_FAIL;
}
开发者ID:sun-friderick,项目名称:splayer,代码行数:26,代码来源:ElementParser.cpp

示例11: Draw

void CCell::Draw(CDC *pDC)
{
	POSITION pos;
	CElement *pElement;
	for(pos=m_Elements.GetHeadPosition();pos!=NULL;){
		pElement=(CElement *)(m_Elements.GetNext(pos));
		pElement->Draw(pDC);
	}
}
开发者ID:eseawind,项目名称:CNCS_PMC-Conductor,代码行数:9,代码来源:Cell.cpp

示例12: MoveInCell

void CCell::MoveInCell(POINT potTracker)
{
	POSITION pos;
	CElement *pElement;
	for(pos=m_Elements.GetHeadPosition();pos!=NULL;){		
		pElement=(CElement *)(m_Elements.GetNext(pos));
		pElement->MoveInCell(potTracker);
	}
}
开发者ID:eseawind,项目名称:CNCS_PMC-Conductor,代码行数:9,代码来源:Cell.cpp

示例13: UpdateView

void CCell::UpdateView()
{
	POSITION pos;
	CElement *pElement;
	for(pos=m_Elements.GetHeadPosition();pos!=NULL;){
		pElement=(CElement *)(m_Elements.GetNext(pos));
		pElement->UpdateView();
	}
}
开发者ID:eseawind,项目名称:CNCS_PMC-Conductor,代码行数:9,代码来源:Cell.cpp

示例14: FlushUpdateQueue

///////////////////////////////////////////////////////////////
//
// CSpatialDatabaseImpl::FlushUpdateQueue
//
// Process all entities that have changed since the last call
//
///////////////////////////////////////////////////////////////
void CSpatialDatabaseImpl::FlushUpdateQueue ( void )
{
    int iTotalUpdated = 0;

    for ( std::map < CElement*, int >::iterator it = m_UpdateQueue.begin (); it != m_UpdateQueue.end (); ++it )
    {
        CElement* pEntity = it->first;

        // Get the new bounding box
        SEntityInfo newInfo;
        CSphere sphere = pEntity->GetWorldBoundingSphere ();
        newInfo.box = CBox ( sphere.vecPosition, fabsf ( sphere.fRadius ) );
        // Make everything 2D for now
        newInfo.box.vecMin.fZ = SPATIAL_2D_Z;
        newInfo.box.vecMax.fZ = SPATIAL_2D_Z;

        // Get previous info
        if ( SEntityInfo* pOldInfo = MapFind ( m_InfoMap, pEntity ) )
        {
            // Don't update if bounding box is the same
            if ( pOldInfo->box == newInfo.box )
                continue;

            // Remove old bounding box from tree
            m_Tree.Remove ( &pOldInfo->box.vecMin.fX, &pOldInfo->box.vecMax.fX, pEntity );
        }

        if ( !IsValidSphere ( sphere ) )
            continue;

        // Add new bounding box
        m_Tree.Insert( &newInfo.box.vecMin.fX, &newInfo.box.vecMax.fX, pEntity );

        // Update info map
        MapSet ( m_InfoMap, pEntity, newInfo );
        iTotalUpdated++;
#ifdef SPATIAL_DATABASE_DEBUG_OUTPUTA
        OutputDebugLine ( SString ( "SpatialDatabase::UpdateEntity %08x  %2.0f,%2.0f,%2.0f   %2.0f,%2.0f,%2.0f"
                                    ,pEntity
                                    ,info.box.vecMin.fX
                                    ,info.box.vecMin.fY
                                    ,info.box.vecMin.fZ
                                    ,info.box.vecMax.fX
                                    ,info.box.vecMax.fY
                                    ,info.box.vecMax.fZ
                                  ) );
#endif
    }
    m_UpdateQueue.clear ();

#ifdef SPATIAL_DATABASE_DEBUG_OUTPUTB
    int iTotalToUpdate = m_UpdateQueue.size ();
    if ( iTotalToUpdate )
        OutputDebugLine ( SString ( "SpatialDatabase::FlushUpdateQueue  TotalToUpdate: %d   TotalUpdated: %d  m_InfoMap: %d    tree: %d  ", iTotalToUpdate, iTotalUpdated, m_InfoMap.size (), m_Tree.Count () ) );
#endif
}
开发者ID:,项目名称:,代码行数:63,代码来源:

示例15: switch

vector < char * > * CLuaArguments::WriteToCharVector ( vector < char * > * values )
{
    vector < CLuaArgument* > ::const_iterator iter = m_Arguments.begin ();
    for ( ; iter != m_Arguments.end () ; iter++ )
    {
        switch ( (*iter)->GetType() )
        {
        case LUA_TNUMBER:
            {
                char * szValue = new char [ 20 ];
                itoa ( ( int ) (*iter)->GetNumber(), szValue, 10 );
                values->push_back ( szValue );
                break;
            }
        case LUA_TSTRING:
            {
                const char * szString = (*iter)->GetString().c_str ();
                char * szValue = new char [ strlen ( szString ) + 1 ];
                strcpy ( szValue, szString );
                values->push_back ( szValue );
                break;
            }
        case LUA_TBOOLEAN:
            {
                char * szValue = new char [ 6 ];
                if ( (*iter)->GetBoolean() )
                    values->push_back ( strcpy ( szValue, "true" ) );
                else
                    values->push_back ( strcpy ( szValue, "false" ) );
                break;
            }
        case LUA_TLIGHTUSERDATA:
            {
                char * szValue = new char [10];
                memset(szValue,0,10);
                CElement* pElement = (*iter)->GetElement ();
			    if ( VERIFY_ELEMENT(pElement) )
			    {
                    _snprintf ( szValue, 9, "E#%d", (int)pElement->GetID() );
			    }
			    else
			    {
				    g_pGame->GetScriptDebugging()->LogError ( NULL, "Couldn't serialize argument list, invalid element specified. Passing empty string instead." );
			    }
                values->push_back ( szValue );
            }        
        default:
            {
                char * szEmpty = new char [ 1 ];
                szEmpty[0] = '\0';
                values->push_back ( szEmpty );
            }
        }
    }
    return values;
}
开发者ID:MrHankey,项目名称:multitheftauto,代码行数:56,代码来源:CLuaArguments.cpp


注:本文中的CElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。