📄 httpex.h
字号:
// HttpEx.h
// ------------
//
// Copyright (c) 2000 Symbian Ltd. All rights reserved.
//
////////////////////////////////////////////////////////////////////
// HttpEx
// ----------
//
//
// The class definitions for the simple example application
// containing a single view with the text "Hello World !" drawn
// on it.
//
// The class definitions are:
//
// CHttpExApplication
// CHttpExAppUi
// CHttpExAppView
// CHttpExDocument
//
//
////////////////////////////////////////////////////////////////////
#ifndef __HttpEx_H
#define __HttpEx_H
#include <coeccntx.h>
#include <eikenv.h>
#include <eikappui.h>
#include <eikapp.h>
#include <eikdoc.h>
#include <eikmenup.h>
#include <eiklabel.h>
#include <eikon.hrh>
#include <HttpEx.rsg>
#include "HttpEx.hrh"
#include <http\rhttpsession.h>
#include <http\mhttptransactioncallback.h>
////////////////////////////////////////////////////////////////////////
//
// CHttpExApplication
//
////////////////////////////////////////////////////////////////////////
class CHttpExApplication : public CEikApplication
{
private:
// Inherited from class CApaApplication
CApaDocument* CreateDocumentL();
TUid AppDllUid() const;
};
////////////////////////////////////////////////////////////////////////
//
// CHttpExAppView
//
////////////////////////////////////////////////////////////////////////
class CHttpExAppView : public CCoeControl
{
public:
// logical state management
enum TState
{
EReady,
EFetching,
EDone,
EError,
EStateLast
};
inline TState State() const;
TInt SetState(const TState aState);
void ClearL();
void SetTextL(const TDesC& aText);
static CHttpExAppView* NewL(const TRect& aRect);
CHttpExAppView();
~CHttpExAppView();
void ConstructL(const TRect& aRect);
private:
// Inherited from CCoeControl
void Draw(const TRect& aRect) const;
inline TInt CountComponentControls() const;
inline CCoeControl* ComponentControl(TInt aIndex) const;
private:
const static TInt
KSeparatorY = 50,
KMargin = 10;
TState iState;
TPtrC iStateDesc;
CEikLabel *iBody;
};
inline CHttpExAppView::TState CHttpExAppView::State() const
{
return iState;
}
inline TInt CHttpExAppView::CountComponentControls() const
{
return 1;
}
inline CCoeControl* CHttpExAppView::ComponentControl(TInt /*aIndex*/) const
{
return iBody;
}
////////////////////////////////////////////////////////////////////////
//
// CHttpExAppUi
//
////////////////////////////////////////////////////////////////////////
class CHttpExAppUi : public CEikAppUi, public MHTTPTransactionCallback
{
public:
// construction/destruction
void ConstructL();
~CHttpExAppUi();
// methods from MHTTPTransactionCallback
virtual void MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent);
virtual TInt MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent);
private:
// methods inherited from CEikAppUi
void HandleCommandL(TInt aCommand);
void DynInitMenuPaneL(TInt aMenuId, CEikMenuPane* aMenuPane);
private:
CHttpExAppView* iAppView;
RHTTPSession iSession;
void StartRequest(const TDesC8& aUri);
// store only the first n bytes of response for this example
TBuf<4096> iResponse;
};
////////////////////////////////////////////////////////////////////////
//
// CHttpExDocument
//
////////////////////////////////////////////////////////////////////////
class CHttpExDocument : public CEikDocument
{
public:
static CHttpExDocument* NewL(CEikApplication& aApp);
CHttpExDocument(CEikApplication& aApp);
void ConstructL();
private:
// Inherited from CEikDocument
CEikAppUi* CreateAppUiL();
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -