serviceproviders/sapi_serviceregistry/inc/serviceregistryutilities.inl
changeset 5 989d2f495d90
equal deleted inserted replaced
1:a36b1e19a461 5:989d2f495d90
       
     1 /*
       
     2 * Copyright (c) 2008 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 the License "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:  Common utilities for ServiceRegistry Service API
       
    15 *                THIS FILE IS GENERATED - DO NOT MODIFY!!!
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef SERVICEREGISTRYUTILITIES_INL
       
    21 #define SERVICEREGISTRYUTILITIES_INL
       
    22 
       
    23 #include "serviceerrno.h"
       
    24 
       
    25 // ======== THIS FILE IS GENERATED - DO NOT MODIFY!!! ========================
       
    26 
       
    27 // ---------------------------------------------------------------------------
       
    28 // TServiceRegistryUtilities::TServiceRegistryUtilities
       
    29 // Constructor.
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 inline TServiceRegistryUtilities::TServiceRegistryUtilities()
       
    33     {
       
    34     }
       
    35     
       
    36 // -----------------------------------------------------------------------------
       
    37 // TServiceRegistryUtilities::GetSapiErrorCode
       
    38 // Returns the Sapi Error Code.
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 inline SapiErrors TServiceRegistryUtilities::GetSapiErrorCode( TInt aError )
       
    42     {
       
    43     SapiErrors err;
       
    44     switch( aError )
       
    45         {
       
    46             case KErrCancel:
       
    47                             err = SErrCancelSuccess;
       
    48                             break;
       
    49                             
       
    50             case KErrNone:
       
    51                             err= SErrNone;
       
    52                             break;
       
    53 
       
    54             case KErrNotFound:
       
    55                             err= SErrNotFound;
       
    56                             break;
       
    57 
       
    58             case KErrNoMemory:
       
    59                             err = SErrNoMemory;
       
    60                             break;
       
    61 
       
    62             case KErrInUse:
       
    63                             err = SErrServiceInUse;
       
    64                             break;
       
    65 
       
    66             case KErrNotSupported:
       
    67                             err = SErrServiceNotSupported;
       
    68                             break;
       
    69 
       
    70             case KErrBadName:
       
    71                             err = SErrBadArgumentType;
       
    72                             break;
       
    73 
       
    74             case KErrArgument: 
       
    75                             err = SErrInvalidServiceArgument;
       
    76                             break;
       
    77 
       
    78             case KErrNotReady: 
       
    79                             err = SErrServiceNotReady;
       
    80                             break;
       
    81 
       
    82             case KErrHardwareNotAvailable: 
       
    83                             err = SErrHardwareNotAvailable;
       
    84                             break;
       
    85 
       
    86 			// These fallbacks make it possible to return service errors inside provider.
       
    87             case SErrInvalidServiceArgument:
       
    88             case SErrUnknownArgumentName:
       
    89             case SErrBadArgumentType:
       
    90             case SErrMissingArgument:
       
    91             case SErrServiceNotSupported:
       
    92             case SErrServiceInUse:
       
    93             case SErrServiceNotReady:
       
    94             case SErrNoMemory:
       
    95             case SErrHardwareNotAvailable:
       
    96             case SErrServerBusy:
       
    97             case SErrEntryExists:
       
    98             case SErrAccessDenied:
       
    99             case SErrNotFound:
       
   100             case SErrUnknownFormat:
       
   101             case SErrGeneralError:
       
   102             case SErrCancelSuccess:
       
   103             case SErrServiceTimedOut:
       
   104                             err = (SapiErrors)aError;
       
   105                             break;
       
   106         
       
   107             default         :
       
   108                             err = SErrGeneralError;
       
   109                             break;
       
   110         }
       
   111 
       
   112         return err;    
       
   113     }
       
   114 
       
   115 #endif // SERVICEREGISTRYUTILITIES_INL
       
   116 
       
   117 // ======== THIS FILE IS GENERATED - DO NOT MODIFY!!! ========================