First public contribution.
2 * Copyright (c) 2007-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.
25 #ifndef POLICYREADER_H
26 #define POLICYREADER_H
30 #include <barsread2.h>
33 #include <ups/policy.h>
34 #include "serviceconfig.h"
35 namespace UserPromptService
39 Encapsulates the data in the policy file header. This is also used by the
42 NONSHARABLE_CLASS(TPolicyHeader)
47 TInt iFormatVersion; ///< Version no. of resource format.
48 TUint16 iMajorVersion; ///< The major version no. of the UPS policy file.
49 TUint16 iMinorVersion; ///< The minor version no. of the UPS policy file.
50 TAuthorisationPolicy iAuthPolicy; ///< Authorisation policy for this service.
51 TUid iDefaultPolicyEvaluator; ///< The ECOM implementation UID of the default dialog creator.
52 TUid iDefaultDialogCreator; ///< The ECOM implementation UID of the default dialog creator.
56 Class for parsing a single User Prompt Service policy resource files defined
58 The policy file is opened when the reader object is constructed and
59 the set of policies may be enumerated by repeatedly calling the NextPolicy
61 NextPolicy returns NULL when the end of the file has been reached. After
62 this the reader class should be destroyed.
64 NONSHARABLE_CLASS(CPolicyReader) : public CBase
67 IMPORT_C static CPolicyReader* NewL(RFs& aRFs, const TDesC& aPolicyFileName);
68 IMPORT_C static CPolicyReader* NewLC(RFs& aRFs, const TDesC& aPolicyFileName);
69 IMPORT_C CPolicy* NextPolicyL();
70 IMPORT_C CPolicy* DefaultPolicyL();
71 IMPORT_C const TPolicyHeader& Header() const;
76 void ConstructL(RFs& aRfs, const TDesC& aPolicyFileName);
77 CPolicy* ReadPolicyL();
78 void ReadPolicyHeaderL();
80 CResourceFile* iResourceFile; ///< Handle to the resource file
81 RResourceReader iReader; ///< Parses the resource file
82 TPolicyHeader iHeader; ///< Header information
83 TInt iPolicyCount; ///< The number of policies in the file
84 TInt iPolicyNum; ///< The current policy being parsed
87 /// Policy files must only contain one top level resource.
88 static const int KPolicyResourceId = 1;
91 #endif /* POLICYREADER_H */