?? esimdocument.cpp
字號:
/*
============================================================================
Name : CESIMDocument from ESIMDocument.h
Author : hagu
Version :
Description : CESIMDocument implementation
============================================================================
*/
// INCLUDE FILES
#include "ESIMDocument.h"
#include "ESIMAppui.h"
#include "ESIMItemEngine.h"
#include "ESIMUserItem.h"
#include "ESIMGroupItem.h"
const TInt KMaxInfoLength = 1024;
// ================= MEMBER FUNCTIONS =======================
// constructor
CESIMDocument::CESIMDocument(CEikApplication& aApp)
: CAknDocument(aApp)
{
}
// destructor
CESIMDocument::~CESIMDocument()
{
TRAPD( Err, SaveL() );//調用appUi的SaveL會在退出時有異常,此處使用是,當整個程序退出的時候,在析構iItemEnginge之前保存其中的數據。
delete iItemEngine;
delete iInfoText;
delete iInfoText2;
}
// EPOC default constructor can leave.
void CESIMDocument::ConstructL()
{
iItemEngine = CESIMItemEngine::NewL();
iInfoText = HBufC::NewL( KMaxInfoLength );
iInfoText2 = HBufC::NewL( KMaxInfoLength );
}
// Two-phased constructor.
CESIMDocument* CESIMDocument::NewL(
CEikApplication& aApp) // CESIMApp reference
{
CESIMDocument* self = new (ELeave) CESIMDocument( aApp );
CleanupStack::PushL( self );
self->ConstructL();
CleanupStack::Pop();
return self;
}
// ----------------------------------------------------
// CESIMDocument::CreateAppUiL()
// constructs CESIMAppUi
// ----------------------------------------------------
//
CEikAppUi* CESIMDocument::CreateAppUiL()
{
return new (ELeave) CESIMAppUi;
}
// ---------------------------------------------------------
// CESIMDocument::OpenFileL()
// ---------------------------------------------------------
//
CFileStore* CESIMDocument::OpenFileL( TBool aDoOpen,
const TDesC& aFilename, RFs& aFs )
{
return CEikDocument::OpenFileL( aDoOpen, aFilename, aFs );
}
// ---------------------------------------------------------
// CESIMDocument::StoreL()
// ---------------------------------------------------------
//
void CESIMDocument::StoreL( CStreamStore& aStore,
CStreamDictionary& aStreamDic ) const
{
iItemEngine->ExternalizeL(aStore, aStreamDic, Application()->AppDllUid());
}
// ---------------------------------------------------------
// CESIMDocument::RestoreL()
// ---------------------------------------------------------
//
void CESIMDocument::RestoreL( const CStreamStore& aStore,
const CStreamDictionary& aStreamDic )
{
iItemEngine->InternalizeL(aStore, aStreamDic, Application()->AppDllUid());
}
// ---------------------------------------------------------
// CESIMItemEngine* CESIMDocument::GetItemEngine()
// ---------------------------------------------------------
//
CESIMItemEngine* CESIMDocument::GetItemEngine()
{
return iItemEngine;
}
// -----------------------------------------------------------------------------
// CESIMDocument::StoreInfoTextL
// -----------------------------------------------------------------------------
//
void CESIMDocument::StoreInfoTextL( const TDesC& aText )
{
__ASSERT_ALWAYS(
( aText.Length() + 1 ) < KMaxInfoLength, User::Leave( KErrArgument ) );
TPtr ptext( iInfoText->Des() );
TInt appendLen = aText.Length() + 1; // plus one is for line break
if ( ( appendLen + iInfoText->Length() ) > KMaxInfoLength )
{
ptext.Delete( 0, appendLen );
}
ptext.Append( aText );
ptext.Append( CEditableText::ELineBreak );
}
void CESIMDocument::StoreInfoText2L( const TDesC& aText )
{
__ASSERT_ALWAYS(
( aText.Length() + 1 ) < KMaxInfoLength, User::Leave( KErrArgument ) );
TPtr ptext( iInfoText2->Des() );
TInt appendLen = aText.Length() + 1; // plus one is for line break
if ( ( appendLen + iInfoText2->Length() ) > KMaxInfoLength )
{
ptext.Delete( 0, appendLen );
}
ptext.Append( aText );
ptext.Append( CEditableText::ELineBreak );
}
// -----------------------------------------------------------------------------
// CESIMDocument::InfoText
// -----------------------------------------------------------------------------
//
const TDesC& CESIMDocument::InfoText()
{
return *iInfoText;
}
const TDesC& CESIMDocument::InfoText2()
{
return *iInfoText2;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -