persistentstorage/dbms/udbms/Ud_drvr2.cpp
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 // Copyright (c) 2004-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 #include "UD_STD.H"
       
    17 #include <f32file.h>
       
    18 #include <e32uid.h>
       
    19 
       
    20 /**
       
    21 Security UID will be extracted from the format string and stored
       
    22 in the place referenced by aUid parameter.
       
    23 If uid name is presented in the format string, aUidName will be set to reference it.
       
    24 */
       
    25 void ExtractUidAndName(const TDesC& aDbFormatStr, TUid& aPolicyUid, TPtrC& aUidName)
       
    26 	{
       
    27 	aPolicyUid = KNullUid;
       
    28 	aUidName.Set(aDbFormatStr);
       
    29 	TInt len = aDbFormatStr.Length();
       
    30 	if(len >= KMaxUidName)
       
    31 		{
       
    32 		TLex lex(aDbFormatStr.Mid(len - KMaxUidName));
       
    33 		if(TUint(lex.Get()) == '[' && 
       
    34 		   lex.Val(*(TUint32*)&aPolicyUid, EHex) == KErrNone && 
       
    35 		   TUint(lex.Get()) == ']' && 
       
    36 		   lex.Eos())
       
    37 			aUidName.Set(aDbFormatStr.Left(len - KMaxUidName));
       
    38 		}
       
    39 	}