|
1 /* |
|
2 * Copyright (c) 2002-2007 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: Skin server's file buffer. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef AKNSSRVFILEBUFFER_H |
|
20 #define AKNSSRVFILEBUFFER_H |
|
21 |
|
22 // INCLUDE FILES |
|
23 |
|
24 #include <e32std.h> |
|
25 #include <f32file.h> |
|
26 #include <caf/caf.h> |
|
27 // CLASS DECLARATION |
|
28 |
|
29 /** |
|
30 * |
|
31 */ |
|
32 NONSHARABLE_CLASS(CAknsSrvFileBuffer) : public CBase |
|
33 { |
|
34 public: // Construction and destruction |
|
35 |
|
36 /** |
|
37 * Symbian constructor. |
|
38 * @param aFilehandle file handle. |
|
39 * @return new instance of CAknsSrvFileBuffer. |
|
40 */ |
|
41 static CAknsSrvFileBuffer* NewL( RFile& aFilehandle ); |
|
42 /** |
|
43 * Destructor. |
|
44 */ |
|
45 virtual ~CAknsSrvFileBuffer(); |
|
46 |
|
47 public: // New methods |
|
48 |
|
49 /** |
|
50 * Gets 32-bit integer value from file. |
|
51 * @param aOffset offset in the file |
|
52 * @return 32-bit integer value from file. |
|
53 */ |
|
54 TInt32 GetInt32L( const TUint aOffset ); |
|
55 |
|
56 /** |
|
57 * Gets 16-bit unsigned integer value from file. |
|
58 * @param aOffset offset in the file |
|
59 * @return 16-bit unsigned integer value from file. |
|
60 */ |
|
61 TUint16 GetUint16L( const TUint aOffset ); |
|
62 |
|
63 /** |
|
64 * Gets 16-bit integer value from file. |
|
65 * @param aOffset offset in the file |
|
66 * @return 16-bit integer value from file. |
|
67 */ |
|
68 TInt16 GetInt16L( const TUint aOffset ); |
|
69 |
|
70 /** |
|
71 * Gets 8-bit unsigned integer value from file. |
|
72 * @param aOffset offset in the file |
|
73 * @return 8-bit unsigned integer value from file. |
|
74 */ |
|
75 TUint8 GetUint8L( const TUint aOffset ); |
|
76 |
|
77 private: // New methods |
|
78 |
|
79 /** |
|
80 * Makes pointer to buffer. |
|
81 */ |
|
82 const TAny* PtrToBuffer( const TUint aOffset ) const; |
|
83 |
|
84 /** |
|
85 * Reads buffer from given offset. |
|
86 */ |
|
87 void ReadToBufferL( const TUint aOffset, const TUint aSize ); |
|
88 |
|
89 /** |
|
90 * Fills buffer. |
|
91 */ |
|
92 void FillBufferL(); |
|
93 |
|
94 /** |
|
95 * Checks if offset is within range. |
|
96 */ |
|
97 TBool IsWithin( const TUint aOffset, const TUint aSize ) const; |
|
98 |
|
99 private: // Construction and destruction |
|
100 |
|
101 /** |
|
102 * Symbian 2nd phase constructor. |
|
103 */ |
|
104 void ConstructL(RFile& aFilehandle); |
|
105 |
|
106 /** |
|
107 * C++ constructor. |
|
108 */ |
|
109 CAknsSrvFileBuffer(); |
|
110 |
|
111 |
|
112 private: // Data |
|
113 |
|
114 ContentAccess::CContent* iContent; |
|
115 ContentAccess::CData* iData; |
|
116 HBufC8* iBuffer; |
|
117 TInt iPosition; |
|
118 TInt iLength; |
|
119 |
|
120 }; |
|
121 |
|
122 #endif |
|
123 |
|
124 // End of File |