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

📄 response.h

📁 symbian http/post引擎 xml引擎 支持IAP设置
💻 H
字号:
/*
* ============================================================================
*  Name     : CResponse from Response.h
*  Part of  : TaskManager
*  Created  : 03/13/2005 by Forum Nokia
*  Version  : 1.2
*  Copyright: Nokia Corporation
* ============================================================================
*/

#ifndef __CRESPONSE_H
#define __CRESPONSE_H

// INCLUDE FILES
#include <e32std.h>
#include <badesca.h> //CDesCArray

#include "XmlHandler.h"
#include "HttpConstants.h"

#include "TaskManager.hrh"

// CLASS DECLARATION

/**
* A wrapper class for handling responses from the server.
*/
class CResponse : public CBase,
				  public MXmlHandlerObserver
	{
public: // Constructors and destructor
	
	/**
	* Two-phased constructor.
	*/
	static CResponse* NewL();

	/**
	* Two-phased constructor.
	*/
	static CResponse* NewLC();

	/**
	* Destructor
	*/
	~CResponse();

	enum TResponseType
		{
		ELoadTasks = 0,
		ETaskComplete
		};
	HBufC8*			iReceivedData;

public: // New functions

	/**
	* Constructs this response object from the data received from the server.
	* @param aData the data that was received from the server
	*/
	void InputDataL(const TDesC8& aData);

	/**
	* Returns whether errors occurred in the server side.
	* @return ETrue if response contains errors, EFalse if not.
	*/
	TBool HasError() const;

	/**
	* Returns the error description.
	* @return the error description.
	*/
	TBuf<KMaxError> Error() const;

	/**
	* Returns the number of tasks received from the server.
	* @return the number of tasks received from the server.
	*/
	TInt TaskCount() const;

	/**
	* Returns the task description.
	* @param aIndex the index of the description.
	* @return the task description.
	*/
	TBuf<KMaxTaskLength> TaskDescription(const TInt& aIndex) const;

	/**
	* Returns the task id.
	* @return the task id.
	*/
	TInt TaskId(const TInt& aIndex) const;

	/**
	* Returns the type of this response. 
	* @return the type of this response.
	*/
	TResponseType ResponseType() const;

private://MXmlHandlerObserver
    virtual void OnParseCompleted( TInt aError );
    
private: 

	/**
	* Symbian OS default constructor
	*/
	CResponse();
	void ConstructL();
	
	enum TTaskReadStatus
		{
		EStart = 0,
		EReadId,
		EReadTask
		};
		
private: // Data members

	TBuf<KMaxError>	iError;
	CDesCArray*		iDescriptions;
	RArray<TInt>	iIds;
	TResponseType	iResponseType;
	
    CXmlHandler*    iXmlHandler;
    
	};

#endif

// End of file


⌨️ 快捷键说明

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