|
1 /* |
|
2 * Copyright (c) 2004 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: Alert queue |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "NSmlAlertQueue.h" |
|
20 |
|
21 // --------------------------------------------------------- |
|
22 // CNSmlMessageParserBase(CSmlAlertInfo& aAlertInfo, CSyncMLHistoryPushMsg& aHistoryInfo ) |
|
23 // Constructor |
|
24 // --------------------------------------------------------- |
|
25 CNSmlMessageParserBase::CNSmlMessageParserBase(CSmlAlertInfo& aAlertInfo, CSyncMLHistoryPushMsg& aHistoryInfo ) |
|
26 : iAlertInfo(aAlertInfo), iHistoryInfo(aHistoryInfo), iMessagePtr( 0, NULL, 0) |
|
27 { |
|
28 |
|
29 } |
|
30 |
|
31 // --------------------------------------------------------- |
|
32 // CNSmlMessageParserBase::~CNSmlMessageParserBase() |
|
33 // Destructor |
|
34 // --------------------------------------------------------- |
|
35 CNSmlMessageParserBase::~CNSmlMessageParserBase() |
|
36 { |
|
37 delete iMessage; |
|
38 iFoundProfiles.ResetAndDestroy(); |
|
39 iFoundProfiles.Close(); |
|
40 } |
|
41 // --------------------------------------------------------- |
|
42 // CNSmlMessageParserBase::CreateBufferL( TInt aSize ) |
|
43 // Creates buffer of specified size |
|
44 // --------------------------------------------------------- |
|
45 void CNSmlMessageParserBase::CreateBufferL( TInt aSize ) |
|
46 { |
|
47 delete iMessage; |
|
48 iMessage = NULL; |
|
49 iMessage = HBufC8::NewL( aSize ); |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------- |
|
53 // CNSmlMessageParserBase::Message() |
|
54 // Returns pointer to the buffer |
|
55 // --------------------------------------------------------- |
|
56 TPtr8& CNSmlMessageParserBase::Message() |
|
57 { |
|
58 iMessagePtr.Set( iMessage->Des() ); |
|
59 return iMessagePtr; |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------- |
|
63 // CNSmlMessageParserBase::CheckLengthL( TInt aPos ) |
|
64 // Returns pointer to the buffer |
|
65 // --------------------------------------------------------- |
|
66 void CNSmlMessageParserBase::CheckLengthL( TInt aPos ) |
|
67 { |
|
68 if ( Message().Length() < aPos ) |
|
69 { |
|
70 User::Leave( KErrCorrupt ); |
|
71 } |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------- |
|
75 // CNSmlMessageParserBase::DoMessageCopyLC() |
|
76 // Returns pointer to the buffer. Buffer is leaved on the cleanup stack. |
|
77 // --------------------------------------------------------- |
|
78 TPtrC8 CNSmlMessageParserBase::DoMessageCopyLC() |
|
79 { |
|
80 HBufC8* message = HBufC8::NewLC( Message().Size() ); |
|
81 message->Des().Copy( Message() ); |
|
82 return message->Des(); |
|
83 } |
|
84 |
|
85 //End of File |