uiservicetab/vimpstengine/tsrc/vimpstengine_ut/src/stubs/s_spentry.cpp
changeset 0 5e5d6b214f4f
equal deleted inserted replaced
-1:000000000000 0:5e5d6b214f4f
       
     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: s_spentry.cpp
       
    15 *
       
    16 */
       
    17 #include <spentry.h>
       
    18 #include <spproperty.h>
       
    19 
       
    20 
       
    21 CSPEntry* CSPEntry::NewL()
       
    22     {
       
    23     CSPEntry* self = CSPEntry::NewLC();
       
    24     CleanupStack::Pop(self);
       
    25     return self;
       
    26     }
       
    27 
       
    28 CSPEntry* CSPEntry::NewLC()
       
    29     {
       
    30     CSPEntry* self = new ( ELeave) CSPEntry;
       
    31     CleanupStack::PushL( self );
       
    32     self->ConstructL();    
       
    33     return self;
       
    34     }
       
    35 
       
    36 CSPEntry::~CSPEntry()
       
    37     {
       
    38     iServiceName.Close();
       
    39     iPropertyArray.ResetAndDestroy();
       
    40     iPropertyArray.Close();
       
    41     }
       
    42 
       
    43 TServiceId CSPEntry::GetServiceId() const
       
    44     {
       
    45     return iServiceId;
       
    46     }
       
    47 
       
    48 void CSPEntry::SetServiceId( TServiceId aServiceId ) 
       
    49     {
       
    50     iServiceId = aServiceId;
       
    51     }
       
    52 
       
    53 const TDesC16& CSPEntry::GetServiceName() const
       
    54     {
       
    55     return iServiceName;
       
    56     }
       
    57 
       
    58 TInt CSPEntry::SetServiceName( const TDesC16& aServiceName )
       
    59     {
       
    60     
       
    61     iServiceName.Copy(aServiceName);
       
    62     return KErrNone;
       
    63     }
       
    64 
       
    65 TInt CSPEntry::AddPropertyL( const CSPProperty& aProperty )
       
    66     {
       
    67     CSPProperty* property = CSPProperty::NewL();
       
    68     CleanupStack::PushL( property );
       
    69 
       
    70     property->CopyL( aProperty );
       
    71 
       
    72     TInt err = iPropertyArray.Append( property );
       
    73     if( err == KErrNoMemory )
       
    74         {
       
    75         User::Leave( KErrNoMemory );
       
    76         }
       
    77     
       
    78     CleanupStack::Pop( property );
       
    79 
       
    80     return KErrNone;
       
    81     }
       
    82 
       
    83 
       
    84 TInt CSPEntry::UpdateProperty( TServicePropertyName /*aPropertyName*/, TInt /*aValue*/ )
       
    85     {
       
    86     return KErrNone;
       
    87     }
       
    88 
       
    89 
       
    90 TInt CSPEntry::UpdateProperty( TServicePropertyName /*aPropertyName*/, const TDesC& /*aValue*/ )
       
    91     {
       
    92     return KErrNone;
       
    93     }
       
    94 
       
    95 TInt CSPEntry::UpdateProperty( TServicePropertyName /*aPropertyName*/, TOnOff /*aValue*/ )
       
    96     {
       
    97     return KErrNone;
       
    98     }
       
    99 
       
   100 TInt CSPEntry::GetProperty( const CSPProperty*& aProperty, 
       
   101     					    TServicePropertyName aPropertyName ) const
       
   102     {
       
   103     TInt count = iPropertyArray.Count();
       
   104     for( TInt i=0; i<count; i++ )
       
   105         {        
       
   106         if( iPropertyArray[ i ]->GetName() == aPropertyName )
       
   107             {
       
   108             aProperty = iPropertyArray[ i ];
       
   109             return KErrNone;
       
   110             }
       
   111         }
       
   112 
       
   113     return KErrNotFound;
       
   114     }
       
   115 
       
   116 TInt CSPEntry::GetProperty( const CSPProperty*& /*aProperty*/, 
       
   117     								TInt /*aIndex*/ ) const
       
   118     {
       
   119     return KErrNone;
       
   120     }
       
   121 
       
   122 TInt CSPEntry::DeleteProperty( TInt /*aIndex*/ )
       
   123     {
       
   124     return KErrNone;
       
   125     }
       
   126 
       
   127 TInt CSPEntry::DeleteProperty( TServicePropertyName /*aProperty*/ )
       
   128     {
       
   129     return KErrNone;
       
   130     }
       
   131 
       
   132 const RPropertyArray& CSPEntry::GetAllProperties() const
       
   133     {
       
   134     return iPropertyArray;
       
   135     }
       
   136 
       
   137 TInt CSPEntry::PropertyCount() const
       
   138     {
       
   139     return KErrNone;
       
   140     }
       
   141 
       
   142 CSPEntry::CSPEntry()
       
   143     {
       
   144     }
       
   145 
       
   146 void CSPEntry::ConstructL()
       
   147     {
       
   148     iServiceName.CreateL(500);
       
   149     }
       
   150 
       
   151 TInt CSPEntry::SearchProperty( TServicePropertyName /*aProperty*/ ) const
       
   152     {
       
   153     return KErrNone;
       
   154     }
       
   155 
       
   156