messagingfw/msgtest/testutils/base/inc/MsvTestUtils.inl
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 inline TMsvTestDllInfo::TMsvTestDllInfo(const TDesC& aFileName, TInt aOrdinal, TVersion aVersion)
       
    17 : iFileName(aFileName), iOrdinal(aOrdinal), iVersion(aVersion)
       
    18 	{
       
    19 	}
       
    20 
       
    21 inline void CMsvTestUtils::CreateAndSetEntryL(TMsvEntry& aEntry)
       
    22 	{
       
    23 	CreateEntryL(aEntry);
       
    24 	SetEntryL(aEntry.Id());
       
    25 	}
       
    26 
       
    27 inline void CMsvTestUtils::CreateEntryL(TMsvEntry& aEntry)
       
    28 	{
       
    29 	if (iClientServer == EServerSide)
       
    30 		User::LeaveIfError(iServerEntry->CreateEntry(aEntry));
       
    31 	else if (iClientServer == EClientSide)
       
    32 		iMsvEntry->CreateL(aEntry);
       
    33 	else
       
    34 		User::Leave(KErrNotSupported);
       
    35 	}
       
    36 
       
    37 inline void CMsvTestUtils::DeleteEntryL(TMsvId aId)
       
    38 	{
       
    39 	if (iClientServer == EServerSide)
       
    40 		User::LeaveIfError(iServerEntry->DeleteEntry(aId));
       
    41 	else if (iClientServer == EClientSide)
       
    42 		iMsvEntry->DeleteL(aId);
       
    43 	else
       
    44 		User::Leave(KErrNotSupported);
       
    45 	}
       
    46 
       
    47 inline void CMsvTestUtils::ChangeEntryL(TMsvEntry& aEntry)
       
    48 	{
       
    49 	if (iClientServer == EServerSide)
       
    50 		User::LeaveIfError(iServerEntry->ChangeEntry(aEntry));
       
    51 	else if (iClientServer == EClientSide)
       
    52 		iMsvEntry->ChangeL(aEntry);
       
    53 	else
       
    54 		User::Leave(KErrNotSupported);
       
    55 	}
       
    56 
       
    57 inline void CMsvTestUtils::SetEntryL(TMsvId aId)
       
    58 	{
       
    59 	if (iClientServer == EServerSide)
       
    60 		User::LeaveIfError(iServerEntry->SetEntry(aId));
       
    61 	else if (iClientServer == EClientSide)
       
    62 		iMsvEntry->SetEntryL(aId);
       
    63 	else
       
    64 		User::Leave(KErrNotSupported);
       
    65 	}
       
    66 
       
    67 inline CMsvStore* CMsvTestUtils::EditStoreL()
       
    68 	{
       
    69 	CMsvStore* store = NULL ;
       
    70 
       
    71 	if (iClientServer == EServerSide)
       
    72 		store = iServerEntry->EditStoreL();
       
    73 	else if (iClientServer == EClientSide)
       
    74 		store = iMsvEntry->EditStoreL();
       
    75 	else
       
    76 		User::Leave(KErrNotSupported);
       
    77 
       
    78 	return store;
       
    79 	}
       
    80 
       
    81 inline CMsvStore* CMsvTestUtils::ReadStoreL()
       
    82 	{
       
    83 	CMsvStore* store = NULL;
       
    84 
       
    85 	if (iClientServer == EServerSide)
       
    86 		store = iServerEntry->ReadStoreL();
       
    87 	else if (iClientServer == EClientSide)
       
    88 		store = iMsvEntry->ReadStoreL();
       
    89 	else
       
    90 		User::Leave(KErrNotSupported);
       
    91 
       
    92 	return store;
       
    93 	}
       
    94 
       
    95 inline TMsvEntry CMsvTestUtils::Entry()
       
    96 	{
       
    97 	TMsvEntry entry;
       
    98 	
       
    99 	if (iClientServer == EServerSide)
       
   100 		{
       
   101 		entry = iServerEntry->Entry();
       
   102 		}
       
   103 	else if (iClientServer == EClientSide)
       
   104 		{
       
   105 		entry = iMsvEntry->Entry();
       
   106 		}
       
   107 	else
       
   108 		{
       
   109 		Panic(KErrNotSupported);
       
   110 		}
       
   111 
       
   112 	return entry;
       
   113 	}
       
   114 
       
   115 inline CMsvEntrySelection* CMsvTestUtils::ChildrenWithTypeLC(TUid aType)
       
   116 	{
       
   117 	CMsvEntrySelection* sel = NULL;
       
   118 
       
   119 	if (iClientServer == EServerSide)
       
   120 		{
       
   121 		sel = new (ELeave) CMsvEntrySelection();
       
   122 		CleanupStack::PushL(sel);
       
   123 		iServerEntry->GetChildrenWithType(aType, *sel);
       
   124 		}
       
   125 	else if (iClientServer == EClientSide)
       
   126 		{
       
   127 		sel = iMsvEntry->ChildrenWithTypeL(aType);
       
   128 		CleanupStack::PushL(sel);
       
   129 		}
       
   130 	else
       
   131 		{
       
   132 		Panic(KErrNotSupported);
       
   133 		}
       
   134 
       
   135 	return sel;
       
   136 	}
       
   137 
       
   138 inline CMsvEntrySelection* CMsvTestUtils::ChildrenWithMtmLC(TUid aMtm)
       
   139 	{
       
   140 	CMsvEntrySelection* sel = NULL;
       
   141 
       
   142 	if (iClientServer == EServerSide)
       
   143 		{
       
   144 		sel = new (ELeave) CMsvEntrySelection();
       
   145 		CleanupStack::PushL(sel);
       
   146 		iServerEntry->GetChildrenWithMtm(aMtm, *sel);
       
   147 		}
       
   148 	else if (iClientServer == EClientSide)
       
   149 		{
       
   150 		sel = iMsvEntry->ChildrenWithMtmL(aMtm);
       
   151 		CleanupStack::PushL(sel);
       
   152 		}
       
   153 	else
       
   154 		{
       
   155 		Panic(KErrNotSupported);
       
   156 		}
       
   157 
       
   158 	return sel;
       
   159 	}
       
   160 
       
   161 
       
   162 inline void CMsvTestUtils::SetSortTypeL(TMsvSelectionOrdering aOrder)
       
   163 	{
       
   164 	if (iClientServer == EServerSide)
       
   165 		{
       
   166 		iServerEntry->SetSort(aOrder);
       
   167 		}
       
   168 	else if (iClientServer == EClientSide)
       
   169 		{
       
   170 		iMsvEntry->SetSortTypeL(aOrder);
       
   171 		}
       
   172 	else
       
   173 		{
       
   174 		User::Leave(KErrNotSupported);
       
   175 		}
       
   176 	}
       
   177 
       
   178