GError GAnimTRSNode2D::SetRotation(const GTimeValue TimePos, const GReal& RelRotation) {

	GError err;
	GProperty *tmpProp = Property("transform");

	// this can be the case of a curve not created through a kernel
	if (!tmpProp)
		err = G_MISSING_KERNEL;
	else {
		// extract position track
		GProperty *rotProp = tmpProp->Property("rotation");
		G_ASSERT(rotProp);
		GKeyValue tmpValue(TimePos, RelRotation);
		err = rotProp->SetValue(tmpValue, TimePos, G_ABSOLUTE_VALUE);
	}
	return err;
}
Esempio n. 2
0
BOOL HtmlDlg::GetHtmlAttrValue( IHTMLElement* pElement, CString Attr, CString& Value )
{
	BOOL bret = FALSE;
	VARIANT variant;
	::VariantInit(&variant);
	BSTR bstr;
	bstr = Attr.AllocSysString();

	pElement->getAttribute( bstr, 0, &variant );

	if( variant.vt != VT_NULL )
	{
		CString tmpValue( variant.bstrVal );
		Value.Format(_T("%s"), tmpValue);
		bret = TRUE;
	}

	::VariantClear( &variant );
	::SysFreeString( bstr );

	return bret;
}
// ---------------------------------------------------------------------------
// T_NATFWTraversalAdapter::GetDomainSettingsL
// Gets one domain settings entry
// ---------------------------------------------------------------------------
//
void T_NATFWTraversalAdapter::GetDomainSettingsL( TUint32 aDomainKeyId,
    CNATFWDomainSpecificItem& aItem )
    {
    // Central Repository for NAT-FW Traversal settings
    CRepository* rep = CRepository::NewLC( KCRUidUNSAFProtocols ); // CS:1
    
    TUint32 key( KErrNone );
    // select domain 
    key = ( KUNSAFProtocolsDomainMask^( aDomainKeyId ) );
    key |= KUNSAFProtocolsDomainTableMask;
    // set key id
    aItem.SetDomainKey( aDomainKeyId );
    
    // set domain
    TInt actualLength = 0;
    TBuf8<1> tmp;
    rep->Get( KUNSAFProtocolsDomainMask|key, tmp, actualLength );
    
    if ( actualLength > 0 )
        {
        HBufC8* domainName = HBufC8::NewLC( actualLength );
        TPtr8 ptr( domainName->Des() );
        TInt err = rep->Get( KUNSAFProtocolsDomainMask|key, ptr ); 
        if( KErrNone == err )
            {
            aItem.SetDomainL( domainName->Des() );
            }
        else
            {
            aItem.SetDomainL( KNullDesC8() );
            }
        CleanupStack::PopAndDestroy( domainName );
        actualLength = 0;
        }

    // set STUN server address
    rep->Get( KUNSAFProtocolsSTUNServerMask|key, tmp, actualLength );
    
    if ( actualLength > 0 )
        {
        HBufC8* stunServerAddr = HBufC8::NewLC( actualLength );
        TPtr8 ptr ( stunServerAddr->Des() );
        TInt err = rep->Get( KUNSAFProtocolsSTUNServerMask|key, ptr );
        if( err == KErrNone ) 
            {
            aItem.SetSTUNServerAddrL( stunServerAddr->Des() );
            }
        else
            {
            aItem.SetSTUNServerAddrL( KNullDesC8() );
            }
        CleanupStack::PopAndDestroy( stunServerAddr );
        }
    
    // STUN server port
    TInt tmpValue( 0 );
    rep->Get( KUNSAFProtocolsSTUNServerPortMask|key, tmpValue );
    aItem.SetSTUNServerPort( tmpValue );

    // STUN server username
    rep->Get( KUNSAFProtocolsSTUNUsernameMask|key, tmp, actualLength );
    
    if ( actualLength > 0 )
        {
        HBufC8* stunUsername = HBufC8::NewLC( actualLength );
        TPtr8 ptr ( stunUsername->Des() );
        TInt err = rep->Get( KUNSAFProtocolsSTUNUsernameMask|key, ptr );
        if( err == KErrNone ) 
            {
            aItem.SetSTUNUsernameL( stunUsername->Des() );
            }
        else
            {
            aItem.SetSTUNUsernameL( KNullDesC8() );
            }
        CleanupStack::PopAndDestroy( stunUsername );
        }

    // STUN server password
    rep->Get( KUNSAFProtocolsSTUNPasswordMask|key, tmp, actualLength );
    
    if ( actualLength > 0 )
        {
        HBufC8* stunPassword = HBufC8::NewLC( actualLength );
        TPtr8 ptr ( stunPassword->Des() );
        TInt err = rep->Get( KUNSAFProtocolsSTUNPasswordMask|key, ptr );
        if( err == KErrNone ) 
            {
            aItem.SetSTUNPasswordL( stunPassword->Des() );
            }
        else
            {
            aItem.SetSTUNPasswordL( KNullDesC8() );
            }
        CleanupStack::PopAndDestroy( stunPassword );
        }

    // NAT refresh interval for UDP
    tmpValue = KErrNotFound;
    rep->Get( KUNSAFProtocolsDomainIntervalUDPMask|key, tmpValue );
    aItem.SetNATRefreshUDP( tmpValue );
    
    // NAT refresh interval for TCP
    tmpValue = KErrNotFound;
    rep->Get( KUNSAFProtocolsDomainIntervalTCPMask|key, tmpValue );
    aItem.SetNATRefreshTCP( tmpValue );
    
    // CRLF-based NAT binding refresh 
    tmpValue = KErrNotFound;
    rep->Get( KUNSAFProtocolsDomainEnableCRLFRefresh|key, tmpValue );
    aItem.SetEnableCRLFRefresh( tmpValue );

    TUint32 tempKey = aDomainKeyId|KUNSAFProtocolsFieldTypeMask;
    tempKey ^= KUNSAFProtocolsFieldTypeMask;
    
    RArray<TUint32> stunKeys;
    CleanupClosePushL( stunKeys ); // CS:2
    rep->FindL( tempKey|KUNSAFProtocolsSTUNAddressMask, 
        KUNSAFProtocolsSubTableFieldTypeMask, stunKeys );
    TInt stunKeyCount = stunKeys.Count();

    // STUN server items start from CenRep table index 1.
    for ( TInt counter = 1; counter < stunKeyCount; counter++ )
        {
        CWPStunServerItem* stunItem = CWPStunServerItem::NewLC(); // CS:3

        // Remove STUN server address mask from key.
        TUint32 tmpKey = KUNSAFProtocolsSTUNAddressMask^stunKeys[counter];

        // STUNSrvAddr
        actualLength = 0;
        rep->Get( tmpKey|KUNSAFProtocolsSTUNAddressMask, tmp, actualLength );
        if ( actualLength > 0 )
            {
            HBufC8* stunSrvAddr = HBufC8::NewLC( actualLength ); // CS:4
            TPtr8 ptr( stunSrvAddr->Des() );
            TInt err = rep->Get( tmpKey|KUNSAFProtocolsSTUNAddressMask, 
                ptr );
            if ( KErrNone == err )
                {
                stunItem->SetStunSrvAddrL( stunSrvAddr->Des() );
                }
            else
                {
                stunItem->SetStunSrvAddrL( KNullDesC8 );
                }
            CleanupStack::PopAndDestroy( stunSrvAddr ); // CS:3
            }
        else if ( 0 == actualLength )
            {
            stunItem->SetStunSrvAddrL( KNullDesC8 );
            }

        // STUNSrvPort
        TInt tmpValue( KErrNotFound );
        rep->Get( tmpKey|KUNSAFProtocolsSTUNPortMask, tmpValue );
        stunItem->SetStunSrvPort( tmpValue );

        // STUNSrvUsername
        actualLength = 0;
        rep->Get( tmpKey|KUNSAFProtocolsSTUNUsernameMask, tmp, actualLength );
        if ( actualLength > 0 )
            {
            HBufC8* stunUsername = HBufC8::NewLC( actualLength ); // CS:4
            TPtr8 ptr( stunUsername->Des() );
            TInt err = rep->Get( tmpKey|KUNSAFProtocolsSTUNUsernameMask, 
                ptr );
            if ( KErrNone == err )
                {
                stunItem->SetStunUsernameL( stunUsername->Des() );
                }
            else
                {
                stunItem->SetStunUsernameL( KNullDesC8 );
                }
            CleanupStack::PopAndDestroy( stunUsername ); // CS:3
            }
        else if ( 0 == actualLength )
            {
            stunItem->SetStunUsernameL( KNullDesC8 );
            }

        // STUNSrvPassword
        actualLength = 0;
        rep->Get( tmpKey|KUNSAFProtocolsSTUNPasswordMask, tmp, actualLength );
        if ( actualLength > 0 )
            {
            HBufC8* stunPassword = HBufC8::NewLC( actualLength ); // CS:4
            TPtr8 ptr( stunPassword->Des() );
            TInt err = rep->Get( tmpKey|KUNSAFProtocolsSTUNPasswordMask, 
                ptr );
            if ( KErrNone == err )
                {
                stunItem->SetStunPasswordL( stunPassword->Des() );
                }
            else
                {
                stunItem->SetStunPasswordL( KNullDesC8 );
                }
            CleanupStack::PopAndDestroy( stunPassword ); // CS:3
            }
        else if ( 0 == actualLength )
            {
            stunItem->SetStunPasswordL( KNullDesC8 );
            }

        aItem.AddStunServerItemL( stunItem ); // Ownership transfer.

        CleanupStack::Pop( stunItem ); // CS:2
        }
    stunKeys.Close();
    CleanupStack::PopAndDestroy( &stunKeys ); // CS:1

    // STUNSharedSecret
    tmpValue = KErrNotFound;
    rep->Get( key|KUNSAFProtocolsDomainSharedSecretNotSupported, 
        tmpValue );
    aItem.SetDisableStunSharedSecret( tmpValue );

    // PortPoolStartPort
    tmpValue = KErrNotFound;
    rep->Get( key|KUNSAFProtocolsPortPoolStartPortMask, tmpValue );
    aItem.SetStartPortRange( tmpValue );

    // PortPoolEndPort
    tmpValue = KErrNotFound;
    rep->Get( key|KUNSAFProtocolsPortPoolEndPortMask, tmpValue );
    aItem.SetEndPortRange( tmpValue );

    // UsedNATProtocol
    actualLength = 0;
    rep->Get( key|KUNSAFProtocolsUsedNATProtocolMask, tmp, actualLength );
    if ( actualLength > 0 )
        {
        HBufC8* natProtocol = HBufC8::NewLC( actualLength ); // CS:4
        TPtr8 ptr( natProtocol->Des() );
        TInt err = rep->Get( key|KUNSAFProtocolsUsedNATProtocolMask, 
            ptr );
        if ( KErrNone == err )
            {
            aItem.SetNatProtocolL( natProtocol->Des() );
            }
        else
            {
            aItem.SetNatProtocolL( KNullDesC8 );
            }
        CleanupStack::PopAndDestroy( natProtocol ); // CS:3
        }
    else if ( 0 == actualLength )
        {
        aItem.SetNatProtocolL( KNullDesC8 );
        }

    // ICESpecific/NATUtilities
    actualLength = 0;
    rep->Get( key|KUNSAFProtocolsNATUtilities, tmp, actualLength );
    if ( actualLength > 0 )
        {
        HBufC8* natUtils = HBufC8::NewLC( actualLength ); // CS:4
        TPtr8 ptr( natUtils->Des() );
        TInt err = rep->Get( key|KUNSAFProtocolsNATUtilities, ptr );
        if ( KErrNone == err )
            {
            aItem.SetNatUtilitiesL( natUtils->Des() );
            }
        else
            {
            aItem.SetNatUtilitiesL( KNullDesC8 );
            }
        CleanupStack::PopAndDestroy( natUtils ); // CS:3
        }
    else if ( 0 == actualLength )
        {
        aItem.SetNatUtilitiesL( KNullDesC8 );
        }

    // ICESpecific/HostPref
    tmpValue = KErrNotFound;
    rep->Get( key|KUNSAFProtocolsHostPref, tmpValue );
    aItem.SetHostPref( tmpValue );

    // ICESpecific/ServerRefPref
    tmpValue = KErrNotFound;
    rep->Get( key|KUNSAFProtocolsServerRefPref, tmpValue );
    aItem.SetServerRefPref( tmpValue );

    // ICESpecific/RelayPref
    tmpValue = KErrNotFound;
    rep->Get( key|KUNSAFProtocolsRelayPref, tmpValue );
    aItem.SetRelayPref( tmpValue );

    // ICESpecific/PeerRefPref
    tmpValue = KErrNotFound;
    rep->Get( key|KUNSAFProtocolsPeerRefPref, tmpValue );
    aItem.SetPeerRefPref( tmpValue );

    // ICESpecific/IPv4Pref
    tmpValue = KErrNotFound;
    rep->Get( key|KUNSAFProtocolsIPV4Pref, tmpValue );
    aItem.SetIPv4Pref( tmpValue );

    // ICESpecific/IPv6Pref
    tmpValue = KErrNotFound;
    rep->Get( key|KUNSAFProtocolsIPV6Pref, tmpValue );
    aItem.SetIPv6Pref( tmpValue );

    // ICESpecific/VpnPref
    tmpValue = KErrNotFound;
    rep->Get( key|KUNSAFProtocolsVPNPref, tmpValue );
    aItem.SetVpnPref( tmpValue );

    // ICESpecific/UdpPref
    tmpValue = KErrNotFound;
    rep->Get( key|KUNSAFProtocolsUDPPref, tmpValue );
    aItem.SetUdpPref( tmpValue );

    // ICESpecific/TcpPref
    tmpValue = KErrNotFound;
    rep->Get( key|KUNSAFProtocolsTCPPref, tmpValue );
    aItem.SetTcpPref( tmpValue );

    // ICESpecific/TcpActivePref
    tmpValue = KErrNotFound;
    rep->Get( key|KUNSAFProtocolsTCPActivePref, tmpValue );
    aItem.SetTcpActivePref( tmpValue );

    // ICESpecific/TcpPassivePref
    tmpValue = KErrNotFound;
    rep->Get( key|KUNSAFProtocolsTCPPassivePref, tmpValue );
    aItem.SetTcpPassivePref( tmpValue );

    // ICESpecific/TCPSimultPref
    tmpValue = KErrNotFound;
    rep->Get( key|KUNSAFProtocolsTCPSimultPref, tmpValue );
    aItem.SetTcpSimultPref( tmpValue );

    // TURN server
    tempKey = aDomainKeyId|KUNSAFProtocolsFieldTypeMask;
    tempKey ^= KUNSAFProtocolsFieldTypeMask;
    
    RArray<TUint32> turnKeys;
    CleanupClosePushL( turnKeys ); // CS:2
    rep->FindL( tempKey|KUNSAFProtocolsTURNAddressMask, 
        KUNSAFProtocolsSubTableFieldTypeMask, turnKeys );
    TInt turnKeyCount = turnKeys.Count();
    for ( TInt counter = 0; counter < turnKeyCount; counter++ )
        {
        CWPTurnServerItem* turnItem = CWPTurnServerItem::NewLC(); // CS:3

        // Remove TURN server address mask from key.
        TUint32 tmpKey = KUNSAFProtocolsTURNAddressMask^turnKeys[counter];

        // TURNSrvAddr
        actualLength = 0;
        rep->Get( tmpKey|KUNSAFProtocolsTURNAddressMask, tmp, actualLength );
        if ( actualLength > 0 )
            {
            HBufC8* turnSrvAddr = HBufC8::NewLC( actualLength ); // CS:4
            TPtr8 ptr( turnSrvAddr->Des() );
            TInt err = rep->Get( tmpKey|KUNSAFProtocolsTURNAddressMask, 
                ptr );
            if ( KErrNone == err )
                {
                turnItem->SetTurnSrvAddrL( turnSrvAddr->Des() );
                }
            else
                {
                turnItem->SetTurnSrvAddrL( KNullDesC8 );
                }
            CleanupStack::PopAndDestroy( turnSrvAddr ); // CS:3
            }
        else if ( 0 == actualLength )
            {
            turnItem->SetTurnSrvAddrL( KNullDesC8 );
            }

        // TURNSrvPort
        TInt tmpValue( KErrNotFound );
        rep->Get( tmpKey|KUNSAFProtocolsTURNPortMask, tmpValue );
        turnItem->SetTurnSrvPort( tmpValue );

        // TURNUsername
        actualLength = 0;
        rep->Get( tmpKey|KUNSAFProtocolsTURNUsernameMask, tmp, actualLength );
        if ( actualLength > 0 )
            {
            HBufC8* turnUsername = HBufC8::NewLC( actualLength ); // CS:4
            TPtr8 ptr( turnUsername->Des() );
            TInt err = rep->Get( tmpKey|KUNSAFProtocolsTURNUsernameMask, 
                ptr );
            if ( KErrNone == err )
                {
                turnItem->SetTurnUsernameL( turnUsername->Des() );
                }
            else
                {
                turnItem->SetTurnUsernameL( KNullDesC8 );
                }
            CleanupStack::PopAndDestroy( turnUsername ); // CS:3
            }
        else
            {
            turnItem->SetTurnUsernameL( KNullDesC8 );
            }

        // TURNPassword
        actualLength = 0;
        rep->Get( tmpKey|KUNSAFProtocolsTURNPasswordMask, tmp, actualLength );
        if ( actualLength > 0 )
            {
            HBufC8* turnPassword = HBufC8::NewLC( actualLength ); // CS:4
            TPtr8 ptr( turnPassword->Des() );
            TInt err = rep->Get( tmpKey|KUNSAFProtocolsTURNPasswordMask, 
                ptr );
            if ( KErrNone == err )
                {
                turnItem->SetTurnPasswordL( turnPassword->Des() );
                }
            else
                {
                turnItem->SetTurnPasswordL( KNullDesC8 );
                }
            CleanupStack::PopAndDestroy( turnPassword ); // CS:3
            }
        else
            {
            turnItem->SetTurnPasswordL( KNullDesC8 );
            }
        aItem.AddTurnServerItemL( turnItem ); // Ownership transfer.
        CleanupStack::Pop( turnItem ); // CS:2
        }

    turnKeys.Close();
    CleanupStack::PopAndDestroy( &turnKeys ); // CS:1
    CleanupStack::PopAndDestroy( rep ); // CS:0
    }