sl@0: /* sl@0: * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: sl@0: #ifndef POLICYLIST_H sl@0: #define POLICYLIST_H sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include "serviceconfig.h" sl@0: sl@0: namespace UserPromptService sl@0: { sl@0: // Functions are only exported to support unit tests. sl@0: // Not intended for use outside UPS policy library. sl@0: class CPolicy; sl@0: class CPolicyReader; sl@0: class CPromptRequest; sl@0: sl@0: NONSHARABLE_CLASS(CPolicyList) : public CBase sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Converts between UPS policy filenames and system server secure ids & service ids. sl@0: */ sl@0: NONSHARABLE_CLASS(TId) sl@0: { sl@0: public: sl@0: IMPORT_C TId(); sl@0: IMPORT_C TId(const TSecureId& iServerSid, const TServiceId& iServiceId); sl@0: IMPORT_C static void IdL(const TDesC& aPolicyFile, TId& aId); sl@0: IMPORT_C void AppendNameToPath(TDes& aFileName) const; sl@0: IMPORT_C TBool operator==(const TId& aId) const; sl@0: public: sl@0: TSecureId iServerSid; sl@0: TServiceId iServiceId; sl@0: }; sl@0: sl@0: IMPORT_C static CPolicyList* NewL(const TId& aId, CPolicyReader& aReader); sl@0: IMPORT_C static CPolicyList* NewLC(const TId& aId, CPolicyReader& aReader); sl@0: IMPORT_C const CPolicy* Match(const CPromptRequest& aRequest) const; sl@0: IMPORT_C const TId& Id() const; sl@0: IMPORT_C const TServiceConfig& ServiceConfig() const; sl@0: sl@0: ~CPolicyList(); sl@0: private: sl@0: CPolicyList(const TId& aId); sl@0: void ConstructL(CPolicyReader& aReader); sl@0: sl@0: CPolicy* iDefaultPolicy; ///< The policy to use if no other policy matches. sl@0: RPointerArray iPolicies; ///< An ordered list of policies read from the policy file. sl@0: /** Associates the policy list with a system server secure id and a service id. */ sl@0: TId iId; sl@0: TServiceConfig iServiceConfig; ///< The policy header sl@0: }; sl@0: } sl@0: sl@0: #endif // POLICYLIST_H