common/tools/ats/smoketest/email/testutils/inc/T_Utils.h
changeset 719 d5603c08781b
child 872 17498133d9ad
equal deleted inserted replaced
718:b18be44be852 719:d5603c08781b
       
     1 /**
       
     2 * Copyright (c) 2006-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 the License "Symbian Foundation License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * This is the header file which contains the common utility functions
       
    16 * 
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @file
       
    26 */
       
    27 
       
    28 
       
    29 #ifndef __T_UTILS_H__
       
    30 #define __T_UTILS_H__
       
    31 
       
    32 
       
    33 // Epoc includes
       
    34 #include <msvapi.h>
       
    35 
       
    36 // Forward Declaration
       
    37 class RResourceFile;
       
    38 
       
    39 /**
       
    40 Implements a class to contain the utility functions required across servers
       
    41 */
       
    42 class CT_MsgUtils
       
    43 	{	
       
    44 public:
       
    45 	IMPORT_C CT_MsgUtils();
       
    46 	~CT_MsgUtils();
       
    47 
       
    48 	// Returns the EntryID of the entry based on the entry name
       
    49 	IMPORT_C static TMsvId FindEntryByNameL(CMsvSession* aSession, TMsvId aParentId, TDesC& aEntryName, TBool aCaseSensitive = EFalse);
       
    50 	 
       
    51 	// Returns the EntryID of the entry based on the entry name and entry parent name
       
    52 	IMPORT_C static TMsvId FindEntryByNameL(CMsvSession* aSession, TMsvId aParentId, TDesC& aEntryName, TDesC& aParentEntryName, TBool aCaseSensitive = EFalse);
       
    53 	
       
    54 	// Returns the EntryId of the entry based on the entry name under the given parent entry
       
    55 	IMPORT_C static TMsvId FindEntryByNameL(CMsvEntry* aEntry,TDesC& aEntryName, TBool aCaseSensitive = EFalse);
       
    56 	
       
    57 	// Returns the EntryID of the entry based on the entry name and entry parent name under the given parent entry
       
    58 	IMPORT_C static TMsvId FindEntryByNameL(CMsvEntry* aEntry,TDesC& aEntryName, TDesC& aParentEntryName, TBool aCaseSensitive = EFalse);
       
    59 
       
    60 	// Creates a selection of the children
       
    61 	IMPORT_C static CMsvEntrySelection* CreateChildrenSelectionL(CMsvSession* aSession, TMsvId aEntryId);
       
    62 
       
    63 	// Creates a selection of the children with a specified type
       
    64 	IMPORT_C static CMsvEntrySelection* CreateChildrenSelectionWithTypeL(CMsvSession* aSession, TMsvId aEntryId, TUid aType);
       
    65 
       
    66 	// Returns a selection of the child entries under the specified remote folder
       
    67 	IMPORT_C static CMsvEntrySelection*  CreateChildrenSelectionRemoteFolderL(CMsvSession* aSession,TPtrC aAccountName,
       
    68 															TPtrC aFolderName);
       
    69 
       
    70 	// Returns a selection of the child entries under the specified remote folder with a specified type
       
    71 	IMPORT_C static CMsvEntrySelection*  CreateChildrenSelectionRemoteFolderWithTypeL(CMsvSession* aSession,TPtrC aAccountName,
       
    72 															TPtrC aFolderName, TUid aType);
       
    73 									
       
    74 	// Searches for a given entry under the specified remote folder Id for IMAP
       
    75 	IMPORT_C static TMsvId GetRemoteFolderIdByNameL(CMsvSession* aSession,TPtrC aAccountName,TPtrC aFolderName, TBool aCaseSensitive = EFalse);
       
    76 	
       
    77 	// Searches for a given entry under the specified remote folder Id for IMAP - overloaded version with parent folder name
       
    78 	IMPORT_C static TMsvId GetRemoteFolderIdByNameL(CMsvSession* aSession,TPtrC aAccountName,TPtrC aFolderName, TPtrC aParentFolderName, TBool aCaseSensitive = EFalse);
       
    79 
       
    80 	// Searches for a message in a given folder based ont he message subject
       
    81 	IMPORT_C static TMsvId SearchMessageBySubjectL(CMsvSession* aSession, TMsvId afolderId, TPtrC aSubject);
       
    82 	
       
    83 	// Searches for a message in a given folder based ont he message subject ..overloaded
       
    84 	IMPORT_C static TMsvId SearchMessageBySubjectL(CMsvSession* aSession,TMsvId afolderId,TPtrC aSubject, TBool aVisibleFlag);
       
    85 	
       
    86 	// Compares two input files
       
    87 	IMPORT_C static TInt CompareFilesL(TPtrC aFileOne, TPtrC aFileTwo, TBool aIsUnicode,CArrayFixFlat<TUint16>* aIgnoreCharList,
       
    88 																			TBool& aDiffFlag);
       
    89 
       
    90 	// Reads data chunk from the file stream.Returns ETrue if the EOF found.
       
    91 	IMPORT_C static TBool ReadDataL(RFileReadStream& aFileReadStream,TPtr& aPtrLineBuffer, TBool aIsUnicode, 
       
    92 																	CArrayFixFlat<TUint16>* aIgnoreCharList);
       
    93 
       
    94 	IMPORT_C static void OpenResourceFileL(RResourceFile& rFile, RFs& anFs, const TDesC& aFileName );
       
    95  		
       
    96  	//Closes the Open Resource File
       
    97  	IMPORT_C static void CloseResourceFile( TAny* aFile );
       
    98  	
       
    99  private:
       
   100  	// Recursively searches the EntryID of the entry based on the entry name
       
   101  	TMsvId static RecFindEntryByNameL(CMsvEntry& aEntry, TDesC& aEntryName, TBool aCaseSensitive);
       
   102  	
       
   103  	// Recursively searches the EntryID of the entry based on the entry name and parent entry name
       
   104  	TMsvId static RecFindEntryByNameL(CMsvEntry& aEntry, TDesC& aEntryName, TDesC& aParentEntryName, TBool aCaseSensitive);
       
   105  	
       
   106  	// Checks if the given parent name matches the name of the given parent entry
       
   107  	TBool static CheckParent(CMsvEntry& aParentEntry, TDesC& aParentEntryName);
       
   108 	};
       
   109 #endif //__T_UTILS_H__