|
1 /* |
|
2 * Copyright (c) 2005-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 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: |
|
15 * CAuthExpression declaration |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @publishedAll |
|
23 @released |
|
24 */ |
|
25 |
|
26 #ifndef AUTHEXPRESSION_H |
|
27 #define AUTHEXPRESSION_H |
|
28 |
|
29 #include <s32strm.h> |
|
30 #include "authserver/authtypes.h" |
|
31 |
|
32 |
|
33 namespace AuthServer |
|
34 { |
|
35 |
|
36 |
|
37 class CAuthExpression : public CBase |
|
38 /** |
|
39 Describes an authentication expression. |
|
40 |
|
41 AuthServer clients construct expressions using |
|
42 AuthExpr, combined with AuthAnd and AuthOr, or |
|
43 the equivalent overloaded & and | operators. |
|
44 |
|
45 @see AuthExpr |
|
46 @see AuthAnd |
|
47 @see AuthOr |
|
48 */ |
|
49 { |
|
50 public: |
|
51 /** |
|
52 Externalize this object to the supplied stream. |
|
53 |
|
54 @param aWriteStream Stream to write persistent state to. |
|
55 */ |
|
56 virtual void ExternalizeL(RWriteStream& aWriteStream) const = 0; |
|
57 }; |
|
58 |
|
59 |
|
60 class TAuthExpressionWrapper |
|
61 /** |
|
62 Simple wrapper around a pointer to an authentication |
|
63 expression. It is defined so the binary & and | operators |
|
64 can be overloaded to generate concise expressions. |
|
65 |
|
66 Like CAuthExpression, this class should not be |
|
67 used directly by clients, but via the AuthExpr, |
|
68 AuthAnd, and AuthOr functions, or via the overloaded |
|
69 & and | operators. For this reason, the constructors |
|
70 are not exported. |
|
71 |
|
72 @see AuthExpr |
|
73 @see AuthAnd |
|
74 @see AuthOr |
|
75 */ |
|
76 { |
|
77 public: |
|
78 /* @internalComponent*/ |
|
79 TAuthExpressionWrapper(CAuthExpression* aExpression); |
|
80 /* @internalComponent */ |
|
81 TAuthExpressionWrapper(TAuthPluginType aType); |
|
82 /* @internalComponent */ |
|
83 TAuthExpressionWrapper(TPluginId aPluginId); |
|
84 /* @internalComponent */ |
|
85 TAuthExpressionWrapper(); |
|
86 |
|
87 inline operator CAuthExpression*(); |
|
88 |
|
89 private: |
|
90 /** |
|
91 Pointer to the referenced authentication expression. |
|
92 This is NULL in OOM. |
|
93 */ |
|
94 CAuthExpression*const iPtr; |
|
95 }; |
|
96 |
|
97 |
|
98 IMPORT_C TAuthExpressionWrapper AuthExpr(TAuthPluginType aType); |
|
99 IMPORT_C TAuthExpressionWrapper AuthExpr(TPluginId aPluginId); |
|
100 IMPORT_C TAuthExpressionWrapper AuthExpr(); |
|
101 |
|
102 IMPORT_C TAuthExpressionWrapper AuthOr(CAuthExpression* aLeft, CAuthExpression* aRight); |
|
103 IMPORT_C TAuthExpressionWrapper AuthAnd(CAuthExpression* aLeft, CAuthExpression* aRight); |
|
104 |
|
105 |
|
106 #define AUTH_EXPR_BINARY_OPS |
|
107 #ifdef AUTH_EXPR_BINARY_OPS |
|
108 |
|
109 // These binary operators provide a more concise way to write |
|
110 // authentication expressions than AuthOr and AuthAnd. However, |
|
111 // their behaviour - dynamically allocating from the heap - is |
|
112 // non-obvious to a reader, so they are left as a build-time |
|
113 // option. |
|
114 |
|
115 inline TAuthExpressionWrapper operator&(TAuthExpressionWrapper aLeft, TAuthExpressionWrapper aRight); |
|
116 inline TAuthExpressionWrapper operator|(TAuthExpressionWrapper aLeft, TAuthExpressionWrapper aRight); |
|
117 |
|
118 #endif |
|
119 |
|
120 |
|
121 } // namespace AuthServer |
|
122 |
|
123 #include "authserver/authexpression.inl" |
|
124 |
|
125 #endif // EXPRESSION_H |