memana/analyzetoolclient/commandlineengine/internal/inc/CATMmp.h
changeset 2 6a82cd05fb1e
parent 1 3ff3fecb12fe
equal deleted inserted replaced
1:3ff3fecb12fe 2:6a82cd05fb1e
     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 	// MMP file.
       
    43 	string m_sMmpFile;
       
    44 
       
    45 	/**
       
    46 	* Makes AnalyzeTool changes to given mmp file.
       
    47 	* @param sTargetType target type of module i.e. exe / dll
       
    48 	* @param sId unique identification string added to source file name
       
    49 	* @return true if editing was successful.
       
    50 	*/
       
    51 	bool EditMmpFile(const string& sTargetType, const string& sId);
       
    52 
       
    53 	/**
       
    54 	* Backups mmp file to atool_temp/file
       
    55 	* to path/atool_temp/filename.mmp.tmp.
       
    56 	* Calling this function results always to 
       
    57 	* none edited mmp & none edited backup.
       
    58 	* @return true if successful.
       
    59 	*/
       
    60 	bool BackupMmpFile();
       
    61 
       
    62 	/**
       
    63 	* Restores backup from temporary directory (replacing current).
       
    64 	* @return true if successful.
       
    65 	*/
       
    66 	bool RestoreMmpFile();
       
    67 
       
    68 	/**
       
    69 	* VerifyAndRecover mmp file.
       
    70 	* Wont change mmp if it is not edited
       
    71 	* Replaces mmp file using backup if it exists and it is
       
    72 	* not edited otherwise removes changes from mmp file.
       
    73 	* @return true if successful
       
    74 	*/
       
    75 	bool VerifyAndRecover();
       
    76 
       
    77 #ifndef MODULE_TEST
       
    78 private:
       
    79 #endif
       
    80 		/**
       
    81 	* Checks if the given mmp file is modified by AT
       
    82 	* @param bBackup if true checks backup
       
    83 	* @return bool true if it is edited
       
    84 	*/
       
    85 	bool IsMmpEdited(bool bBackup = false );
       
    86 
       
    87 	/**
       
    88 	* CreateBackupPath creates string containinig
       
    89 	* full path to backup mmp file
       
    90 	*/
       
    91 	string CreateMmpBackupPath();
       
    92 
       
    93 	/**
       
    94 	* Removes AnalyzeTool changes from given file
       
    95 	* @param bBackup if true removes changes from backup
       
    96 	* @return true if successfully removed changes
       
    97 	*/
       
    98 	bool RemoveMmpFileChanges(bool bBackup = false);
       
    99 
       
   100 	/**
       
   101 	* Removes write protections from mmp file and its backup if exists.
       
   102 	* @return true if successful.
       
   103 	*/
       
   104 	bool RemoveWriteProtections();
       
   105 
       
   106 	//Define this class as a friend class for test class.
       
   107 	friend class CATTester;
       
   108 };
       
   109 #endif