os/persistentdata/persistentstorage/sql/SRC/Server/SqlSrvSecurityMap.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sql/SRC/Server/SqlSrvSecurityMap.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,190 @@
     1.4 +// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __SQLSRVSECURITYMAP_H__
    1.20 +#define __SQLSRVSECURITYMAP_H__
    1.21 +
    1.22 +#include "SqlMap.h"		//RSqlMap
    1.23 +
    1.24 +//Forward declarations
    1.25 +class CSqlSecurityPolicy;
    1.26 +
    1.27 +/////////////////////////////////////////////////////////////////////////////////////////////////////////
    1.28 +// {Secure database name : Security policy} map declarations
    1.29 +// "Secure database name" is UTF8 encoded, zero-terminated.
    1.30 +//
    1.31 +// "Secure database name" == <DRIVE:><NAME>[.EXT]
    1.32 +/////////////////////////////////////////////////////////////////////////////////////////////////////////
    1.33 +
    1.34 +/**
    1.35 +{const TUint8*, const CSqlSecurityPolicy*} pair destructor.
    1.36 +Used as a template argument (DESTRUCTOR) in RSqlMap class.
    1.37 +
    1.38 +@see TSqlPair
    1.39 +@see TSqlMapIterator
    1.40 +@see RSqlMap
    1.41 +
    1.42 +@internalComponent
    1.43 +*/
    1.44 +NONSHARABLE_STRUCT(TSqlSecurityDestructor)
    1.45 +	{
    1.46 +	void Destroy(const TUint8*& aKey, const CSqlSecurityPolicy*& aData);
    1.47 +	};
    1.48 +
    1.49 +/**
    1.50 +{const TUint8*, const CSqlSecurityPolicy*} pair reference counter.
    1.51 +Used as a template argument (REFCNTR) in RSqlMap class.
    1.52 +
    1.53 +@see TSqlPair
    1.54 +@see TSqlMapIterator
    1.55 +@see RSqlMap
    1.56 +
    1.57 +@internalComponent
    1.58 +*/
    1.59 +NONSHARABLE_STRUCT(TSqlSecurityRefCounter)
    1.60 +	{
    1.61 +	inline TSqlSecurityRefCounter() :
    1.62 +		iRefCount(0)
    1.63 +		{
    1.64 +		(void)Increment();
    1.65 +		}
    1.66 +	inline TInt Increment()
    1.67 +		{
    1.68 +		return ++iRefCount;	
    1.69 +		}
    1.70 +	inline TInt Decrement()
    1.71 +		{
    1.72 +		return --iRefCount;	
    1.73 +		}
    1.74 +	
    1.75 +	TInt iRefCount;
    1.76 +	};
    1.77 +
    1.78 +//Typedefs for {const TUint8*, const CSqlSecurityPolicy*} map.
    1.79 +typedef struct TSqlPair<const TUint8*, const CSqlSecurityPolicy*, TSqlSecurityRefCounter>  TSqlSecurityPair;
    1.80 +typedef class TLinearOrder<TSqlSecurityPair> TSqlSecurityLinearOrder;
    1.81 +typedef class RSqlMap<const TUint8*, const CSqlSecurityPolicy*, TSqlSecurityRefCounter, TSqlSecurityDestructor>  RSqlSecurityMap;
    1.82 +
    1.83 +/////////////////////////////////////////////////////////////////////////////////////////////////////////
    1.84 +// {Attached database name : Secure database file name} map declarations
    1.85 +// "Attached database name" is UTF8 encoded, zero-terminated.
    1.86 +// "Secure database file name" is UTF8 encoded, zero-terminated. Format: <Drive:><FileName[.Ext]>
    1.87 +/////////////////////////////////////////////////////////////////////////////////////////////////////////
    1.88 +
    1.89 +/**
    1.90 +{const TUint8*, const TUint8*} pair destructor.
    1.91 +Used as a template argument (DESTRUCTOR) in RSqlMap class.
    1.92 +
    1.93 +@see TSqlPair
    1.94 +@see TSqlMapIterator
    1.95 +@see RSqlMap
    1.96 +
    1.97 +@internalComponent
    1.98 +*/
    1.99 +NONSHARABLE_STRUCT(TSqlAttachDbDestructor)
   1.100 +	{
   1.101 +	void Destroy(const TUint8*& aKey, const TUint8*& aData);
   1.102 +	};
   1.103 +
   1.104 +/**
   1.105 +{const TUint8*, const TUint8*} pair reference counter.
   1.106 +Used as a template argument (REFCNTR) in RSqlMap class.
   1.107 +
   1.108 +@see TSqlPair
   1.109 +@see TSqlMapIterator
   1.110 +@see RSqlMap
   1.111 +
   1.112 +@internalComponent
   1.113 +*/
   1.114 +NONSHARABLE_STRUCT(TSqlAttachDbRefCounter)
   1.115 +	{
   1.116 +	inline TSqlAttachDbRefCounter()
   1.117 +		{
   1.118 +		(void)Increment();
   1.119 +		}
   1.120 +	inline TInt Increment()
   1.121 +		{
   1.122 +		return 1;	
   1.123 +		}
   1.124 +	inline TInt Decrement()
   1.125 +		{
   1.126 +		return 0;	
   1.127 +		}
   1.128 +	};
   1.129 +
   1.130 +//Typedefs for {const TUint8*, const TUint8*} map.
   1.131 +typedef struct TSqlPair<const TUint8*, const TUint8*, TSqlAttachDbRefCounter>  TSqlAttachDbPair;
   1.132 +typedef class TLinearOrder<TSqlAttachDbPair> TSqlAttachDbLinearOrder;
   1.133 +typedef class RSqlMap<const TUint8*, const TUint8*, TSqlAttachDbRefCounter, TSqlAttachDbDestructor>  RSqlAttachDbMap;
   1.134 +
   1.135 +/////////////////////////////////////////////////////////////////////////////////////////////////////////
   1.136 +// {Compact database name ("main" or attached db name) : Full database file name} map declarations
   1.137 +// "Compact database name" is UTF16 encoded.
   1.138 +// "Full database file name" is UTF16 encoded.
   1.139 +/////////////////////////////////////////////////////////////////////////////////////////////////////////
   1.140 +
   1.141 +/**
   1.142 +A reference counter for the TSqlCompactDbPair pair and RSqlCompactDbMap.
   1.143 +
   1.144 +@see TSqlPair
   1.145 +@see TSqlMapIterator
   1.146 +@see RSqlMap
   1.147 +
   1.148 +@internalComponent
   1.149 +*/
   1.150 +NONSHARABLE_STRUCT(TSqlCompactDbRefCounter)
   1.151 +	{
   1.152 +	inline TSqlCompactDbRefCounter()
   1.153 +		{
   1.154 +		(void)Increment();
   1.155 +		}
   1.156 +	inline TInt Increment()
   1.157 +		{
   1.158 +		return 1;	
   1.159 +		}
   1.160 +	inline TInt Decrement()
   1.161 +		{
   1.162 +		return 0;	
   1.163 +		}
   1.164 +	};
   1.165 +
   1.166 +/**
   1.167 +Destrucor for the TSqlCompactDbPair pair.
   1.168 +
   1.169 +@see TSqlPair
   1.170 +@see TSqlMapIterator
   1.171 +@see RSqlMap
   1.172 +
   1.173 +@internalComponent
   1.174 +*/
   1.175 +NONSHARABLE_STRUCT(TSqlCompactDbDestructor)
   1.176 +	{
   1.177 +	inline void Destroy(const HBufC*& aKey, const HBufC*& aData)
   1.178 +		{
   1.179 +		delete const_cast <HBufC*&> (aData);
   1.180 +		delete const_cast <HBufC*&> (aKey);
   1.181 +		}
   1.182 +	};
   1.183 +
   1.184 +//Typedefs for the {const HBufC*, const HBufC*} map.
   1.185 +typedef struct TSqlPair<const HBufC*, const HBufC*, TSqlCompactDbRefCounter>  TSqlCompactDbPair;
   1.186 +typedef class TLinearOrder<TSqlCompactDbPair> TSqlCompactDbLinearOrder;
   1.187 +typedef class RSqlMap<const HBufC*, const HBufC*, TSqlCompactDbRefCounter, TSqlCompactDbDestructor>  RSqlCompactDbMap;
   1.188 +typedef class TSqlMapIterator<const HBufC*, const HBufC*, TSqlCompactDbRefCounter, TSqlCompactDbDestructor> TSqlCompactDbMapIterator;
   1.189 +typedef TSqlMapIterator<const TUint8*, const TUint8*, TSqlAttachDbRefCounter, TSqlAttachDbDestructor>  TSqlAttachDbMapIterator;
   1.190 +
   1.191 +/////////////////////////////////////////////////////////////////////////////////////////////////////////
   1.192 +
   1.193 +#endif//__SQLSRVSECURITYMAP_H__