2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * CAuthExpression declaration
26 #ifndef AUTHEXPRESSION_H
27 #define AUTHEXPRESSION_H
30 #include "authserver/authtypes.h"
37 class CAuthExpression : public CBase
39 Describes an authentication expression.
41 AuthServer clients construct expressions using
42 AuthExpr, combined with AuthAnd and AuthOr, or
43 the equivalent overloaded & and | operators.
52 Externalize this object to the supplied stream.
54 @param aWriteStream Stream to write persistent state to.
56 virtual void ExternalizeL(RWriteStream& aWriteStream) const = 0;
60 class TAuthExpressionWrapper
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.
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
78 /* @internalComponent*/
79 TAuthExpressionWrapper(CAuthExpression* aExpression);
80 /* @internalComponent */
81 TAuthExpressionWrapper(TAuthPluginType aType);
82 /* @internalComponent */
83 TAuthExpressionWrapper(TPluginId aPluginId);
84 /* @internalComponent */
85 TAuthExpressionWrapper();
87 inline operator CAuthExpression*();
91 Pointer to the referenced authentication expression.
94 CAuthExpression*const iPtr;
98 IMPORT_C TAuthExpressionWrapper AuthExpr(TAuthPluginType aType);
99 IMPORT_C TAuthExpressionWrapper AuthExpr(TPluginId aPluginId);
100 IMPORT_C TAuthExpressionWrapper AuthExpr();
102 IMPORT_C TAuthExpressionWrapper AuthOr(CAuthExpression* aLeft, CAuthExpression* aRight);
103 IMPORT_C TAuthExpressionWrapper AuthAnd(CAuthExpression* aLeft, CAuthExpression* aRight);
106 #define AUTH_EXPR_BINARY_OPS
107 #ifdef AUTH_EXPR_BINARY_OPS
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
115 inline TAuthExpressionWrapper operator&(TAuthExpressionWrapper aLeft, TAuthExpressionWrapper aRight);
116 inline TAuthExpressionWrapper operator|(TAuthExpressionWrapper aLeft, TAuthExpressionWrapper aRight);
121 } // namespace AuthServer
123 #include "authserver/authexpression.inl"
125 #endif // EXPRESSION_H