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: HsService base |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef SERVICEBASE_H |
|
20 #define SERVICEBASE_H |
|
21 |
|
22 struct HsServiceInterfaceId; |
|
23 |
|
24 /** @ingroup group_hsservicemodel group_service_api_candidates |
|
25 * The base class for service interfaces |
|
26 * |
|
27 * @lib |
|
28 * @since S60 ?S60_version |
|
29 */ |
|
30 class IHsServiceBase |
|
31 { |
|
32 |
|
33 public: |
|
34 /** |
|
35 * Default virtual destructor. |
|
36 */ |
|
37 virtual ~IHsServiceBase() {} |
|
38 |
|
39 /** |
|
40 * Interface getter with casting. |
|
41 * |
|
42 * @since S60 ?S60_version |
|
43 * @param aBase HsService base object. |
|
44 * @return The queried interface, or NULL if the interface is not |
|
45 * supported or available. |
|
46 */ |
|
47 template <class T> |
|
48 static T* MakeInterface(IHsServiceBase* aBase) |
|
49 { |
|
50 return (aBase? static_cast<T*>(aBase->resolveService(T::type())): 0); |
|
51 } |
|
52 |
|
53 |
|
54 /** |
|
55 * Interface getter. |
|
56 * Derived classes should always call the base class method |
|
57 * from the overridden MakeInterface. |
|
58 * |
|
59 * @since S60 ?S60_version |
|
60 * @param aType The type id of the queried interface. |
|
61 * @return The queried interface, or NULL if the interface is not |
|
62 * supported or available. |
|
63 */ |
|
64 virtual IHsServiceBase* resolveService( const HsServiceInterfaceId &aType ) = 0; |
|
65 |
|
66 |
|
67 }; |
|
68 |
|
69 #endif |
|