Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // BSP.H (Base Script Parser)
15 // Abstract class for different Parsers.
20 #if !defined(__BSP_H__)
23 #if !defined(__MTCLREG_H__)
27 #if !defined(__MTCLBASE_H__)
32 #if !defined(__S32STRM_H__)
37 // CRichText etc. includes
46 /** Space character. */
47 #define KCharSpace ' '
50 /** Line feed character. */
51 #define KCharLineFeed '\n'
54 // Define some generic error codes:
55 /** BIO error code base. */
56 const TInt KBspBaseError = (-500);
58 /** Invalid BIO message error code. */
59 const TInt KBspInvalidMessage = (KBspBaseError);
60 /** Invalid smart message token error code. */
61 const TInt KBspSmartMessageInvalidToken = (KBspBaseError-1);
62 /** No smart message parser defined error code. */
63 const TInt KBspSmartMessageNoParserDefined = (KBspBaseError-2);
65 // Parsed field class for use by parsers.
66 class CParsedField : public CBase
67 /** Represents a single token-value pair for a given field in a BIO/smart message
74 IMPORT_C CParsedField();
75 IMPORT_C ~CParsedField();
77 IMPORT_C TPtrC FieldName() const;
78 IMPORT_C void SetFieldNameL( const TDesC& aFieldName);
79 IMPORT_C TPtrC FieldValue() const;
80 IMPORT_C void SetFieldValueL( const TDesC& aFieldValue);
81 IMPORT_C TBool MandatoryField() const;
82 IMPORT_C void SetMandatoryField(TBool aMandatoryField);
84 IMPORT_C void InternalizeL(RReadStream& aStream);
85 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
91 TBool iMandatoryField;
94 // Forward declarations:
95 class CMsvServerEntry;
97 class CRegisteredParserDll;
99 class RMsvWriteStream;
105 /** Base class for BIO message parsers V2.
107 Concrete derived classes are implemented in parser DLL's to parse particular
108 types of BIO message.
110 On receiving an appropriate command (see TBioOperation), the BIO server MTM
111 loads the appropriate parser and passes the message body to it for interpretation.
112 In fact, the parser interface expects the parser to divide its operation into
115 1. parsing: which involves extracting information from the raw message body and
116 storing it in a structured format. The parsing stage can also alter the message
117 body, and create files in the directory associated with the message (e.g.
118 parsing a ring tones message will generate a ring tone file).
120 2. processing: which involves using the extracted information to achieve the
121 purpose of the BIO message (e.g. setting some phone configuration setttings).
123 This separation allows, for example, a UI to display the parsed information
124 to the user for confirmation, before it is acted upon. For some parsers, however,
125 this two stage division is not sensible, in which case they implement only
128 The base class provides a pointer iSettings to reference the raw message data,
129 and an array of token-value pairs, iParsedFieldArray, for storing parsed information
130 (if this is appropriate).
134 class CBaseScriptParser2: public CActive
137 IMPORT_C CBaseScriptParser2(CRegisteredParserDll& aRegisteredParserDll, CMsvEntry& aEntry, RFs& aFs);
138 IMPORT_C ~CBaseScriptParser2();
140 /** Called by the BIO server MTM to asynchronously parse message body data.
142 When parsing is complete, the function should indicate this by setting the
143 message's index field iMtmData3 to 1.
145 The function should leave if the buffer cannot be parsed successfully.
147 @param aStatus Asynchronous status word
148 @param aSms Buffer to parse */
149 virtual void ParseL(TRequestStatus& aStatus, const TDesC& aSms)=0; //parses sms data into CParsedField
150 /** Called by the BIO server MTM to asynchronously process the parsed data.
152 The function takes appropriate parser-specific action on the results of a
153 previous call to ParseL().
155 When processing is complete, the function should indicate this by setting
156 the message's index field iMtmData3 to 2.
158 The function should leave if processing is not successful.
160 @param aStatus Asynchronous status word */
161 virtual void ProcessL(TRequestStatus& aStatus)=0; //stores parsed data into streams and data base
163 IMPORT_C TUid ParserUid();
164 IMPORT_C void RestoreL(CMsvStore& aMessageStore);
165 IMPORT_C void StoreL(CMsvStore& aMsvStore) const;
166 IMPORT_C void RestoreL(const TFileName& aFileName);
167 IMPORT_C void StoreL(const TFileName& aFileName) const;
168 IMPORT_C void ResetL();
172 IMPORT_C void UnfoldMessageL();
174 // Streaming operations:
175 void InternalizeL(RMsvReadStream& aStream);
176 void ExternalizeL(RMsvWriteStream& aStream) const;
179 /** Object that loaded the parser. It contains a reference counter of the use of
181 CRegisteredParserDll& iRegisteredParserDll;
182 /** The message entry the parser should parse. */
184 /** Connected file server handle. */
187 /** Lexer intended for Smart Message use.
189 This is not used by the base class. */
191 /** Array of token-value pairs.
193 Derived classes can use this for storing parsed information (if this is appropriate). */
194 CArrayPtrSeg<CParsedField>* iParsedFieldArray;
196 /** Flag intended for Smart Message use.
198 This is not used by the base class. */
203 /** Pointer to message data.
205 This is not set by the base class. */
207 /** Pointer to SMS data (intended for Smart Message use).
209 This is not set by the base class. */
210 HBufC* iSmsBuf; // Local copy of buffer passed to ParseL()
211 /** Temporary pointer used by RestoreL(). */
212 HBufC8* iReadBuffer; // used to restore data from file
216 /** BIO data location flag values.
219 enum TMsvBIODataLocation
223 /** Parser wrote data into the body text. */
224 EBodyText, // parser wrote data back into richText
225 /** Parser wrote data into the parsed fields data stream. */
226 EBIODataStream, // parser wrote data into KUIDMsvBioStream
227 /** Parser wrote data into an attachment file. */
228 EFile // parser wrote data into attachment file
232 /** Bearer Independent Object entry.
233 Specialises the TMsvEntry message entry class to store additional BIO message-specific
238 class TMsvBIOEntry : public TMsvEntry
242 TMsvBIOEntry() : TMsvEntry() {};
243 void SetBIOParserUid(const TUid aId);
244 const TUid BIOParserUid() const;
245 void SetLocationOfData(const TMsvBIODataLocation aLocation);
246 const TMsvBIODataLocation LocationOfData() const;
249 TMsvBIODataLocation iLocationOfData;