instantmessagesalert/tsrc/testinstantmsgalert/src/stubs/s_presencebuddyinfo2.cpp
branchRCL_3
changeset 23 9a48e301e94b
parent 0 5e5d6b214f4f
equal deleted inserted replaced
22:3104fc151679 23:9a48e301e94b
       
     1 /*
       
     2 * s_presencebuddyinfo2.cpp : 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: s_presencebuddyinfo2.cpp
       
    15 *
       
    16 */
       
    17 #include "s_presencebuddyinfo2.h"
       
    18 #include <avabilitytext.h>
       
    19 
       
    20 #define KAvailability  _L("online");
       
    21 #define KMsg  _L("hello");
       
    22 #define KBuddyId  _L("gizmo:Sharath");
       
    23 #define KAvatar _L8("gshhshshhshshhsjskssiisisisisiisks");
       
    24 
       
    25 //------------------------------------------------------------
       
    26 // MPresenceBuddyInfo2Stub::NewStubL
       
    27 //------------------------------------------------------------
       
    28  MPresenceBuddyInfo2Stub* MPresenceBuddyInfo2Stub:: NewStubL()
       
    29     {
       
    30     return new(ELeave) MPresenceBuddyInfo2Stub;
       
    31     }
       
    32 
       
    33 //------------------------------------------------------------
       
    34 // MPresenceBuddyInfo2Stub::BuddyId
       
    35 //------------------------------------------------------------
       
    36 TPtrC MPresenceBuddyInfo2Stub::BuddyId( ) const 
       
    37     {
       
    38     return KBuddyId;
       
    39     }
       
    40 //------------------------------------------------------------
       
    41 // MPresenceBuddyInfo2Stub::Availability
       
    42 //------------------------------------------------------------
       
    43 MPresenceBuddyInfo2::TAvailabilityValues  MPresenceBuddyInfo2Stub::Availability( ) 
       
    44     {
       
    45     return EUnknownAvailability;
       
    46     }
       
    47 //------------------------------------------------------------
       
    48 // MPresenceBuddyInfo2Stub::AvailabilityText
       
    49 //------------------------------------------------------------
       
    50 TPtrC MPresenceBuddyInfo2Stub::AvailabilityText( )
       
    51     {
       
    52     return KAvailability;
       
    53     }
       
    54 //------------------------------------------------------------
       
    55 // MPresenceBuddyInfo2Stub::Avatar
       
    56 //------------------------------------------------------------
       
    57 TPtrC8 MPresenceBuddyInfo2Stub::Avatar( ) 
       
    58     {
       
    59     return KAvatar;
       
    60     }
       
    61 //------------------------------------------------------------
       
    62 // MPresenceBuddyInfo2Stub::NewStubL
       
    63 //------------------------------------------------------------
       
    64 TPtrC MPresenceBuddyInfo2Stub::StatusMessage( ) 
       
    65     {
       
    66     return KMsg;
       
    67     }
       
    68 //------------------------------------------------------------
       
    69 // MPresenceBuddyInfo2Stub::SetIdentityL
       
    70 //------------------------------------------------------------
       
    71 void MPresenceBuddyInfo2Stub::SetIdentityL( const TDesC& /*aBuddyId*/ )
       
    72     {
       
    73 
       
    74     }
       
    75 //------------------------------------------------------------
       
    76 // MPresenceBuddyInfo2Stub::SetAvailabilityL
       
    77 //------------------------------------------------------------
       
    78 void MPresenceBuddyInfo2Stub::SetAvailabilityL( 
       
    79         MPresenceBuddyInfo2::TAvailabilityValues /*aAvailability*/,
       
    80         const TDesC& /*aAvailabilityText*/ ) 
       
    81     {
       
    82 
       
    83     }
       
    84 
       
    85 
       
    86 //------------------------------------------------------------
       
    87 // MPresenceBuddyInfo2Stub::SetAvatarL
       
    88 //------------------------------------------------------------
       
    89 void MPresenceBuddyInfo2Stub::SetAvatarL( const TDesC8& /*aAvatar*/ ) 
       
    90     {
       
    91 
       
    92     }
       
    93 
       
    94 //------------------------------------------------------------
       
    95 // MPresenceBuddyInfo2Stub::NewStubL
       
    96 //------------------------------------------------------------
       
    97 void MPresenceBuddyInfo2Stub::SetStatusMessageL( 
       
    98         const TDesC& /*aStatusMessage*/ ) 
       
    99     {
       
   100 
       
   101     }
       
   102 
       
   103 //------------------------------------------------------------
       
   104 // MPresenceBuddyInfo2Stub::SetAnyFieldL
       
   105 //------------------------------------------------------------
       
   106 void MPresenceBuddyInfo2Stub::SetAnyFieldL( 
       
   107         const TDesC16& aKey,
       
   108         const TDesC8& aValue ) 
       
   109     {
       
   110     HBufC8* valueBuffer = aValue.AllocLC();  
       
   111     HBufC* keyBuffer = aKey.AllocLC();  
       
   112        
       
   113    TInt insertPos = iIds.Find(0);
       
   114    if ( insertPos < 0 )
       
   115        {
       
   116        insertPos = iIds.Count();
       
   117        iIds.Append( keyBuffer );
       
   118        iValues.Append( valueBuffer );
       
   119        }
       
   120    else
       
   121       {
       
   122       iIds[insertPos] = keyBuffer;
       
   123       iValues[insertPos] = valueBuffer;
       
   124       }
       
   125     CleanupStack::Pop( keyBuffer );
       
   126     CleanupStack::Pop( valueBuffer );  
       
   127     }
       
   128 //------------------------------------------------------------
       
   129 // MPresenceBuddyInfo2Stub::NewStubL
       
   130 //------------------------------------------------------------
       
   131 TPtrC8 MPresenceBuddyInfo2Stub::GetAnyField( 
       
   132         const TDesC16& aKey )
       
   133     {
       
   134     HBufC* key = aKey.AllocLC();
       
   135     HBufC8* val = NULL; 
       
   136     TInt count = iIds.Count();
       
   137     for(TInt  i = 0; i < count; i++)
       
   138         {
       
   139          if(iIds[i]->Des().Compare(KExtensionKey) == 0)  
       
   140             {       
       
   141             val = iValues[i];  
       
   142             break;
       
   143             } 
       
   144         }
       
   145     CleanupStack::PopAndDestroy(key);
       
   146     // since there is no destructor for this test class, the member variable are destroyed here.
       
   147     // as they are not needed any further, if these member variables are required further then appropriate destructor 
       
   148     // should be added.
       
   149     // iIds.ResetAndDestroy();
       
   150     // iIds.Close();
       
   151     // iValues.ResetAndDestroy();
       
   152     // iValues.Close();
       
   153     return val ? val->Des() : TPtrC8();  
       
   154     
       
   155     }
       
   156 //------------------------------------------------------------
       
   157 // MPresenceBuddyInfo2Stub::NewStubL
       
   158 //------------------------------------------------------------
       
   159 void MPresenceBuddyInfo2Stub::GetFieldKeysL( 
       
   160         CDesCArrayFlat& aKeys ) 
       
   161     {
       
   162     aKeys.Reset();
       
   163     aKeys.AppendL(KExtensionKey );
       
   164      
       
   165     }
       
   166 //------------------------------------------------------------
       
   167 // MPresenceBuddyInfo2Stub::NewStubL
       
   168 //------------------------------------------------------------
       
   169 void MPresenceBuddyInfo2Stub::RemoveField(const TDesC& /*aKey*/ ) 
       
   170     {
       
   171 
       
   172     }
       
   173 //------------------------------------------------------------
       
   174 // MPresenceBuddyInfo2Stub::NewStubL
       
   175 //------------------------------------------------------------
       
   176 TBool MPresenceBuddyInfo2Stub::EqualsIdentity(
       
   177         const MPresenceBuddyInfo2& /*aOtherInstance*/ ) const 
       
   178         {
       
   179         return ETrue;
       
   180         }
       
   181 //------------------------------------------------------------
       
   182 // MPresenceBuddyInfo2Stub::NewStubL
       
   183 //------------------------------------------------------------
       
   184 void MPresenceBuddyInfo2Stub::ExternalizeL( RWriteStream& /*aStream*/ ) const 
       
   185 {
       
   186 
       
   187 }
       
   188 //------------------------------------------------------------
       
   189 // MPresenceBuddyInfo2Stub::NewStubL
       
   190 //------------------------------------------------------------
       
   191 void MPresenceBuddyInfo2Stub::InternalizeL( RReadStream& /*aStream*/ ) 
       
   192     {
       
   193 
       
   194     }
       
   195 
       
   196 
       
   197 
       
   198