persistentstorage/sql/SRC/Server/SqlSrvSecurityMap.h
changeset 0 08ec8eefde2f
child 10 31a8f755b7fe
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __SQLSRVSECURITYMAP_H__
       
    17 #define __SQLSRVSECURITYMAP_H__
       
    18 
       
    19 #include "SqlMap.h"		//RSqlMap
       
    20 
       
    21 //Forward declarations
       
    22 class CSqlSecurityPolicy;
       
    23 
       
    24 /////////////////////////////////////////////////////////////////////////////////////////////////////////
       
    25 // {Secure database name : Security policy} map declarations
       
    26 // "Secure database name" is UTF8 encoded, zero-terminated.
       
    27 //
       
    28 // "Secure database name" == <DRIVE:><NAME>[.EXT]
       
    29 /////////////////////////////////////////////////////////////////////////////////////////////////////////
       
    30 
       
    31 /**
       
    32 {const TUint8*, const CSqlSecurityPolicy*} pair destructor.
       
    33 Used as a template argument (DESTRUCTOR) in RSqlMap class.
       
    34 
       
    35 @see TSqlPair
       
    36 @see TSqlMapIterator
       
    37 @see RSqlMap
       
    38 
       
    39 @internalComponent
       
    40 */
       
    41 NONSHARABLE_STRUCT(TSqlSecurityDestructor)
       
    42 	{
       
    43 	void Destroy(const TUint8*& aKey, const CSqlSecurityPolicy*& aData);
       
    44 	};
       
    45 
       
    46 /**
       
    47 {const TUint8*, const CSqlSecurityPolicy*} pair reference counter.
       
    48 Used as a template argument (REFCNTR) in RSqlMap class.
       
    49 
       
    50 @see TSqlPair
       
    51 @see TSqlMapIterator
       
    52 @see RSqlMap
       
    53 
       
    54 @internalComponent
       
    55 */
       
    56 NONSHARABLE_STRUCT(TSqlSecurityRefCounter)
       
    57 	{
       
    58 	inline TSqlSecurityRefCounter() :
       
    59 		iRefCount(0)
       
    60 		{
       
    61 		(void)Increment();
       
    62 		}
       
    63 	inline TInt Increment()
       
    64 		{
       
    65 		return ++iRefCount;	
       
    66 		}
       
    67 	inline TInt Decrement()
       
    68 		{
       
    69 		return --iRefCount;	
       
    70 		}
       
    71 	
       
    72 	TInt iRefCount;
       
    73 	};
       
    74 
       
    75 //Typedefs for {const TUint8*, const CSqlSecurityPolicy*} map.
       
    76 typedef struct TSqlPair<const TUint8*, const CSqlSecurityPolicy*, TSqlSecurityRefCounter>  TSqlSecurityPair;
       
    77 typedef class TLinearOrder<TSqlSecurityPair> TSqlSecurityLinearOrder;
       
    78 typedef class RSqlMap<const TUint8*, const CSqlSecurityPolicy*, TSqlSecurityRefCounter, TSqlSecurityDestructor>  RSqlSecurityMap;
       
    79 
       
    80 /////////////////////////////////////////////////////////////////////////////////////////////////////////
       
    81 // {Attached database name : Secure database file name} map declarations
       
    82 // "Attached database name" is UTF8 encoded, zero-terminated.
       
    83 // "Secure database file name" is UTF8 encoded, zero-terminated. Format: <Drive:><FileName[.Ext]>
       
    84 /////////////////////////////////////////////////////////////////////////////////////////////////////////
       
    85 
       
    86 /**
       
    87 {const TUint8*, const TUint8*} pair destructor.
       
    88 Used as a template argument (DESTRUCTOR) in RSqlMap class.
       
    89 
       
    90 @see TSqlPair
       
    91 @see TSqlMapIterator
       
    92 @see RSqlMap
       
    93 
       
    94 @internalComponent
       
    95 */
       
    96 NONSHARABLE_STRUCT(TSqlAttachDbDestructor)
       
    97 	{
       
    98 	void Destroy(const TUint8*& aKey, const TUint8*& aData);
       
    99 	};
       
   100 
       
   101 /**
       
   102 {const TUint8*, const TUint8*} pair reference counter.
       
   103 Used as a template argument (REFCNTR) in RSqlMap class.
       
   104 
       
   105 @see TSqlPair
       
   106 @see TSqlMapIterator
       
   107 @see RSqlMap
       
   108 
       
   109 @internalComponent
       
   110 */
       
   111 NONSHARABLE_STRUCT(TSqlAttachDbRefCounter)
       
   112 	{
       
   113 	inline TSqlAttachDbRefCounter()
       
   114 		{
       
   115 		(void)Increment();
       
   116 		}
       
   117 	inline TInt Increment()
       
   118 		{
       
   119 		return 1;	
       
   120 		}
       
   121 	inline TInt Decrement()
       
   122 		{
       
   123 		return 0;	
       
   124 		}
       
   125 	};
       
   126 
       
   127 //Typedefs for {const TUint8*, const TUint8*} map.
       
   128 typedef struct TSqlPair<const TUint8*, const TUint8*, TSqlAttachDbRefCounter>  TSqlAttachDbPair;
       
   129 typedef class TLinearOrder<TSqlAttachDbPair> TSqlAttachDbLinearOrder;
       
   130 typedef class RSqlMap<const TUint8*, const TUint8*, TSqlAttachDbRefCounter, TSqlAttachDbDestructor>  RSqlAttachDbMap;
       
   131 
       
   132 /////////////////////////////////////////////////////////////////////////////////////////////////////////
       
   133 // {Compact database name ("main" or attached db name) : Full database file name} map declarations
       
   134 // "Compact database name" is UTF16 encoded.
       
   135 // "Full database file name" is UTF16 encoded.
       
   136 /////////////////////////////////////////////////////////////////////////////////////////////////////////
       
   137 
       
   138 /**
       
   139 A reference counter for the TSqlCompactDbPair pair and RSqlCompactDbMap.
       
   140 
       
   141 @see TSqlPair
       
   142 @see TSqlMapIterator
       
   143 @see RSqlMap
       
   144 
       
   145 @internalComponent
       
   146 */
       
   147 NONSHARABLE_STRUCT(TSqlCompactDbRefCounter)
       
   148 	{
       
   149 	inline TSqlCompactDbRefCounter()
       
   150 		{
       
   151 		(void)Increment();
       
   152 		}
       
   153 	inline TInt Increment()
       
   154 		{
       
   155 		return 1;	
       
   156 		}
       
   157 	inline TInt Decrement()
       
   158 		{
       
   159 		return 0;	
       
   160 		}
       
   161 	};
       
   162 
       
   163 /**
       
   164 Destrucor for the TSqlCompactDbPair pair.
       
   165 
       
   166 @see TSqlPair
       
   167 @see TSqlMapIterator
       
   168 @see RSqlMap
       
   169 
       
   170 @internalComponent
       
   171 */
       
   172 NONSHARABLE_STRUCT(TSqlCompactDbDestructor)
       
   173 	{
       
   174 	inline void Destroy(const HBufC*& aKey, const HBufC*& aData)
       
   175 		{
       
   176 		delete const_cast <HBufC*&> (aData);
       
   177 		delete const_cast <HBufC*&> (aKey);
       
   178 		}
       
   179 	};
       
   180 
       
   181 //Typedefs for the {const HBufC*, const HBufC*} map.
       
   182 typedef struct TSqlPair<const HBufC*, const HBufC*, TSqlCompactDbRefCounter>  TSqlCompactDbPair;
       
   183 typedef class TLinearOrder<TSqlCompactDbPair> TSqlCompactDbLinearOrder;
       
   184 typedef class RSqlMap<const HBufC*, const HBufC*, TSqlCompactDbRefCounter, TSqlCompactDbDestructor>  RSqlCompactDbMap;
       
   185 typedef class TSqlMapIterator<const HBufC*, const HBufC*, TSqlCompactDbRefCounter, TSqlCompactDbDestructor> TSqlCompactDbMapIterator;
       
   186 
       
   187 /////////////////////////////////////////////////////////////////////////////////////////////////////////
       
   188 
       
   189 #endif//__SQLSRVSECURITYMAP_H__