diff -r b8bdbc8f59c7 -r 7d4490026038 loggingservices/eventlogger/test/src/t_logutil3.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/loggingservices/eventlogger/test/src/t_logutil3.cpp Mon Sep 27 11:59:56 2010 +0100 @@ -0,0 +1,50 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// +#include "t_logutil3.h" +#include +#include "LOGREPDEFS.H" + +//This function reads logeng repository file and returns the integer value of the given key. +static TInt LogGetRepositoryValueL(CRepository& aRepository, TInt aKey) + { + TInt val = -1; + User::LeaveIfError(aRepository.Get(aKey, val)); + return val; + } + +void LogGetContactmatchCountAndNameFormatL(TInt& aContactMatchCount, TLogContactNameFormat& aContactNameFormat) + { + CRepository* repository = NULL; + TRAPD(err, repository = CRepository::NewL(KUidLogengRepository)); + if(err == KErrNone) + { + CleanupStack::PushL(repository); + aContactMatchCount = LogGetRepositoryValueL(*repository, KContactMatchCountRepKey); + aContactNameFormat = static_cast (LogGetRepositoryValueL(*repository, KContactNameFormatRepKey)); + CleanupStack::PopAndDestroy(repository); + } + else if(err == KErrCorrupt) + { + __ASSERT_DEBUG(!repository, User::Invariant()); + User::Leave(err); + } + else + { + __ASSERT_DEBUG(!repository, User::Invariant()); + aContactMatchCount = KLogContactMatchCount; + aContactNameFormat = KLogContactNameFormat; + } + } +