|
1 /* |
|
2 * Copyright (c) 2005-2006 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 "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: State machine for fetching and caching files and directories |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_RSFW_FETCHANDCACHESTATEMACHINE_H |
|
20 #define C_RSFW_FETCHANDCACHESTATEMACHINE_H |
|
21 |
|
22 #include "rsfwwaitnotestatemachine.h" |
|
23 |
|
24 /** |
|
25 * State machine for fetching and caching files and directories |
|
26 * |
|
27 */ |
|
28 class CRsfwFetchAndCacheStateMachine : public CRsfwWaitNoteStateMachine |
|
29 { |
|
30 public: |
|
31 CRsfwFetchAndCacheStateMachine(); |
|
32 TState* ErrorOnStateExit(TInt aError); |
|
33 |
|
34 public: |
|
35 // STATES |
|
36 // Before DoFetch we call UpdateAttributesL, |
|
37 // where it is decided whether cached data is used... |
|
38 // so this operation has only one state that fetches the data - |
|
39 // possibly from the server or then from the local cache |
|
40 class TFetchDataState : public CRsfwFetchAndCacheStateMachine::TState |
|
41 { |
|
42 public: |
|
43 TFetchDataState(CRsfwFetchAndCacheStateMachine* aOperation); |
|
44 void EnterL(); |
|
45 TState* CompleteL(); |
|
46 TState* ErrorL(TInt aCode); |
|
47 private: |
|
48 CRsfwFetchAndCacheStateMachine* iOperation; |
|
49 }; |
|
50 |
|
51 public: |
|
52 TState* CompleteRequestL(TInt aError); |
|
53 |
|
54 public: |
|
55 // input params |
|
56 // the first byte requested |
|
57 // = the current cached size |
|
58 TInt iFirstByte; |
|
59 |
|
60 // output params: |
|
61 // last byte of the container file after fetch |
|
62 TInt iLastByte; |
|
63 |
|
64 // directory entries, when used to fetch directory contents... |
|
65 RPointerArray<CRsfwDirEnt> iDirEnts; |
|
66 |
|
67 // length of the data fetched |
|
68 TInt iLength; |
|
69 |
|
70 }; |
|
71 |
|
72 #endif // C_RSFW_FETCHANDCACHESTATEMACHINE_H |