|
1 /* |
|
2 * Copyright (c) 2006, 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: This class creates the dps xml script. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef DPSXMLGENERATOR_H |
|
20 #define DPSXMLGENERATOR_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <s32file.h> |
|
24 #include "dpsdefs.h" |
|
25 #include "dpsconst.h" |
|
26 |
|
27 class CDpsEngine; |
|
28 |
|
29 /** |
|
30 * This class creates dps scripts. |
|
31 */ |
|
32 NONSHARABLE_CLASS(CDpsXmlGenerator) : public CBase |
|
33 { |
|
34 public: |
|
35 /** |
|
36 * Two phase constructor |
|
37 * @param aEngine a pointer to dps engine |
|
38 * @return a CDpsXmlGenerator instance |
|
39 */ |
|
40 static CDpsXmlGenerator* NewL(CDpsEngine* aEngine); |
|
41 |
|
42 /** |
|
43 * Destructor |
|
44 */ |
|
45 ~CDpsXmlGenerator(); |
|
46 |
|
47 /** |
|
48 * Creates the Dps result script |
|
49 * @param aEvent a dps event, can be empty |
|
50 * @param aScript dps script content. after this function is |
|
51 * returned, aScript has the valid content |
|
52 * @param aResult the operation result |
|
53 */ |
|
54 void CreateResultScriptL(TDpsEvent aEvent, |
|
55 RWriteStream& aScript, |
|
56 const TDpsResult& aResult) const; |
|
57 |
|
58 /** |
|
59 * Creates the dps reply script |
|
60 */ |
|
61 void CreateReplyScriptL(TDpsOperation aOperation, |
|
62 RWriteStream& aScript, |
|
63 const TDpsResult& aResult, |
|
64 const TDpsArg& aArg) const; |
|
65 |
|
66 private: |
|
67 /** |
|
68 * Default constructor |
|
69 * @param aEngine a pointer to dps engine |
|
70 */ |
|
71 CDpsXmlGenerator(CDpsEngine* aEngine); |
|
72 |
|
73 public: |
|
74 /** |
|
75 * Fillin the start part of a script |
|
76 * @param aScript the content of a script |
|
77 */ |
|
78 void StartDocumentL(RWriteStream& aScript) const; |
|
79 |
|
80 /** |
|
81 * Fillin the end part of a script |
|
82 * @param aScript the content of a script |
|
83 */ |
|
84 void EndDocumentL(RWriteStream& aScript) const; |
|
85 |
|
86 /** |
|
87 * Fillin the start part of a input in the script |
|
88 * @param aScript the content of a script |
|
89 */ |
|
90 void StartInputL(RWriteStream& aScript) const; |
|
91 |
|
92 /** |
|
93 * Fillin the end part of a input in the script |
|
94 * @param aScript the content of a script |
|
95 */ |
|
96 void EndInputL(RWriteStream& aScript) const; |
|
97 |
|
98 /** |
|
99 * Fillin the start part of the result in the script |
|
100 * @param aScript the content of a script |
|
101 * @param aResult the result to be filled |
|
102 */ |
|
103 void StartResultL(RWriteStream& aScript, const TDpsResult& aResult) const; |
|
104 |
|
105 /** |
|
106 * Fillin the end part of the result in the script |
|
107 * @param aScript the content of a script |
|
108 */ |
|
109 void EndResultL(RWriteStream& aScript) const; |
|
110 |
|
111 /** |
|
112 * Fillin the start part of the operation in the script |
|
113 * @param aOperation the operation enumeration |
|
114 * @param aScript the content of a script |
|
115 * @param aEnd ETrue if the operation does not have an argument, |
|
116 * EFalse otherwise |
|
117 */ |
|
118 void StartOperationL(TDpsOperation aOperation, RWriteStream& aScript, |
|
119 TBool aEnd = EFalse) const; |
|
120 |
|
121 /** |
|
122 * Fillin the end part of the operation in the script |
|
123 * @param aOperation the operation enumeration |
|
124 * @param aScript the content of a script |
|
125 */ |
|
126 void EndOperationL(TDpsOperation aOperation, RWriteStream& aScript) const; |
|
127 |
|
128 /** |
|
129 * Fillin the event parameter in the script |
|
130 * @param aScript the content of a script. |
|
131 * @param aEvent the event enumeration |
|
132 */ |
|
133 void CreateEventL(RWriteStream& aScript, TDpsEvent aEvent) const; |
|
134 |
|
135 /** |
|
136 * Fillin the arguments |
|
137 * @param aScript the content of a script |
|
138 * @param aArgument arguments to be used to fill the script |
|
139 * @param aAttrib the attribute |
|
140 */ |
|
141 void CreateArgL(RWriteStream& aScript, const TDpsArg& aArgument, |
|
142 TDpsAttribute aAttrib = 0) const; |
|
143 |
|
144 /** |
|
145 * Fillin the start part of an element |
|
146 * @param aElement the element enumeration |
|
147 * @param aScript the content of a script |
|
148 */ |
|
149 void StartElementL(TDpsElement aElement, RWriteStream& aScript) const; |
|
150 |
|
151 /** |
|
152 * Fillin the end part of an element |
|
153 * @param aElement the element enumeration |
|
154 * @param aScript the content of a script |
|
155 */ |
|
156 void EndElementL(TDpsElement aElement, RWriteStream& aScript) const; |
|
157 |
|
158 private: |
|
159 // not owned by this class |
|
160 CDpsEngine* iEngine; |
|
161 }; |
|
162 |
|
163 #endif |