|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Declaration of class CCodEng. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef COD_ENG_H |
|
22 #define COD_ENG_H |
|
23 |
|
24 // INCLUDES |
|
25 |
|
26 #include <e32base.h> |
|
27 #include <apmrec.h> |
|
28 |
|
29 #include "CodEngBase.h" |
|
30 |
|
31 // FORWARD DECLARATION |
|
32 |
|
33 class CEikProcess; |
|
34 class MCodLoadObserver; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * COD Handler Engine (processing COD, fetching content, posting status). |
|
40 */ |
|
41 NONSHARABLE_CLASS( CCodEng ): public CCodEngBase |
|
42 { |
|
43 |
|
44 public: // Constructors and destructor |
|
45 |
|
46 /** |
|
47 * Two phased constructor. Leaves on failure. |
|
48 * @param aProcess Host process. |
|
49 * @param aObserver Observer or NULL. |
|
50 * @return The created model. |
|
51 */ |
|
52 IMPORT_C static CCodEng* NewL |
|
53 ( CEikProcess* aProcess, MCodLoadObserver* aObserver = NULL ); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 IMPORT_C ~CCodEng(); |
|
59 |
|
60 protected: // Constructors and destructor |
|
61 |
|
62 /** |
|
63 * Constructor. |
|
64 * @param aObserver Observer. |
|
65 */ |
|
66 CCodEng( MCodLoadObserver* aObserver ); |
|
67 |
|
68 protected: // from CCodEngBase |
|
69 |
|
70 /** |
|
71 * Check data (storage space, MIME type, mandatory attributes etc.) |
|
72 * Leave on any errors. |
|
73 */ |
|
74 void CheckDataL(); |
|
75 |
|
76 /** |
|
77 * Parse data buffer. |
|
78 */ |
|
79 void ParseDataL(); |
|
80 |
|
81 /** |
|
82 * Get http status code from error code and state. This method contains |
|
83 * the semantic interpretation of errors; e.g. failure to notify due |
|
84 * to loss of service is regarded as success, etc. |
|
85 * @param aError Error code. |
|
86 * @param aState State. |
|
87 * @return HTTP status code (to post). |
|
88 */ |
|
89 TInt StatusCode( TInt aError, TState aState ) const; |
|
90 |
|
91 /** |
|
92 * Get textual representation of COD notify HTTP code. This text is |
|
93 * sent back as notification. |
|
94 * @param aCode HTTP code, values should only be the ones returned by |
|
95 * StatusCode(). Other values panic. |
|
96 * @return Textual form of HTTP code. |
|
97 */ |
|
98 const TDesC8& StatusText( TInt aCode ) const; |
|
99 |
|
100 }; |
|
101 |
|
102 #endif /* def COD_ENG_H */ |