uiservicetab/vimpststorage/tsrc/vimpststorage_ut/src/s_CVPbkBaseContactFieldCollection.cpp
branchRCL_3
changeset 29 9a48e301e94b
parent 0 5e5d6b214f4f
equal deleted inserted replaced
28:3104fc151679 29:9a48e301e94b
       
     1 /*
       
     2 * Copyright (c) 2004-2007 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 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDES
       
    23 #include "s_CVPbkBaseContactFieldCollection.h"
       
    24 #include "s_CVPbkStoreContactField.h"
       
    25 
       
    26 TInt gGiveFieldCount = 0;
       
    27 CVPbkStoreContactFieldStub gField0(0);
       
    28 CVPbkStoreContactFieldStub gField1(1);
       
    29 CVPbkStoreContactFieldStub gField2(2);
       
    30 CVPbkStoreContactFieldStub gJunkField(-1);
       
    31 
       
    32 
       
    33 CVPbkBaseContactFieldCollectionStub::CVPbkBaseContactFieldCollectionStub(){}
       
    34 
       
    35 /**
       
    36  * Destructor.
       
    37  */
       
    38 CVPbkBaseContactFieldCollectionStub::~CVPbkBaseContactFieldCollectionStub(){}
       
    39 
       
    40     
       
    41  const MVPbkStoreContactField& CVPbkBaseContactFieldCollectionStub::FieldAt(TInt /*aIndex*/) const 
       
    42  { 
       
    43  MVPbkStoreContactField* ret = NULL;
       
    44  return *ret;
       
    45  }
       
    46 
       
    47 
       
    48 /**
       
    49  * Returns a field in this collection.
       
    50  *
       
    51  * @param aIndex A zero-based index of the field to return.
       
    52  * @return A reference to the field at aIndex. Reference is valid until 
       
    53  *         FieldAt is called again. If you need a permanent copy,
       
    54  *         call MVPbkStoreContactField::CloneLC to the returned
       
    55  *         field.
       
    56  * @see MVPbkStoreContactField::CloneLC
       
    57  * @precond aIndex >= 0 && aIndex < FieldCount()
       
    58  *          VPbkError::Panic(VPbkError::EInvalidFieldIndex) is raised
       
    59  *          if the precondition does not hold.
       
    60  */
       
    61 MVPbkStoreContactField& CVPbkBaseContactFieldCollectionStub::FieldAt( TInt aIndex ) 
       
    62 	{ 
       
    63 	if (aIndex == 0)
       
    64 		{
       
    65 		return gField0;	
       
    66 		}
       
    67 
       
    68 	if (aIndex == 1)
       
    69 		{
       
    70 		return gField1;	
       
    71 		}
       
    72 
       
    73 	if (aIndex == 2)
       
    74 		{
       
    75 		return gField2;	
       
    76 		}
       
    77 
       
    78 	return gJunkField;
       
    79 	}
       
    80 
       
    81 /**
       
    82  * Returns a copy of the field in this collection.
       
    83  *
       
    84  * Client gets the ownership of the field.
       
    85  *
       
    86  * @param aIndex A zero-based index of the field to return.
       
    87  * @return  A new instance to the field at aIndex. The field is valid
       
    88  *          as long as the parent contact is valid
       
    89  * @precond aIndex >= 0 && aIndex < FieldCount()
       
    90  *          VPbkError::Panic(VPbkError::EInvalidFieldIndex) is raised
       
    91  *          if the precondition does not hold.
       
    92  */
       
    93 MVPbkStoreContactField* CVPbkBaseContactFieldCollectionStub::FieldAtLC( TInt /*aIndex*/ ) const { return NULL; }
       
    94 
       
    95 /**
       
    96  * Returns the parent contact of the field collection
       
    97  *
       
    98  * @return the parent contact of the field collection
       
    99  */
       
   100 MVPbkStoreContact& CVPbkBaseContactFieldCollectionStub::ParentStoreContact() const 
       
   101 { 
       
   102 MVPbkStoreContact* ret = NULL;
       
   103 return *ret;
       
   104 }
       
   105 
       
   106 /**
       
   107  * Returns a field in this collection identified by a contact field 
       
   108  * link.
       
   109  *
       
   110  * A contact field link can be created using the MVPbkStoreContactField
       
   111  * interface. The same link works then as a contact link and 
       
   112  * a field link.
       
   113  *
       
   114  * NOTE: implementations of stores are possibly using an index
       
   115  *       of the field as an identifier so clients should prefer not
       
   116  *       to save field links permanently. E.g modifying the contact
       
   117  *       can invalidate the link in some store implementations.
       
   118  *       A field link is practical in use cases where the link is
       
   119  *       created and immediately given to another component.
       
   120  *
       
   121  * @param aContactLink A valid contact field link.
       
   122  * @return A field in this collection identified by aContactLink or NULL
       
   123  *          if the link does not contain field information or if the 
       
   124  *          link does not refer to the parent contact of this field collection.
       
   125  */
       
   126 MVPbkStoreContactField* CVPbkBaseContactFieldCollectionStub::RetrieveField(
       
   127     const MVPbkContactLink& /*aContactLink*/ ) const { return NULL; }
       
   128 
       
   129 
       
   130 
       
   131 /**
       
   132  * Returns the parent contact of this field set.
       
   133  * @return The parent contact of this field set.
       
   134  */
       
   135 MVPbkBaseContact& CVPbkBaseContactFieldCollectionStub::ParentContact() const 
       
   136 { 
       
   137 MVPbkBaseContact* ret=NULL;
       
   138 return *ret;
       
   139 }
       
   140 
       
   141 /**
       
   142  * Returns the number of fields in this collection.
       
   143  * @return The number of fields in this collection.
       
   144  */
       
   145 TInt CVPbkBaseContactFieldCollectionStub::FieldCount() const { return gGiveFieldCount; }
       
   146 
       
   147 /**
       
   148  * Returns a read-only field in this collection.
       
   149  *
       
   150  * @param aIndex    Zero-based index of the field to return.
       
   151  * @return  Reference to a field at aIndex. Reference is 
       
   152  *          valid until FieldAt is called again.
       
   153  * @see MVPbkBaseContactFieldCollection::ConstFieldAt
       
   154  * @precond aIndex >= 0 && aIndex < FieldCount()
       
   155  *          Panic VPbkError::EInvalidFieldIndex is raised if the
       
   156  *          precondition does not hold.
       
   157  */
       
   158 //const MVPbkBaseContactField& CVPbkBaseContactFieldCollectionStub::FieldAt(
       
   159   //      TInt aIndex) const { }
       
   160 //End of file