sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include "UD_STD.H" sl@0: #include sl@0: #include sl@0: sl@0: /** sl@0: Security UID will be extracted from the format string and stored sl@0: in the place referenced by aUid parameter. sl@0: If uid name is presented in the format string, aUidName will be set to reference it. sl@0: */ sl@0: void ExtractUidAndName(const TDesC& aDbFormatStr, TUid& aPolicyUid, TPtrC& aUidName) sl@0: { sl@0: aPolicyUid = KNullUid; sl@0: aUidName.Set(aDbFormatStr); sl@0: TInt len = aDbFormatStr.Length(); sl@0: if(len >= KMaxUidName) sl@0: { sl@0: TLex lex(aDbFormatStr.Mid(len - KMaxUidName)); sl@0: if(TUint(lex.Get()) == '[' && sl@0: lex.Val(*(TUint32*)&aPolicyUid, EHex) == KErrNone && sl@0: TUint(lex.Get()) == ']' && sl@0: lex.Eos()) sl@0: aUidName.Set(aDbFormatStr.Left(len - KMaxUidName)); sl@0: } sl@0: }