applayerpluginsandutils/uripermissionservices/client/src/ineturi.cpp
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <ineturilist.h>
       
    17 #include <ineturi.h>
       
    18 #include "ineturiimpl.h"
       
    19 #include "ineturiproperties.h"
       
    20 
       
    21 /**
       
    22 A default RInetUri constructor.
       
    23 
       
    24 */
       
    25 EXPORT_C RInetUri::RInetUri ()
       
    26 : iInetUriImpl ( NULL )
       
    27 	{
       
    28 		
       
    29 	}
       
    30 
       
    31 /**
       
    32 Creates and opens a new URI object handle, given a URI and its associated service type and list type. The URI will 
       
    33 be syntax normalised before creation. All the URIs will be created with read-write permission. The permission cannot
       
    34 be changed. The service type cannot be modified later.
       
    35 
       
    36 @param aUri URI descriptor object
       
    37 @param aServiceType The service type associated with the URI. For possible values, see InetUriList::TServiceType
       
    38 @param aListType The list type associated with the URI
       
    39 
       
    40 */
       
    41 EXPORT_C void RInetUri::CreateL ( const TDesC8& aUri, TServiceType aServiceType, TListType aListType )
       
    42 	{
       
    43 	if ( iInetUriImpl )	
       
    44 		User::LeaveIfError ( KErrUriAlreadyExists );
       
    45 	
       
    46 	iInetUriImpl = CInetUriImpl::NewL ( aUri, aServiceType, aListType );
       
    47 	}
       
    48 
       
    49 /**
       
    50 Closes the RInetUri handle.
       
    51 */
       
    52 EXPORT_C void RInetUri::Close ()
       
    53 	{
       
    54 	delete iInetUriImpl;	
       
    55 	iInetUriImpl = NULL;
       
    56 	}
       
    57 
       
    58 /**
       
    59 Returns the service type associated with the URI. 
       
    60 
       
    61 @publishedPartner
       
    62 @released
       
    63 
       
    64 @return service type
       
    65 */
       
    66 EXPORT_C TServiceType RInetUri::ServiceType () const
       
    67 	{
       
    68 	// The handle must be open and attached to a concrete inernet uri object
       
    69 	__ASSERT_ALWAYS( iInetUriImpl, User::Panic( KInetUriListErrHandleNotOpen, KErrNotOpen ) );
       
    70 
       
    71 	return iInetUriImpl->Properties().ServiceType();		
       
    72 	}
       
    73 
       
    74 /**
       
    75 Returns the list type associated with the URI.
       
    76 
       
    77 @publishedPartner
       
    78 @released
       
    79 
       
    80 @return list type of the URI
       
    81 */
       
    82 EXPORT_C TListType RInetUri::ListType () const
       
    83 	{
       
    84 	// The handle must be open and attached to a concrete inernet uri object
       
    85 	__ASSERT_ALWAYS( iInetUriImpl, User::Panic( KInetUriListErrHandleNotOpen, KErrNotOpen ) );
       
    86 
       
    87 	return iInetUriImpl->Properties().ListType ();	
       
    88 	}
       
    89 
       
    90 /**
       
    91 Returns the permission associated with the URI, that is, read-only or read-write.
       
    92 
       
    93 @publishedPartner
       
    94 @released
       
    95 
       
    96 @return list type
       
    97 */
       
    98 EXPORT_C TPermission RInetUri::Permission () const
       
    99 	{
       
   100 	// The handle must be open and attached to a concrete inernet uri object
       
   101 	__ASSERT_ALWAYS( iInetUriImpl, User::Panic( KInetUriListErrHandleNotOpen, KErrNotOpen ) );
       
   102 
       
   103 	return iInetUriImpl->Properties ().Permission ();	
       
   104 	}
       
   105 
       
   106 /**
       
   107 Returns the favourite name of the URI. Returns KNullDesC8 if no favourite name is set.
       
   108 
       
   109 @publishedPartner
       
   110 @released
       
   111 
       
   112 @return Favourite name of URI
       
   113 */
       
   114 EXPORT_C const TDesC8& RInetUri::FavouriteName () const
       
   115 	{
       
   116 	// The handle must be open and attached to a concrete inernet URI object
       
   117 	__ASSERT_ALWAYS( iInetUriImpl, User::Panic( KInetUriListErrHandleNotOpen, KErrNotOpen ) );
       
   118 
       
   119 	return iInetUriImpl->Properties ().FavouriteName ();
       
   120 	}
       
   121 
       
   122 /**
       
   123 Returns the CUri8 type object.
       
   124 
       
   125 @publishedPartner
       
   126 @released
       
   127 
       
   128 @return Reference to URI
       
   129 */
       
   130 EXPORT_C const CUri8& RInetUri::Uri () const
       
   131 	{
       
   132 	// The handle must be open and attached to a concrete inernet URI object
       
   133 	__ASSERT_ALWAYS( iInetUriImpl, User::Panic( KInetUriListErrHandleNotOpen, KErrNotOpen ) );
       
   134 
       
   135 	return iInetUriImpl->Uri ();
       
   136 	}
       
   137 
       
   138 /**
       
   139 Set the new list type for the URI.
       
   140 
       
   141 @param aListType New list type to be associated with the URI
       
   142 
       
   143 @publishedPartner
       
   144 @released
       
   145 */
       
   146 EXPORT_C void RInetUri::SetListType ( TListType aListType )
       
   147 	{
       
   148 	// The handle must be open and attached to a concrete inernet URI object
       
   149 	__ASSERT_ALWAYS( iInetUriImpl, User::Panic( KInetUriListErrHandleNotOpen, KErrNotOpen ) );
       
   150 
       
   151 	iInetUriImpl->Properties ().SetListType ( aListType );	
       
   152 	}
       
   153 	
       
   154 /**
       
   155 Set the favourite name associated with the URI.
       
   156 
       
   157 @param aFavouriteName Favourite name of the URI
       
   158 
       
   159 @publishedPartner
       
   160 @released
       
   161 */
       
   162 EXPORT_C void RInetUri::SetFavouriteNameL ( const TDesC8& aFavouriteName )
       
   163 	{
       
   164 	// The handle must be open and attached to a concrete inernet URI object
       
   165 	__ASSERT_ALWAYS( iInetUriImpl, User::Panic( KInetUriListErrHandleNotOpen, KErrNotOpen ) );
       
   166 
       
   167 	iInetUriImpl->Properties ().SetFavouriteNameL ( aFavouriteName );
       
   168 	}
       
   169 	
       
   170 /**
       
   171 Not intended for external use.
       
   172 
       
   173 @internalComponent
       
   174 */
       
   175 CInetUriImpl& RInetUri::Impl () const
       
   176 	{
       
   177 	return *iInetUriImpl;
       
   178 	}
       
   179 
       
   180 /**
       
   181 Not intended for external use.
       
   182 
       
   183 @internalComponent
       
   184 */
       
   185 void RInetUri::Attach ( CInetUriImpl& aInetUri )
       
   186 	{
       
   187 	// The handle must not be opened
       
   188 	__ASSERT_ALWAYS( !iInetUriImpl, User::Panic( KInetUriListErrHandleNotOpen, KErrNotOpen ) );
       
   189 	iInetUriImpl = &aInetUri;	
       
   190 	}