HTTP示例

源代码在线查看: response.h

软件大小: 1549 K
上传用户: afaslgo
关键词: HTTP
下载地址: 免注册下载 普通下载 VIP

相关代码

				/*
				* ============================================================================
				*  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 
				#include  //CDesCArray
				#include "TaskManager.hrh"
				
				// CLASS DECLARATION
				
				/**
				* A wrapper class for handling responses from the server.
				*/
				class CResponse : public CBase
					{
				public: // Constructors and destructor
					
					/**
					* Two-phased constructor.
					*/
					static CResponse* NewL();
				
					/**
					* Two-phased constructor.
					*/
					static CResponse* NewLC();
				
					/**
					* Destructor
					*/
					~CResponse();
				
					enum TResponseType
						{
						ELoadTasks = 0,
						ETaskComplete
						};
				
				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 TDesC& 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 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 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: 
				
					/**
					* Symbian OS default constructor
					*/
					CResponse();
					void ConstructL();
					
					enum TTaskReadStatus
						{
						EStart = 0,
						EReadId,
						EReadTask
						};
						
				private: // Data members
				
					TBuf	iError;
					CDesCArray*		iDescriptions;
					RArray	iIds;
					TResponseType	iResponseType;
					};
				
				#endif
				
				// End of file
				
				
							

相关资源