|
1 /* |
|
2 * Copyright (c) 2009 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: Class responsible of handling mmp files. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __CATMMP_H__ |
|
20 #define __CATMMP_H__ |
|
21 |
|
22 // Includes |
|
23 #include "ATCommonDefines.h" |
|
24 #include "CATBase.h" |
|
25 |
|
26 /** |
|
27 * CATMmp represents mmp file of module. |
|
28 * All mmp file related actions are done using this class. |
|
29 * @author |
|
30 */ |
|
31 class CATMmp : public CATBase |
|
32 { |
|
33 |
|
34 public: |
|
35 |
|
36 // Constructor |
|
37 CATMmp(); |
|
38 |
|
39 // Destructor |
|
40 ~CATMmp(); |
|
41 |
|
42 string m_sMmpFile; /** The mmp file with path */ |
|
43 |
|
44 /** |
|
45 * Makes AnalyzeTool changes to given mmp file. |
|
46 * @param sTargetType target type of module i.e. exe / dll |
|
47 * @param sId unique identification string added to source file name |
|
48 * @return true if editing was successful. |
|
49 */ |
|
50 bool EditMmpFile(const string& sTargetType, const string& sId); |
|
51 |
|
52 /** |
|
53 * Backups mmp file to atool_temp/file |
|
54 * to path/atool_temp/filename.mmp.tmp. |
|
55 * Calling this function results always to |
|
56 * none edited mmp & none edited backup. |
|
57 * @return true if successful. |
|
58 */ |
|
59 bool BackupMmpFile(); |
|
60 |
|
61 /** |
|
62 * Restores backup from temporary directory (replacing current). |
|
63 * @return true if successful. |
|
64 */ |
|
65 bool RestoreMmpFile(); |
|
66 |
|
67 /** |
|
68 * VerifyAndRecover mmp file. |
|
69 * Wont change mmp if it is not edited |
|
70 * Replaces mmp file using backup if it exists and it is |
|
71 * not edited otherwise removes changes from mmp file. |
|
72 * @return true if successful |
|
73 */ |
|
74 bool VerifyAndRecover(); |
|
75 |
|
76 #ifndef MODULE_TEST |
|
77 private: |
|
78 #endif |
|
79 /** |
|
80 * Checks if the given mmp file is modified by AT |
|
81 * @param bBackup if true checks backup |
|
82 * @return bool true if it is edited |
|
83 */ |
|
84 bool IsMmpEdited(bool bBackup = false ); |
|
85 |
|
86 /** |
|
87 * CreateBackupPath creates string containinig |
|
88 * full path to backup mmp file |
|
89 */ |
|
90 string CreateMmpBackupPath(); |
|
91 |
|
92 /** |
|
93 * Removes AnalyzeTool changes from given file |
|
94 * @param bBackup if true removes changes from backup |
|
95 * @return true if successfully removed changes |
|
96 */ |
|
97 bool RemoveMmpFileChanges(bool bBackup = false); |
|
98 |
|
99 /** |
|
100 * Removes write protections from mmp file and its backup if exists. |
|
101 * @return true if successful. |
|
102 */ |
|
103 bool RemoveWriteProtections(); |
|
104 |
|
105 }; |
|
106 #endif |