|
1 /* |
|
2 * Copyright (c) 2006 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: Implementation of transaction handler |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CMTRANSACTION_HANDLER_H |
|
19 #define CMTRANSACTION_HANDLER_H |
|
20 |
|
21 #include <commsdattypesv1_1.h> |
|
22 |
|
23 /** |
|
24 * Transaction handler. |
|
25 * |
|
26 * @lib cmmanager.lib |
|
27 * @since S60 v3.2 |
|
28 */ |
|
29 NONSHARABLE_CLASS( CCmTransactionHandler ) : public CBase |
|
30 { |
|
31 public: |
|
32 |
|
33 /** Epoc constructor */ |
|
34 static CCmTransactionHandler* NewL( CommsDat::CMDBSession& aDb ); |
|
35 |
|
36 // destructor is intentionally not virtual. |
|
37 ~CCmTransactionHandler(); |
|
38 |
|
39 public: |
|
40 |
|
41 /** |
|
42 * @return commsdat session |
|
43 */ |
|
44 CommsDat::CMDBSession& Session()const{ return iDb; }; |
|
45 |
|
46 /** |
|
47 * - Checks if transaction is already opened |
|
48 * - Set iOwnTransaction is not and opens it and |
|
49 * put 'this' on cleanup&close stack |
|
50 */ |
|
51 void OpenTransactionLC( TBool aSetAttribs = ETrue ); |
|
52 |
|
53 /** |
|
54 * - Checks if the transaction is ours. |
|
55 * - If yes, commits the transaction. |
|
56 * - anyway does nothing |
|
57 * @praram aError - error id |
|
58 */ |
|
59 void CommitTransactionL( TInt aError = KErrNone ); |
|
60 |
|
61 /** |
|
62 * Performs RollbackTransactionL(). |
|
63 */ |
|
64 void Close(); |
|
65 |
|
66 private: |
|
67 |
|
68 /** Constructor. */ |
|
69 CCmTransactionHandler( CommsDat::CMDBSession& aDb ); |
|
70 |
|
71 /** |
|
72 * Second phase constructor. Leaves on failure. |
|
73 */ |
|
74 void ConstructL(); |
|
75 |
|
76 private: // data |
|
77 |
|
78 CommsDat::CMDBSession& iDb; ///< Not owned CommsDat session pointer |
|
79 TUint32 iRefCount; |
|
80 TUint32 iProtectionFlag; |
|
81 }; |
|
82 |
|
83 #endif // CMTRANSACTION_HANDLER |