javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/src/PathAccessPolicy.h
changeset 21 2a9601315dfc
equal deleted inserted replaced
18:e8e63152f320 21:2a9601315dfc
       
     1 /*
       
     2 * Copyright (c) 2003 - 2004 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 "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 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef PATHACCESSPOLICY_H
       
    21 #define PATHACCESSPOLICY_H
       
    22 
       
    23 /**
       
    24 @file
       
    25 @internalComponent
       
    26 */
       
    27 
       
    28 #include <e32base.h>
       
    29 #include "j2me/midp2/security/MDriveAccessPolicy.h"
       
    30 
       
    31 
       
    32 namespace MIDP
       
    33 {
       
    34 
       
    35 class CPathAccessPolicy : public CBase
       
    36 {
       
    37 private:
       
    38     typedef MDriveAccessPolicy::TAccessMode TPathAccessMode;
       
    39 
       
    40 public:
       
    41     static CPathAccessPolicy* NewL();
       
    42     virtual ~CPathAccessPolicy();
       
    43 
       
    44     void AddRef();
       
    45     void Release();
       
    46 
       
    47     TBool DriveAccess() const;
       
    48     TPathAccessMode PathAccess(const TDesC& aPath) const;
       
    49     const RPointerArray<HBufC>& RootDirectoryListL() const;
       
    50     TBool MapPathL(const TDesC& aFrom, TDes& aTo) const;
       
    51 
       
    52     void AddPathAccessL(const TDesC& aPath, TPathAccessMode aMode);
       
    53     void AddPathMappingL(const TDesC& aDir, const TDesC& aPath, TBool aInMidletHome);
       
    54 
       
    55 private:
       
    56     CPathAccessPolicy();
       
    57 
       
    58     TPathAccessMode SubPathAccess(HBufC* aPath, TBool aAllowNonRecursiveMatch) const;
       
    59 
       
    60 private:
       
    61     TInt iCount;    // Reference count to object.
       
    62     RPointerArray<HBufC> iAccessPathList;   // Kept in alphabetical order.
       
    63     RArray<TPathAccessMode> iAccessModeList;    // Kept in iAccessPathList order.
       
    64     RPointerArray<HBufC> iRootDirList;  // Kept in alphabetical order.
       
    65     RPointerArray<HBufC> iRootMapList;  // Kept in iRootDirList order.
       
    66     RArray<TBool> iUseMidletHomePrefix; // Kept in iRootDirList order.
       
    67 };
       
    68 
       
    69 inline TBool CPathAccessPolicy::DriveAccess() const
       
    70 {
       
    71     return ETrue;
       
    72 }
       
    73 
       
    74 } // end of namespace MIDP
       
    75 
       
    76 #endif // PATHACCESSPOLICY_H