pictographs/AknPictograph/tools/AknPictoBitmapBuilder/src/Main.cpp
changeset 0 05e9090e2422
child 58 a2f9480e2280
equal deleted inserted replaced
-1:000000000000 0:05e9090e2422
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Pictograph bitmap builder - Main function
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32std.h>
       
    21 #include <fbs.h>
       
    22 #include <bacline.h> 
       
    23 #include "BitmapBuilder.h"
       
    24 
       
    25 // CONSTANTS
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // ExecuteL()
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 void ExecuteL()
       
    34     {
       
    35     
       
    36     // Check arguments, the only allowed argument is '1' or '2'
       
    37     CCommandLineArguments* args = CCommandLineArguments::NewLC();
       
    38     if ( args->Count() != 2 )
       
    39         {
       
    40         User::Leave( KErrArgument );
       
    41         }
       
    42 
       
    43     TPtrC arg = args->Arg( 1 );
       
    44     if ( arg.Length() != 1 || ( arg[0] != '1' && arg[0] != '2' ) )
       
    45         {
       
    46         User::Leave( KErrArgument );
       
    47         }        
       
    48 
       
    49     CBitmapBuilder* builder = CBitmapBuilder::NewLC();
       
    50 
       
    51     if ( arg[0] == '1' )
       
    52         {
       
    53         // phase 1
       
    54         builder->EnsurePathsL();
       
    55         builder->ParseIniFilesL();
       
    56         builder->GenerateBmconvCommandFilesL();
       
    57         builder->GenerateBuildBitmapsCommandFileL();
       
    58         }
       
    59     else
       
    60         {
       
    61         // phase 2
       
    62         builder->ParseIniFilesL();
       
    63         builder->BuildFinalBitmapsL();
       
    64         builder->GeneratePictographDefinitionsL();
       
    65         builder->GeneratePictographRangeL();
       
    66         }
       
    67 
       
    68     CleanupStack::PopAndDestroy( 2 ); // args, builder
       
    69 
       
    70     }
       
    71 
       
    72 /**
       
    73 * Main function.
       
    74 */
       
    75 TInt E32Main()
       
    76     {
       
    77     CTrapCleanup* trap = CTrapCleanup::New();
       
    78     if ( !trap ) return KErrNoMemory;
       
    79 
       
    80     TInt ret = KErrNone;
       
    81 
       
    82     if (ret == KErrNone) 
       
    83         {
       
    84         FbsStartup();
       
    85 
       
    86         RFbsSession session;    
       
    87         session.Connect();
       
    88 
       
    89         // trap harness
       
    90         TRAP( ret, ExecuteL() );
       
    91         session.Disconnect();
       
    92         }
       
    93     delete trap;
       
    94     return ret;
       
    95     }
       
    96 
       
    97 // End of File