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

📄 smsexampleparser.cpp

📁 symbian平台
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CSMSExampleParser from SMSExampleParser.h
*  Part of  : SMSExample
*  Created  : 12.03.2005 by Forum Nokia
*  Version  : 1.0
*  Copyright: Nokia Corporation
* ============================================================================
*/

#include "SMSExampleParser.h"

// ----------------------------------------------------------------------------
// CSMSExampleParser::CSMSExampleParser(void)
//
// Symbian OS 2 phase constructor.
// ----------------------------------------------------------------------------
CSMSExampleParser::CSMSExampleParser(void)
	{
	}

// ----------------------------------------------------------------------------
// CSMSExampleParser::~CSMSExampleParser(void)
//
// Destructor.
// ----------------------------------------------------------------------------
CSMSExampleParser::~CSMSExampleParser(void)
	{
	}

// ----------------------------------------------------------------------------
// CSMSExampleParser::NewL()
//
// Symbian OS 2 phase constructor.
// ----------------------------------------------------------------------------
CSMSExampleParser* CSMSExampleParser::NewL()
	{
	CSMSExampleParser* self = new (ELeave) CSMSExampleParser();
    CleanupStack::PushL(self);
    self->ConstructL();
    CleanupStack::Pop(self);
    return self;
	}
	  
// ----------------------------------------------------------------------------
// void CSMSExampleParser::ConstructL()
//
// Symbian OS 2 phase constructor.
// ----------------------------------------------------------------------------        
 void CSMSExampleParser::ConstructL()
	{
	}

// ----------------------------------------------------------------------------
// CSMSExampleParser::ParseMessage(TDesC& aMessage, TDes& aNumber)
//
// Parse message body and try to find number which has exactly 10 digits.
// ----------------------------------------------------------------------------
TBool CSMSExampleParser::ParseMessage(TDesC& aMessage, TDes& aNumber)
	{
	TLex numberLex = TLex( aMessage );

	// while not end-of-file
	while ( !numberLex.Eos() )
		{
		TChar character = numberLex.Get();

		if ( character.IsDigit() ) 
			{
			aNumber.Append( character );
			}
		else 
			{
			aNumber.Delete( 0, aNumber.Length() );
			}

		// Search for a number which is in format XXXXXXXXXX ( X = [0-9], whitespaces 
		// are not allowed). For example "0551234567" would return true. but "055 1234567" 
		// would not
		if ( aNumber.Length() == 10 ) 
			{
			return ETrue;
			}
		}

	return EFalse;
	}

⌨️ 快捷键说明

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