imservices/searchfeatureplugin/srcsearchdatamodel/search/searchkeyinfoimp.cpp
changeset 51 61fad867f68e
equal deleted inserted replaced
-1:000000000000 51:61fad867f68e
       
     1 /*
       
     2 * Copyright (c) 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:  Msearchkeyinfo API object implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "searchkeyinfoimp.h"
       
    19 #include "ximprbufhelpers.h"
       
    20 #include "ximpobjecthelpers.h"
       
    21 
       
    22 // ============================ MEMBER FUNCTIONS =============================
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // CSupportedSearchKeyImp::NewLC()
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 EXPORT_C CSearchKeyInfoImp* CSearchKeyInfoImp::NewLC()
       
    29     {
       
    30     CSearchKeyInfoImp* self = new( ELeave ) CSearchKeyInfoImp;
       
    31     CleanupStack::PushL( self );
       
    32     self->ConstructL();
       
    33     return self;
       
    34     }
       
    35 
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // CSearchKeyInfoImp::NewL()
       
    39 // ---------------------------------------------------------------------------
       
    40 //
       
    41 EXPORT_C CSearchKeyInfoImp* CSearchKeyInfoImp::NewL()
       
    42     {
       
    43     CSearchKeyInfoImp* self = NewLC();
       
    44     CleanupStack::Pop( self );
       
    45     return self;
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // CSearchKeyInfoImp::NewFromStreamLC()
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CSearchKeyInfoImp )
       
    53 
       
    54 // ---------------------------------------------------------------------------
       
    55 // Implement supported interface access.
       
    56 // ---------------------------------------------------------------------------
       
    57 //
       
    58 XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CSearchKeyInfoImp, MSearchKeyInfo )
       
    59 XIMPIMP_IF_BASE_GET_INTERFACE_END()
       
    60 XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CSearchKeyInfoImp, MSearchKeyInfo )
       
    61 XIMPIMP_IF_BASE_GET_INTERFACE_END()
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 // CSearchKeyInfoImp::~CSearchKeyInfoImp()
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 CSearchKeyInfoImp::~CSearchKeyInfoImp()
       
    68     {
       
    69     iLabel.Close();
       
    70     }
       
    71 
       
    72 // ---------------------------------------------------------------------------
       
    73 // CSearchKeyInfoImp::CSearchKeyInfoImp()
       
    74 // ---------------------------------------------------------------------------
       
    75 //
       
    76 CSearchKeyInfoImp::CSearchKeyInfoImp()
       
    77     {
       
    78     }
       
    79 
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // CSearchKeyInfoImp::ConstructL()
       
    83 // ---------------------------------------------------------------------------
       
    84 //
       
    85 void CSearchKeyInfoImp::ConstructL()
       
    86     {
       
    87     iLabel.CreateL( 0 );
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------------------------
       
    91 // CSearchKeyInfoImp::ExternalizeL()
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 void CSearchKeyInfoImp::ExternalizeL( RWriteStream& aStream ) const
       
    95     {
       
    96     aStream.WriteInt32L( iKeyType );
       
    97     aStream.WriteInt32L( iKey );
       
    98     XIMPRBuf16Helper::ExternalizeL( iLabel, aStream );
       
    99     }
       
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // CSearchKeyInfoImp::InternalizeL()
       
   103 // ---------------------------------------------------------------------------
       
   104 //
       
   105 EXPORT_C void CSearchKeyInfoImp::InternalizeL( RReadStream& aStream )
       
   106     {
       
   107     iKeyType = aStream.ReadInt32L(); 
       
   108     iKey = aStream.ReadInt32L(); 
       
   109     XIMPRBuf16Helper::InternalizeL( iLabel, aStream );
       
   110     }
       
   111   
       
   112 
       
   113 
       
   114 // ---------------------------------------------------------------------------
       
   115 // 
       
   116 // CSearchKeyInfoImp::Key()
       
   117 // ---------------------------------------------------------------------------
       
   118 //
       
   119 TSearchKey CSearchKeyInfoImp::Key() const
       
   120     {
       
   121     return (TSearchKey)iKey;
       
   122     }
       
   123     
       
   124 
       
   125 
       
   126 // ---------------------------------------------------------------------------
       
   127 // CSearchKeyInfoImp::SetKey
       
   128 // ---------------------------------------------------------------------------
       
   129 //
       
   130 void CSearchKeyInfoImp::SetKey(TSearchKey aKey) 
       
   131     
       
   132     {
       
   133     iKey = aKey;
       
   134     }
       
   135 // ---------------------------------------------------------------------------
       
   136 // 
       
   137 // CSearchKeyInfoImp::Key()
       
   138 // ---------------------------------------------------------------------------
       
   139 //
       
   140 TKeyType CSearchKeyInfoImp::Type() const
       
   141     {
       
   142     return (TKeyType)iKeyType;
       
   143     }
       
   144     
       
   145 
       
   146 
       
   147 // ---------------------------------------------------------------------------
       
   148 // CSearchKeyInfoImp::SetKey
       
   149 // ---------------------------------------------------------------------------
       
   150 //
       
   151 void CSearchKeyInfoImp::SetType(TKeyType  aType) 
       
   152     
       
   153     {
       
   154     iKeyType = aType;
       
   155     }
       
   156 
       
   157 // ---------------------------------------------------------------------------
       
   158 // CSearchKeyInfoImp::Label()
       
   159 // ---------------------------------------------------------------------------
       
   160 //
       
   161 const TDesC16& CSearchKeyInfoImp::Label() const
       
   162     {
       
   163     return iLabel;
       
   164     }
       
   165  
       
   166 // ---------------------------------------------------------------------------.
       
   167 // CSearchKeyInfoImp::SetLabelL()
       
   168 // ---------------------------------------------------------------------------
       
   169 //
       
   170 void CSearchKeyInfoImp::SetLabelL(const TDesC16& aLabel) 
       
   171     
       
   172     {
       
   173     iLabel.Close();
       
   174     iLabel.Assign(  aLabel.AllocL() );
       
   175     }
       
   176 // ---------------------------------------------------------------------------
       
   177 // CSearchKeyInfoImp::EqualsContent()
       
   178 // ---------------------------------------------------------------------------
       
   179 //
       
   180 TBool CSearchKeyInfoImp::EqualsContent( 
       
   181     const CXIMPApiDataObjBase& /*aOtherInstance*/ ) const
       
   182     {
       
   183     return ETrue; 
       
   184     }
       
   185 // ---------------------------------------------------------------------------
       
   186 // CSearchKeyInfoImp::LinearOrder
       
   187 // ---------------------------------------------------------------------------
       
   188 //
       
   189 EXPORT_C TInt CSearchKeyInfoImp::LinearOrder(
       
   190         const CSearchKeyInfoImp& /*aA*/,
       
   191        const CSearchKeyInfoImp& /*aB*/ )
       
   192     {
       
   193     // Just returns 1 so that the Keys are appended as they come from server.
       
   194     return 1;
       
   195     }
       
   196     
       
   197 
       
   198 // End of file