1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/centralrepository/convtool/src/main.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,86 @@
1.4 +// Copyright (c) 2005-2009 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 +// E32Main(), DoMainL() implementations
1.18 +//
1.19 +//
1.20 +
1.21 +#include <e32std.h>
1.22 +#include <e32debug.h>
1.23 +#include "CentRepConvTool.h"
1.24 +#include "srvres.h"
1.25 +
1.26 +//
1.27 +// DoMainL() get command line args and pass them to CCentRepConv.
1.28 +//
1.29 +static void DoMainL()
1.30 + {
1.31 + TInt nPushed = 0;
1.32 +
1.33 + // create and install the active scheduler so that
1.34 + // CacheManager can add itself to the scheduler.
1.35 + // *** but do not CActiveScheduler::Start() ***
1.36 + CActiveScheduler* s=new(ELeave) CActiveScheduler;
1.37 + CleanupStack::PushL(s);
1.38 + nPushed++;
1.39 + CActiveScheduler::Install(s);
1.40 +
1.41 + TServerResources::InitialiseL(); // CentRep server static data
1.42 + CleanupStack::PushL(TCleanupItem(TCleanupOperation(&TServerResources::Close), NULL));
1.43 + nPushed++;
1.44 +
1.45 + HBufC* cmdLine = HBufC::NewL(User::CommandLineLength());
1.46 + CleanupStack::PushL(cmdLine);
1.47 + nPushed++;
1.48 +
1.49 + TPtr cmdLinePtr(cmdLine->Des());
1.50 + User::CommandLine(cmdLinePtr);
1.51 +
1.52 + CCentRepConvTool* convTool = CCentRepConvTool::NewL(*cmdLine,
1.53 + TServerResources::iFs, ETrue);
1.54 + CleanupStack::PushL(convTool);
1.55 + nPushed++;
1.56 +
1.57 + convTool->ProcessCmdL();
1.58 +
1.59 + CleanupStack::PopAndDestroy(nPushed);
1.60 + }
1.61 +
1.62 +//
1.63 +// The main function of CentRepConv tool which converts repository files
1.64 +// from text format to binary and vice versa.
1.65 +// Repositories in binary format load faster. CentRep clients are
1.66 +// strongly encouraged to convert their text init files to binary
1.67 +// to speed up access to their settings.
1.68 +//
1.69 +TInt E32Main()
1.70 + {
1.71 + __UHEAP_MARK;
1.72 +
1.73 + CTrapCleanup* trapCleanup = CTrapCleanup::New();
1.74 + __ASSERT_ALWAYS(trapCleanup != NULL, User::Invariant());
1.75 +
1.76 + TRAPD(err, ::DoMainL());
1.77 +
1.78 + if (err != KErrNone)
1.79 + {
1.80 + _LIT(KText, "CentRepConv tool failed. Error code = %d");
1.81 + RDebug::Print(KText, err);
1.82 + }
1.83 +
1.84 + delete trapCleanup;
1.85 +
1.86 + __UHEAP_MARKEND;
1.87 +
1.88 + return err;
1.89 + }