XDMEngine/src/XdmProtocolInfo.cpp
changeset 0 c8caa15ef882
equal deleted inserted replaced
-1:000000000000 0:c8caa15ef882
       
     1 /*
       
     2 * Copyright (c) 2005 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:   XDM Engine protocol info
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "XdmProtocol.h"
       
    21 #include "XdmDocument.h"
       
    22 #include "XdmSettingsApi.h"
       
    23 #include "XdmProtocolInfo.h"
       
    24 #include "XdmProtocolUidList.h"
       
    25 #include "XdmSettingsProperty.h"
       
    26 #include "XdmSettingsCollection.h"
       
    27 
       
    28 // ----------------------------------------------------------
       
    29 // CXdmProtocolInfo::CXdmProtocolInfo
       
    30 // 
       
    31 // ----------------------------------------------------------
       
    32 //
       
    33 CXdmProtocolInfo::CXdmProtocolInfo() : iSecure( EFalse ),
       
    34                                        iUseCache( ETrue )
       
    35     {   
       
    36     }
       
    37 
       
    38 // ----------------------------------------------------------
       
    39 // CXdmProtocolInfo::CXdmProtocolInfo
       
    40 // 
       
    41 // ----------------------------------------------------------
       
    42 //
       
    43 CXdmProtocolInfo::CXdmProtocolInfo( TInt aProtocolUid ) :
       
    44                                     iProtocolUid( TUid::Uid( aProtocolUid ) ),
       
    45                                     iSecure( EFalse ),
       
    46                                     iUseCache( ETrue )
       
    47     {   
       
    48     }
       
    49        
       
    50 // ----------------------------------------------------------
       
    51 // CXdmProtocolInfo::CXdmProtocolInfo
       
    52 // 
       
    53 // ----------------------------------------------------------
       
    54 //
       
    55 CXdmProtocolInfo::CXdmProtocolInfo( TInt aAccessPoint,
       
    56                                     TInt aProtocolUid ) :
       
    57                                     iProtocolUid( TUid::Uid( aProtocolUid ) ),
       
    58                                     iAccessPoint( aAccessPoint ),
       
    59                                     iSecure( EFalse ),
       
    60                                     iUseCache( ETrue )
       
    61     {   
       
    62     }
       
    63 
       
    64 // ----------------------------------------------------------
       
    65 // CXdmProtocolInfo::NewL
       
    66 // 
       
    67 // ----------------------------------------------------------
       
    68 //
       
    69 EXPORT_C CXdmProtocolInfo* CXdmProtocolInfo::NewL( TInt aAccessPoint,
       
    70                                                    TInt aProtocolUid,
       
    71                                                    const TDesC& aRootLocation )
       
    72     {
       
    73     CXdmProtocolInfo* self = new ( ELeave ) CXdmProtocolInfo( aAccessPoint, aProtocolUid );
       
    74     CleanupStack::PushL( self );
       
    75     self->ConstructL( aRootLocation );
       
    76     CleanupStack::Pop();
       
    77     return self;
       
    78     }
       
    79 
       
    80 // ----------------------------------------------------------
       
    81 // CXdmProtocolInfo::NewL
       
    82 // 
       
    83 // ----------------------------------------------------------
       
    84 //
       
    85 EXPORT_C CXdmProtocolInfo* CXdmProtocolInfo::NewL( TInt aSettingsId )
       
    86     {
       
    87     CXdmProtocolInfo* self = new ( ELeave ) CXdmProtocolInfo( KXcapProtocol );
       
    88     self->Construct( aSettingsId );
       
    89     return self;
       
    90     }
       
    91 
       
    92 // ----------------------------------------------------------
       
    93 // CXdmProtocolInfo::ConstructL
       
    94 // 
       
    95 // ----------------------------------------------------------
       
    96 //
       
    97 void CXdmProtocolInfo::ConstructL( const TDesC& aRootLocation )
       
    98     {
       
    99     delete iRootLocation;
       
   100     iRootLocation = NULL;
       
   101     iRootLocation = HBufC::NewL( aRootLocation.Length() );
       
   102     iRootLocation->Des().Copy( aRootLocation );
       
   103     }
       
   104 
       
   105 // ----------------------------------------------------------
       
   106 // CXdmProtocolInfo::Construct
       
   107 // 
       
   108 // ----------------------------------------------------------
       
   109 //
       
   110 void CXdmProtocolInfo::Construct( TInt aSettingsId )
       
   111     {
       
   112     iSettingsId = aSettingsId;
       
   113     }
       
   114         
       
   115 // ----------------------------------------------------------
       
   116 // CXdmProtocolInfo::~CXdmProtocolInfo
       
   117 // 
       
   118 // ----------------------------------------------------------
       
   119 //
       
   120 EXPORT_C CXdmProtocolInfo::~CXdmProtocolInfo()
       
   121     {
       
   122     delete iRootLocation;
       
   123     }
       
   124 
       
   125 // ----------------------------------------------------------
       
   126 // CXdmProtocolInfo::SetCredentials
       
   127 // 
       
   128 // ----------------------------------------------------------
       
   129 //
       
   130 EXPORT_C void CXdmProtocolInfo::SetCredentials( const TXdmCredentials aCredentials )
       
   131     {
       
   132     iCredentials = aCredentials;
       
   133     }
       
   134 
       
   135 // ----------------------------------------------------------
       
   136 // CXdmProtocolInfo::SetCacheUsage
       
   137 // 
       
   138 // ----------------------------------------------------------
       
   139 //
       
   140 EXPORT_C void CXdmProtocolInfo::SetCacheUsage( const TBool aCacheUsage )
       
   141     {
       
   142     iUseCache = aCacheUsage;
       
   143     }
       
   144 
       
   145 // ----------------------------------------------------------
       
   146 // CXdmProtocolInfo::CacheUsage
       
   147 // 
       
   148 // ----------------------------------------------------------
       
   149 //
       
   150 EXPORT_C TBool CXdmProtocolInfo::IsCacheEnabled() const
       
   151     {
       
   152     return iUseCache;
       
   153     }
       
   154 
       
   155 // ----------------------------------------------------------
       
   156 // CXdmProtocolInfo::Credentials
       
   157 // 
       
   158 // ----------------------------------------------------------
       
   159 //
       
   160 EXPORT_C const TXdmCredentials& CXdmProtocolInfo::Credentials() const
       
   161     {
       
   162     return iCredentials;
       
   163     }
       
   164 
       
   165 // ----------------------------------------------------------
       
   166 // CXdmProtocolInfo::SetCredentials
       
   167 // 
       
   168 // ----------------------------------------------------------
       
   169 //
       
   170 EXPORT_C void CXdmProtocolInfo::SetSecurity( const TBool aSecure )
       
   171     {
       
   172     iSecure = aSecure;
       
   173     }
       
   174 
       
   175 // ----------------------------------------------------------
       
   176 // CXdmProtocolInfo::SetCredentials
       
   177 // 
       
   178 // ----------------------------------------------------------
       
   179 //
       
   180 EXPORT_C TBool CXdmProtocolInfo::IsSecure() const
       
   181     {
       
   182     return iSecure;
       
   183     }
       
   184 
       
   185 // ----------------------------------------------------------
       
   186 // CXdmProtocolInfo::Root
       
   187 // 
       
   188 // ----------------------------------------------------------
       
   189 //
       
   190 EXPORT_C TUid CXdmProtocolInfo::ProtocolUid() const
       
   191     {
       
   192     return iProtocolUid;
       
   193     }
       
   194 
       
   195 // ----------------------------------------------------------
       
   196 // CXdmProtocolInfo::AccessPoint
       
   197 // 
       
   198 // ----------------------------------------------------------
       
   199 //
       
   200 EXPORT_C TInt CXdmProtocolInfo::AccessPoint() const
       
   201     {
       
   202     return iAccessPoint;
       
   203     }
       
   204 
       
   205 // ----------------------------------------------------------
       
   206 // CXdmProtocolInfo::AccessPoint
       
   207 // 
       
   208 // ----------------------------------------------------------
       
   209 //
       
   210 EXPORT_C TInt CXdmProtocolInfo::SettingsID() const
       
   211     {
       
   212     return iSettingsId;
       
   213     }
       
   214     
       
   215 // ----------------------------------------------------------
       
   216 // CXdmProtocolInfo::Root
       
   217 // 
       
   218 // ----------------------------------------------------------
       
   219 //
       
   220 EXPORT_C TPtrC CXdmProtocolInfo::Root() const
       
   221     {
       
   222     return iRootLocation != NULL ? iRootLocation->Des() : TPtrC();
       
   223     }
       
   224 
       
   225               
       
   226 // End of File
       
   227 
       
   228