⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logexamplelogdatabaseobserver.cpp

📁 Log Engine的使用
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CLogExampleLogDatabaseObserver from LogExampleLogDatabaseObserver.h
*  Part of  : LogExample
*  Created  : 26.05.2005 by Forum Nokia  
*  Implementation notes:
*  Version  : 1.0
*  Copyright: Nokia Corporation
* ============================================================================*/

// INCLUDE FILES
#include "LogExampleLogDatabaseObserver.h"
#include "DatabaseObserver.h"

// ========================= PUBLIC ========================= 

// ----------------------------------------------------------
// CLogExampleLogDatabaseObserver::
// CLogExampleLogDatabaseObserver():CActive(EPriorityStandard)
// Default Symbian constructor
// ----------------------------------------------------------
//
CLogExampleLogDatabaseObserver::CLogExampleLogDatabaseObserver(MDatabaseObserver& aObserver):
			CActive(EPriorityStandard), iObserver(aObserver)
	{
	}

// ----------------------------------------------------
// CLogExampleLogDatabaseObserver::~CLogExampleLogDatabaseObserver()
// Destructor
// Frees reserved resources
// ----------------------------------------------------
//
CLogExampleLogDatabaseObserver::~CLogExampleLogDatabaseObserver()
	{
	Cancel();
	delete iLogClient;
	iFs.Close();
	}

// ----------------------------------------------------
// CLogExampleLogDatabaseObserver::NewL(MDatabaseObserver& aObserver)
// Symbian 2-phase constructor
// ----------------------------------------------------
//
CLogExampleLogDatabaseObserver* CLogExampleLogDatabaseObserver
			::NewL(MDatabaseObserver& aObserver)
	{
	CLogExampleLogDatabaseObserver* self = CLogExampleLogDatabaseObserver
											::NewLC(aObserver);
	CleanupStack::Pop(self);
	return self;
	}

// ----------------------------------------------------
// CLogExampleLogDatabaseObserver::NewLC( MDatabaseObserver& aObserver)
// Symbian 2-phase constructor
// ----------------------------------------------------
//
CLogExampleLogDatabaseObserver* CLogExampleLogDatabaseObserver
			::NewLC(MDatabaseObserver& aObserver)
	{
	CLogExampleLogDatabaseObserver* self = new (ELeave) CLogExampleLogDatabaseObserver( aObserver );
	CleanupStack::PushL(self);
	self->ConstructL(aObserver);
	return self;
	}

//======================= PRIVATE ====================== 

// ----------------------------------------------------
// CLogExampleLogDatabaseObserver::ConstructL(MDatabaseObserver& aObserver)
// Symbian 2-phase constructor
// ----------------------------------------------------
//
void CLogExampleLogDatabaseObserver::ConstructL(MDatabaseObserver& aObserver)
	{

	User::LeaveIfError(iFs.Connect());
	
	//establish connection to log engine
	iLogClient = CLogClient::NewL(iFs);
 	
 	iObserver = aObserver;
	CActiveScheduler::Add(this);
	
	}

// ----------------------------------------------------
// CLogExampleLogDatabaseObserver::RunL()
// RunL for active object
// ----------------------------------------------------
//
void CLogExampleLogDatabaseObserver::RunL()
	{

	if(iStatus != KErrNone )
		{
		iObserver.NotifyChangeL();
		NotifyChange(); // Set this observer again
		}
	}
	
// ----------------------------------------------------
// CLogExampleLogDatabaseObserver::DoCancel()
// Notifies client to cancel
// ----------------------------------------------------
//
void CLogExampleLogDatabaseObserver::DoCancel()
	{
	iLogClient->NotifyChangeCancel();
	}

// ----------------------------------------------------
// CLogExampleLogDatabaseObserver::NotifyChange()
// Notifies client of change
// ----------------------------------------------------
//
void CLogExampleLogDatabaseObserver::NotifyChange()
	{
	if(IsActive())
		{
		return;
		}
	iLogClient->NotifyChange(1000000, iStatus);
	SetActive();
	}
	
//End of file

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -