|
1 /* |
|
2 * Copyright (c) 2002 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 * Implementation of the CDosAsyncExecBase class. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include "dosasyncexecbase.h" |
|
21 |
|
22 // |
|
23 // --------------------------------------------------------- |
|
24 // CDosAsyncExecBase Constructor |
|
25 // --------------------------------------------------------- |
|
26 // |
|
27 |
|
28 EXPORT_C CDosAsyncExecBase::CDosAsyncExecBase(const RMessagePtr2 aMessage) : CActive(EPriorityStandard), iMessage(aMessage) |
|
29 { |
|
30 CActiveScheduler::Add(this); |
|
31 } |
|
32 |
|
33 // |
|
34 // --------------------------------------------------------- |
|
35 // CDosAsyncExecBase Desctructor |
|
36 // --------------------------------------------------------- |
|
37 // |
|
38 |
|
39 EXPORT_C CDosAsyncExecBase::~CDosAsyncExecBase() |
|
40 { |
|
41 Cancel(); |
|
42 } |
|
43 |
|
44 // |
|
45 // --------------------------------------------------------- |
|
46 // CDosAsyncExecBase::RunL |
|
47 // |
|
48 // Inherited from CActive. |
|
49 // --------------------------------------------------------- |
|
50 // |
|
51 |
|
52 EXPORT_C void CDosAsyncExecBase::RunL() |
|
53 { |
|
54 TBool autoDestroy = ETrue; |
|
55 TBool complete = ETrue; |
|
56 |
|
57 BeforeComplete(complete); |
|
58 if(complete) |
|
59 { |
|
60 iMessage.Complete(iStatus.Int()); |
|
61 AfterComplete(autoDestroy); |
|
62 if(autoDestroy) |
|
63 { |
|
64 delete this; |
|
65 } |
|
66 } |
|
67 } |
|
68 |
|
69 // |
|
70 // --------------------------------------------------------- |
|
71 // CDosAsyncExecBase::BeforeComplete |
|
72 // |
|
73 // Default empty implementation. A derived class can override |
|
74 // this. |
|
75 // --------------------------------------------------------- |
|
76 // |
|
77 |
|
78 EXPORT_C void CDosAsyncExecBase::BeforeComplete(TBool& /*aComplete*/) |
|
79 { |
|
80 } |
|
81 |
|
82 // |
|
83 // --------------------------------------------------------- |
|
84 // CDosAsyncExecBase::AfterComplete |
|
85 // |
|
86 // Default empty implementation. A derived class can override |
|
87 // this. |
|
88 // --------------------------------------------------------- |
|
89 // |
|
90 |
|
91 EXPORT_C void CDosAsyncExecBase::AfterComplete(TBool& /*aAutoDestroy*/) |
|
92 { |
|
93 } |
|
94 |
|
95 // |
|
96 // --------------------------------------------------------- |
|
97 // CDosAsyncExecBase::DoCancel |
|
98 // |
|
99 // Inherited from CActive. |
|
100 // --------------------------------------------------------- |
|
101 // |
|
102 |
|
103 EXPORT_C void CDosAsyncExecBase::DoCancel() |
|
104 { |
|
105 TRequestStatus* status = &iStatus; |
|
106 User::RequestComplete(status,KErrCancel); |
|
107 } |