?? mycontenthandler.cpp
字號:
/*
============================================================================
Name : MyContentHandler.cpp
Author :
Version :
Copyright : Your copyright notice
Description : CMyContentHandler implementation
============================================================================
*/
#include "MyContentHandler.h"
#include <aknnotewrappers.h>
//Constants
const TInt KBufferSize = 1024; // buffer size to store the result of
// XML parsing -> the actual buffer size
// can expand if needed (see AppendText())
const TInt KFileBufferSize = 1024; // buffer size for file reading
const TInt KOverheadLen = 4; // length of (KOpeningTag + KClosingTag
// + KSlash + KEndOfLine)
CMyContentHandler::CMyContentHandler()
{
// No implementation required
}
CMyContentHandler::~CMyContentHandler()
{
}
CMyContentHandler* CMyContentHandler::NewLC()
{
CMyContentHandler* self = new (ELeave)CMyContentHandler();
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
CMyContentHandler* CMyContentHandler::NewL()
{
CMyContentHandler* self=CMyContentHandler::NewLC();
CleanupStack::Pop(); // self;
return self;
}
void CMyContentHandler::ConstructL()
{
}
void CMyContentHandler::AppendText( const TDesC& aText )
{
/*TPtr displayResultPtr( iDisplayResult->Des() );
if ( displayResultPtr.Length() + aText.Length() > displayResultPtr.MaxLength() )
{
iDisplayResult = iDisplayResult->ReAllocL( displayResultPtr.MaxLength()+ KBufferSize );
displayResultPtr.Set( iDisplayResult->Des() );
}
displayResultPtr.Append( aText );*/
}
void CMyContentHandler::OnStartDocumentL( const RDocumentParameters &aDocParam, TInt aErrorCode )
{
_LIT( KOnStartDocumentL, "*** OnStartDocumentL ***\f" );
//iDisplayResult->Des().Zero();
AppendText( KOnStartDocumentL );
}
void CMyContentHandler::OnEndDocumentL( TInt aErrorCode )
{
}
void CMyContentHandler::OnStartElementL( const RTagInfo &aElement, const RAttributeArray &aAttributes, TInt aErrorCode )
{
//判斷是否是presence標簽
if( 0 == (aElement.LocalName().DesC().Compare(_L8("presence"))) )
{
TInt count = aAttributes.Count();
for(TInt i=0; i<count; i++)
{
TBuf8<20> name = aAttributes[i].Attribute().LocalName().DesC();
//獲得"entity",即聯系人ID
if((name.Compare(_L8("entity")))== 0 )
{
TBuf8<100> value = aAttributes[i].Value().DesC();
/*this->Contact.Copy(value);*/
}
}
}
if( 0 ==(aElement.LocalName().DesC().Compare(_L8("basic"))))
{
// //設置聯系人狀態已經開始解析
//this->iStateStored = ETrue ;
}
}
void CMyContentHandler::OnEndElementL( const RTagInfo &aElement, TInt aErrorCode )
{
}
void CMyContentHandler::OnContentL( const TDesC8 &aBytes, TInt aErrorCode )
{
//HBufC* textResource = StringLoader::LoadLC( R_HEWB_COMMAND1_TEXT );
//
//// Show the information Note with
//// textResource loaded with StringLoader.
//CAknInformationNote* informationNote = new ( ELeave ) CAknInformationNote;
//informationNote->ExecuteLD( *textResource );
//// Pop HBuf from CleanUpStack and Destroy it.
//CleanupStack::PopAndDestroy( textResource );
HBufC* buffer = HBufC::NewLC(aBytes.Length()+1);
TPtr bufferPtr( buffer->Des() );
bufferPtr.Copy( aBytes );
//TPtr bufferPtr( buffer->Des() );
//buffer->Des().Append(aBytes);
//bufferPtr.Copy( aBytes );
CAknInformationNote* informationNote = new ( ELeave ) CAknInformationNote;
informationNote->ExecuteLD(* buffer);
//delete informationNote;
CleanupStack::PopAndDestroy(); // buffer
}
void CMyContentHandler::OnStartPrefixMappingL( const RString &aPrefix, const RString &aUri, TInt aErrorCode )
{
}
void CMyContentHandler::OnEndPrefixMappingL( const RString &aPrefix, TInt aErrorCode )
{
}
void CMyContentHandler::OnIgnorableWhiteSpaceL( const TDesC8 &aBytes, TInt aErrorCode )
{
}
void CMyContentHandler::OnSkippedEntityL( const RString &aName, TInt aErrorCode )
{
}
void CMyContentHandler::OnProcessingInstructionL( const TDesC8 &aTarget, const TDesC8 &aData,TInt aErrorCode)
{
}
void CMyContentHandler::OnError( TInt aErrorCode )
{
}
TAny *CMyContentHandler::GetExtendedInterface( const TInt32 aUid )
{
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -