|
1 /** |
|
2 * Copyright (c) 2003-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 "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 * Script Reader and Executor Header |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 /** |
|
23 @file Sscrread.h |
|
24 */ |
|
25 |
|
26 #ifndef __SSCRREAD_H__ |
|
27 #define __SSCRREAD_H__ |
|
28 |
|
29 #include <e32base.h> |
|
30 |
|
31 struct TLinePosition |
|
32 { |
|
33 public: |
|
34 TLinePosition(TInt aLineCount =0,TInt aLineStart =0,TInt aLineLength =0,TInt aOffset =0); |
|
35 TLinePosition& operator=(const TLinePosition& aLinePosition); |
|
36 void Reset(); |
|
37 public: |
|
38 TInt iLineCount; ///< number of line |
|
39 TInt iLineStart; ///< character number of line start |
|
40 TInt iLineLength; ///< length of line |
|
41 TInt iOffset; ///< offset in line |
|
42 }; |
|
43 |
|
44 |
|
45 class TScriptStatus |
|
46 /** |
|
47 @internalComponent |
|
48 */ |
|
49 { |
|
50 public: |
|
51 TScriptStatus(TInt& aOffset,TPtrC& aLine,TBool& aSkip,TBool& aSkipModeToggleReq); |
|
52 TScriptStatus(const TScriptStatus& aStatus); |
|
53 public: |
|
54 TInt& iOffset; |
|
55 TPtrC& iLine; |
|
56 TBool& iSkip; |
|
57 TBool& iSkipModeToggleReq; |
|
58 }; |
|
59 |
|
60 |
|
61 class CScriptReader : public CBase |
|
62 /** |
|
63 One of these per CScriptExecutor object. |
|
64 Gets chunk of the script from the database and reads script line by line. |
|
65 |
|
66 @internalComponent |
|
67 */ |
|
68 { |
|
69 public: |
|
70 static CScriptReader* NewL(TInt aBufferSize); |
|
71 ~CScriptReader(); |
|
72 void SetScript(const TDesC& aScript); |
|
73 TBool IsScriptSet() const; |
|
74 TScriptStatus ScriptStatus(); |
|
75 TInt GetNextLine(); |
|
76 void CurrentPos(TLinePosition& aPosition,TInt aOffset); |
|
77 void SetCurrentPos(TLinePosition aPosition); |
|
78 TInt Reset(); |
|
79 inline void SetLoggingOff(); |
|
80 inline void SetLoggingOn(); |
|
81 private: |
|
82 CScriptReader(); |
|
83 void ConstructL(TInt aBufferSize); |
|
84 TInt GetCurrentLine(); |
|
85 private: |
|
86 HBufC* iScriptBuffer; |
|
87 TPtr iScript; |
|
88 TLinePosition iCurrentPosition; |
|
89 TBool iLoggingOn; |
|
90 TBool iScriptSet; |
|
91 // These for script status only |
|
92 TPtrC iCurrentLine; |
|
93 TBool iSkip; |
|
94 TBool iSkipModeToggleReq; |
|
95 }; |
|
96 |
|
97 #include "SSCRREAD.INL" |
|
98 |
|
99 #endif |