|
1 /* |
|
2 * Copyright (c) 2004-2009 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 * Note: This file may contain code to generate corrupt files for test purposes. |
|
16 * Such code is excluded from production builds by use of compiler defines; |
|
17 * it is recommended that such code should be removed if this code is ever published publicly. |
|
18 * generic for integral types found in SIS files. |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 /** |
|
24 @file |
|
25 @internalComponent |
|
26 @released |
|
27 */ |
|
28 |
|
29 #ifndef __RAW_H__ |
|
30 #define __RAW_H__ |
|
31 |
|
32 #include "fieldroot.h" |
|
33 |
|
34 |
|
35 |
|
36 class CRaw : public CSISFieldRoot |
|
37 |
|
38 { |
|
39 private: |
|
40 void Alloc (const TFieldSize& aSize); |
|
41 void Dispose (); |
|
42 |
|
43 public: |
|
44 CRaw (); |
|
45 CRaw (const CRaw& aInitialiser); |
|
46 |
|
47 virtual ~CRaw (); |
|
48 virtual void Read (TSISStream& aFile, const TFieldSize& aContainerSize, const CSISFieldRoot::TFieldType aArrayType = CSISFieldRoot::ESISUndefined); |
|
49 virtual void Write (TSISStream& aFile, const bool aIsArrayElement) const; |
|
50 virtual void Skip (TSISStream& aFile, const TFieldSize& aContainerSize) const; |
|
51 virtual TFieldSize ByteCount (const bool aInsideArray) const; |
|
52 virtual void SetByteCount (const TFieldSize aSize); |
|
53 virtual void Dump (std::ostream& aStream, const int aLevel) const; |
|
54 virtual void CalculateCrc (TCRC& aCRC, const bool aIsArrayElement) const; |
|
55 virtual std::string Name () const; |
|
56 |
|
57 const TUint8* Data () const; |
|
58 TUint8* Data (); |
|
59 |
|
60 private: |
|
61 TUint8* iData; |
|
62 TFieldSize iSize; |
|
63 }; |
|
64 |
|
65 |
|
66 inline CRaw::CRaw () : |
|
67 iData (NULL), |
|
68 iSize (0) |
|
69 { |
|
70 } |
|
71 |
|
72 |
|
73 inline CRaw::~CRaw () |
|
74 { |
|
75 Dispose (); |
|
76 } |
|
77 |
|
78 |
|
79 inline const TUint8* CRaw::Data () const |
|
80 { |
|
81 assert ((iData == NULL) == (iSize == 0)); |
|
82 return iData; |
|
83 } |
|
84 |
|
85 inline TUint8* CRaw::Data () |
|
86 { |
|
87 assert ((iData == NULL) == (iSize == 0)); |
|
88 return iData; |
|
89 } |
|
90 |
|
91 #endif // __RAW_H__ |
|
92 |