epoc32/include/authserver/authexpression.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/authserver/authexpression.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,125 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +* CAuthExpression declaration
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +/**
    1.24 + @file 
    1.25 + @publishedAll
    1.26 + @released
    1.27 +*/
    1.28 +
    1.29 +#ifndef AUTHEXPRESSION_H
    1.30 +#define AUTHEXPRESSION_H
    1.31 +
    1.32 +#include <s32strm.h>
    1.33 +#include "authserver/authtypes.h"
    1.34 +
    1.35 +
    1.36 +namespace AuthServer
    1.37 +{
    1.38 +
    1.39 +
    1.40 +class CAuthExpression : public CBase
    1.41 +/**
    1.42 +	Describes an authentication expression.
    1.43 +
    1.44 +	AuthServer clients construct expressions using
    1.45 +	AuthExpr, combined with AuthAnd and AuthOr, or
    1.46 +	the equivalent overloaded & and | operators.
    1.47 +
    1.48 +	@see AuthExpr
    1.49 +	@see AuthAnd
    1.50 +	@see AuthOr
    1.51 + */
    1.52 +	{
    1.53 +public:
    1.54 +	/**
    1.55 +		Externalize this object to the supplied stream.
    1.56 +
    1.57 +		@param	aWriteStream Stream to write persistent state to.
    1.58 +	 */
    1.59 +	virtual void ExternalizeL(RWriteStream& aWriteStream) const = 0;
    1.60 +	};
    1.61 +
    1.62 +
    1.63 +class TAuthExpressionWrapper
    1.64 +/**
    1.65 +	Simple wrapper around a pointer to an authentication
    1.66 +	expression.  It is defined so the binary & and | operators
    1.67 +	can be overloaded to generate concise expressions.
    1.68 +	
    1.69 +	Like CAuthExpression, this class should not be
    1.70 +	used directly by clients, but via the AuthExpr,
    1.71 +	AuthAnd, and AuthOr functions, or via the overloaded
    1.72 +	& and | operators.  For this reason, the constructors
    1.73 +	are not exported.
    1.74 +	
    1.75 +	@see AuthExpr
    1.76 +	@see AuthAnd
    1.77 +	@see AuthOr
    1.78 + */
    1.79 +	{
    1.80 +public:
    1.81 +	/* @internalComponent*/
    1.82 +	TAuthExpressionWrapper(CAuthExpression* aExpression);
    1.83 +	/* @internalComponent */
    1.84 +	TAuthExpressionWrapper(TAuthPluginType aType);
    1.85 +	/* @internalComponent */
    1.86 +	TAuthExpressionWrapper(TPluginId aPluginId);
    1.87 +	/* @internalComponent */
    1.88 +	TAuthExpressionWrapper();
    1.89 +	
    1.90 +	inline operator CAuthExpression*();
    1.91 +	
    1.92 +private:
    1.93 +	/**
    1.94 +		Pointer to the referenced authentication expression.
    1.95 +		This is NULL in OOM.
    1.96 +	 */
    1.97 +	CAuthExpression*const iPtr;
    1.98 +	};
    1.99 +
   1.100 +
   1.101 +IMPORT_C TAuthExpressionWrapper AuthExpr(TAuthPluginType aType);
   1.102 +IMPORT_C TAuthExpressionWrapper AuthExpr(TPluginId aPluginId);
   1.103 +IMPORT_C TAuthExpressionWrapper AuthExpr();
   1.104 +
   1.105 +IMPORT_C TAuthExpressionWrapper AuthOr(CAuthExpression* aLeft, CAuthExpression* aRight);
   1.106 +IMPORT_C TAuthExpressionWrapper AuthAnd(CAuthExpression* aLeft, CAuthExpression* aRight);
   1.107 +
   1.108 +
   1.109 +#define AUTH_EXPR_BINARY_OPS
   1.110 +#ifdef AUTH_EXPR_BINARY_OPS
   1.111 +
   1.112 +// These binary operators provide a more concise way to write
   1.113 +// authentication expressions than AuthOr and AuthAnd.  However,
   1.114 +// their behaviour - dynamically allocating from the heap - is
   1.115 +// non-obvious to a reader, so they are left as a build-time
   1.116 +// option.
   1.117 +
   1.118 +inline TAuthExpressionWrapper operator&(TAuthExpressionWrapper aLeft, TAuthExpressionWrapper aRight);
   1.119 +inline TAuthExpressionWrapper operator|(TAuthExpressionWrapper aLeft, TAuthExpressionWrapper aRight);
   1.120 +
   1.121 +#endif
   1.122 +
   1.123 +
   1.124 +}	// namespace AuthServer
   1.125 +
   1.126 +#include "authserver/authexpression.inl"
   1.127 +
   1.128 +#endif // EXPRESSION_H