コード例 #1
0
void CEmTubePlaylistEntry::ImportL( RFileReadStream& aStream )
	{
	TInt l = aStream.ReadInt32L();
	if( l )
		{
		iLocation = HBufC::NewL( l );
		TPtr pLocation( iLocation->Des() );
		aStream.ReadL( pLocation, l );
		}
	else
		{
		iLocation = KNullDesC().AllocL();
		}

	l = aStream.ReadInt32L();
	if( l )
		{
		iName = HBufC::NewL( l );
		TPtr pName( iName->Des() );
		aStream.ReadL( pName, l );
		}
	else
		{
		iName = KNullDesC().AllocL();
		}

	iPlayCount = aStream.ReadInt32L();
	iType = (TEmTubePlaylistEntryType)aStream.ReadInt32L();
	TReal t = aStream.ReadReal64L();
	iTime = TTime( Int64( t ) );
	}
コード例 #2
0
ファイル: gtf_reader.cpp プロジェクト: svn2github/ncbi_tk
//  ----------------------------------------------------------------------------
bool CGtfReader::x_MergeFeatureLocationMultiInterval(
    const CGff2Record& record,
    CRef< CSeq_feat > pFeature )
//  ----------------------------------------------------------------------------
{
    CRef<CSeq_id> pId = CReadUtil::AsSeqId(
        record.Id(), m_iFlags & fAllIdsAsLocal);

    CRef< CSeq_loc > pLocation( new CSeq_loc );
    pLocation->SetInt().SetId( *pId );
    pLocation->SetInt().SetFrom( record.SeqStart() );
    pLocation->SetInt().SetTo( record.SeqStop() );
    if ( record.IsSetStrand() ) {
        pLocation->SetInt().SetStrand( record.Strand() );
    }
    pLocation = pLocation->Add( 
        pFeature->SetLocation(), CSeq_loc::fSortAndMerge_All, 0 );
    pFeature->SetLocation( *pLocation );
    return true;
}
コード例 #3
0
CAtomEntryData* CXmppAtomEntryParser::XmlToAtomEntryLC(const TDesC8& aStanza, TDes8& aReferenceId, TBool aExtended) {
	CAtomEntryData* aAtomEntry = CAtomEntryData::NewLC();
	
	CXmlParser* aXmlParser = CXmlParser::NewLC(aStanza);
	CTextUtilities* aTextUtilities = CTextUtilities::NewLC();
	
	TEntryContentType aEntryType = EEntryContentPost;
	
	aReferenceId.Zero();
	
	do {
		TPtrC8 aElementName = aXmlParser->GetElementName();
		
		if(aElementName.Compare(_L8("updated")) == 0) {
			aAtomEntry->SetPublishTime(CTimeUtilities::DecodeL(aXmlParser->GetStringData()));
		}
		else if(aElementName.Compare(_L8("thr:in-reply-to")) == 0) {
			aReferenceId.Copy(aXmlParser->GetStringAttribute(_L8("ref")).Left(aReferenceId.MaxLength()));
		}
		else if(aElementName.Compare(_L8("author")) == 0) {
			CXmlParser* aAuthorXmlParser = CXmlParser::NewLC(aXmlParser->GetStringData());
			
			do {
				aElementName.Set(aAuthorXmlParser->GetElementName());
				
				if(aElementName.Compare(_L8("name")) == 0) {
					aAtomEntry->SetAuthorNameL(aTextUtilities->Utf8ToUnicodeL(aAuthorXmlParser->GetStringData()));
				}
				else if(aElementName.Compare(_L8("jid")) == 0) {
					aAtomEntry->SetAuthorJidL(aTextUtilities->Utf8ToUnicodeL(aAuthorXmlParser->GetStringData()));
				}
				else if(aElementName.Compare(_L8("affiliation")) == 0) {
					aAtomEntry->SetAuthorAffiliation(CXmppEnumerationConverter::PubsubAffiliation(aAuthorXmlParser->GetStringData()));
				}
			} while(aAuthorXmlParser->MoveToNextElement());
			
			CleanupStack::PopAndDestroy(); // aAuthorXmlParser
			
			if(aAtomEntry->GetAuthorJid().Length() == 0) {
				aAtomEntry->SetAuthorJidL(aTextUtilities->Utf8ToUnicodeL(aXmlParser->GetStringData()));
			}			
		}
		else if(aElementName.Compare(_L8("content")) == 0) {
			aAtomEntry->SetContentL(aTextUtilities->Utf8ToUnicodeL(aXmlParser->GetStringData()), aEntryType);
		}	
		else if(aElementName.Compare(_L8("geoloc")) == 0) {
			CXmppGeolocParser* aGeolocParser = CXmppGeolocParser::NewLC();
			CGeolocData* aGeoloc = aGeolocParser->XmlToGeolocLC(aXmlParser->GetStringData());
			
			aAtomEntry->GetLocation()->SetStringL(EGeolocText, aGeoloc->GetString(EGeolocText));
			aAtomEntry->GetLocation()->SetStringL(EGeolocLocality, aGeoloc->GetString(EGeolocLocality));
			aAtomEntry->GetLocation()->SetStringL(EGeolocCountry, aGeoloc->GetString(EGeolocCountry));
			
			if(aGeoloc->GetString(EGeolocText).Length() == 0) {
				HBufC* aLocation = HBufC::NewLC(aGeoloc->GetString(EGeolocLocality).Length() + 2 + aGeoloc->GetString(EGeolocCountry).Length());
				TPtr pLocation(aLocation->Des());
				aTextUtilities->AppendToString(pLocation, aGeoloc->GetString(EGeolocLocality), KNullDesC);
				aTextUtilities->AppendToString(pLocation, aGeoloc->GetString(EGeolocCountry), _L(", "));
				
				aAtomEntry->GetLocation()->SetStringL(EGeolocText, pLocation);
				CleanupStack::PopAndDestroy(); // aLocation
			}
			
			CleanupStack::PopAndDestroy(2); // aGeoloc, aGeolocParser
		}
		else if(aElementName.Compare(_L8("star")) == 0) {
			aAtomEntry->SetHighlighted(aXmlParser->GetBoolData());
		}
		else if(aExtended && aElementName.Compare(_L8("x")) == 0) {
			aAtomEntry->SetIdL(aXmlParser->GetStringAttribute(_L8("id")));
			aAtomEntry->SetRead(aXmlParser->GetBoolAttribute(_L8("read")));
			aAtomEntry->SetHighlighted(aXmlParser->GetBoolAttribute(_L8("star")));
			aAtomEntry->SetPrivate(aXmlParser->GetBoolAttribute(_L8("private")));
			aAtomEntry->SetDirectReply(aXmlParser->GetBoolAttribute(_L8("reply")));
			aAtomEntry->SetIconId(aXmlParser->GetIntAttribute(_L8("icon")));
			aAtomEntry->SetAuthorAffiliation((TXmppPubsubAffiliation)aXmlParser->GetIntAttribute(_L8("affiliation")));
			aEntryType = (TEntryContentType)aXmlParser->GetIntAttribute(_L8("type"));
		}
	} while(aXmlParser->MoveToNextElement());
	
	CleanupStack::PopAndDestroy(2); // aElementData, aXmlParser
	
	return aAtomEntry;
}