phonebookengines/VirtualPhonebook/tsrc/MT_VPbkEng_SelectorFactory/inc/constants.h
changeset 0 e686773b3f54
child 21 9da50d567e3c
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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:
       
    15 *
       
    16 */
       
    17 #ifndef __SELECTOR_CONSTANTS_H
       
    18 #define __SELECTOR_CONSTANTS_H
       
    19 
       
    20 #include <VPbkEng.rsg>
       
    21 #include "stifunitmacros.h"
       
    22 #include <CVPbkFieldTypeSelector.h>
       
    23 #include <MVPbkFieldType.h>
       
    24 
       
    25 
       
    26 const TInt KUniEditorFields[] = {
       
    27     R_VPBK_FIELD_TYPE_MOBILEPHONEGEN, 
       
    28     R_VPBK_FIELD_TYPE_MOBILEPHONEHOME,
       
    29     R_VPBK_FIELD_TYPE_MOBILEPHONEWORK,
       
    30     R_VPBK_FIELD_TYPE_ASSTPHONE,
       
    31     R_VPBK_FIELD_TYPE_CARPHONE,
       
    32     R_VPBK_FIELD_TYPE_EMAILGEN,
       
    33     R_VPBK_FIELD_TYPE_EMAILHOME,
       
    34     R_VPBK_FIELD_TYPE_EMAILWORK
       
    35     };
       
    36 const TInt KUniEditorFieldsSize = sizeof(KUniEditorFields) / sizeof(TInt);
       
    37 
       
    38 
       
    39 const TInt KEmailEditorSelectors[] = {
       
    40     R_VPBK_FIELD_TYPE_EMAILGEN, 
       
    41     R_VPBK_FIELD_TYPE_EMAILHOME,
       
    42     R_VPBK_FIELD_TYPE_EMAILWORK
       
    43     };
       
    44 const TInt KEmailEditorSelectorsSize = sizeof(KEmailEditorSelectors) / sizeof(TInt);
       
    45 
       
    46 
       
    47 const TInt KInstantMessagingSelectors[] = {
       
    48     R_VPBK_FIELD_TYPE_IMPP 
       
    49     };
       
    50 const TInt KInstantMessagingSelectorsSize = sizeof(KInstantMessagingSelectors) / sizeof(TInt);
       
    51 
       
    52 
       
    53 const TInt KEVoiceCallSelectorFields[] = {
       
    54     R_VPBK_FIELD_TYPE_MOBILEPHONEGEN, 
       
    55     R_VPBK_FIELD_TYPE_MOBILEPHONEHOME,
       
    56     R_VPBK_FIELD_TYPE_MOBILEPHONEWORK,
       
    57     R_VPBK_FIELD_TYPE_LANDPHONEGEN,
       
    58     R_VPBK_FIELD_TYPE_LANDPHONEHOME,
       
    59     R_VPBK_FIELD_TYPE_LANDPHONEWORK,
       
    60     R_VPBK_FIELD_TYPE_PAGERNUMBER,
       
    61     R_VPBK_FIELD_TYPE_ASSTPHONE,
       
    62     R_VPBK_FIELD_TYPE_CARPHONE
       
    63     };
       
    64 const TInt KEVoiceCallSelectorFieldsSize = sizeof(KEVoiceCallSelectorFields) / sizeof(TInt);
       
    65 
       
    66 // voip
       
    67 const TInt KEVOIPCallSelectorFields[] = {
       
    68     R_VPBK_FIELD_TYPE_VOIPGEN,
       
    69     R_VPBK_FIELD_TYPE_VOIPHOME, 
       
    70     R_VPBK_FIELD_TYPE_VOIPWORK,
       
    71     R_VPBK_FIELD_TYPE_POC,
       
    72     R_VPBK_FIELD_TYPE_SWIS,
       
    73     R_VPBK_FIELD_TYPE_SIP,
       
    74     R_VPBK_FIELD_TYPE_IMPP
       
    75     };
       
    76 const TInt KEVOIPCallSelectorFieldsSize = sizeof(KEVOIPCallSelectorFields) / sizeof(TInt);
       
    77 
       
    78 const TInt KEVOIPCallOutSelectorFields[] = {
       
    79         R_VPBK_FIELD_TYPE_MOBILEPHONEGEN, 
       
    80         R_VPBK_FIELD_TYPE_MOBILEPHONEHOME,
       
    81         R_VPBK_FIELD_TYPE_MOBILEPHONEWORK,
       
    82         R_VPBK_FIELD_TYPE_LANDPHONEGEN,
       
    83         R_VPBK_FIELD_TYPE_LANDPHONEHOME,
       
    84         R_VPBK_FIELD_TYPE_LANDPHONEWORK,
       
    85         R_VPBK_FIELD_TYPE_ASSTPHONE,
       
    86         R_VPBK_FIELD_TYPE_CARPHONE
       
    87     };
       
    88 const TInt KEVOIPCallOutSelectorFieldsSize = sizeof(KEVOIPCallOutSelectorFields) / sizeof(TInt);
       
    89 
       
    90 const TInt KEVOIPXspSelectorFields[] = {
       
    91         R_VPBK_FIELD_TYPE_IMPP
       
    92     };
       
    93 const TInt KEVOIPXspSelectorFieldsSize = sizeof(KEVOIPXspSelectorFields) / sizeof(TInt);
       
    94 
       
    95 
       
    96 const TInt KVideoCallSelectors[] = {
       
    97         R_VPBK_FIELD_TYPE_MOBILEPHONEGEN, 
       
    98         R_VPBK_FIELD_TYPE_MOBILEPHONEHOME,
       
    99         R_VPBK_FIELD_TYPE_MOBILEPHONEWORK,
       
   100         R_VPBK_FIELD_TYPE_VIDEONUMBERGEN,
       
   101         R_VPBK_FIELD_TYPE_VIDEONUMBERHOME,
       
   102         R_VPBK_FIELD_TYPE_VIDEONUMBERWORK
       
   103     };
       
   104 const TInt KVideoCallSelectorsSize = sizeof(KVideoCallSelectors) / sizeof(TInt);
       
   105 
       
   106 const TInt KURLSelectors[] = {
       
   107         R_VPBK_FIELD_TYPE_URLGEN, 
       
   108         R_VPBK_FIELD_TYPE_URLHOME,
       
   109         R_VPBK_FIELD_TYPE_URLWORK
       
   110     };
       
   111 const TInt KURLSelectorsSize = sizeof(KURLSelectors) / sizeof(TInt);
       
   112 
       
   113 class CAssertUtils : public CBase
       
   114     {
       
   115 public:
       
   116     CAssertUtils(CStifLogger& aLog) : iLog(&aLog) 
       
   117         {}
       
   118     void AssertTypesL(
       
   119             CVPbkFieldTypeSelector& aSelector, 
       
   120             const TInt aTypes[],
       
   121             const TInt aSize,
       
   122             const MVPbkFieldTypeList& aFieldTypes,
       
   123             TTestResult& aResult)
       
   124         {
       
   125         iResult = &aResult;
       
   126         TInt count = aFieldTypes.FieldTypeCount();
       
   127         while (--count >= 0)
       
   128             {
       
   129             const MVPbkFieldType& type = aFieldTypes.FieldTypeAt(count);
       
   130             TBool included = aSelector.IsFieldTypeIncluded(type);
       
   131             TInt index = Find(type.FieldTypeResId(), aTypes, aSize);
       
   132             if (index >= 0)
       
   133                 {
       
   134                 // assert that field is included
       
   135                 STIF_LOG("resid: %d, included %d", type.FieldTypeResId(), included);
       
   136                 STIF_ASSERT(included);
       
   137                 }
       
   138             else
       
   139                 {
       
   140                 // assert that field is not included
       
   141                 STIF_LOG("resid: %d, included %d", type.FieldTypeResId(), included);
       
   142                 STIF_ASSERT(!included);
       
   143                 }
       
   144             }
       
   145         }
       
   146     
       
   147     TInt Find(const TInt type, const TInt aTypes[], const TInt aSize)
       
   148         {
       
   149         for (TInt i = 0; i < aSize; ++i)
       
   150             {
       
   151             if (type == aTypes[i])
       
   152                 {
       
   153                 return i;
       
   154                 }
       
   155             }
       
   156         return KErrNotFound;
       
   157         }
       
   158     
       
   159 private:
       
   160     CStifLogger* iLog;
       
   161     TTestResult* iResult;
       
   162     };
       
   163 
       
   164 
       
   165 #endif // __SELECTOR_CONSTANTS_H
       
   166 
       
   167 // End of file