contextframework/cfw/src/cfoperationpluginservices/cfscriptevent.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  CCFScriptEvent class implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDES
       
    21 #include "cfscriptevent.h"
       
    22 #include "cftrace.h"
       
    23 
       
    24 // ============================ MEMBER FUNCTIONS ===============================
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // CCFScriptEvent::CCFScriptEvent
       
    28 // C++ default constructor can NOT contain any code, that might leave.
       
    29 // -----------------------------------------------------------------------------
       
    30 //
       
    31 CCFScriptEvent::CCFScriptEvent( const TInt& aScriptId ) 
       
    32     : iScriptId( aScriptId )
       
    33     {
       
    34     FUNC_LOG;
       
    35     }
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CCFScriptEvent::ConstructL
       
    39 // Symbian 2nd phase constructor can leave.
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 void CCFScriptEvent::ConstructL( const TDesC& aIdentifier, 
       
    43     const RKeyValueArray& aParameters )
       
    44     {
       
    45     FUNC_LOG;
       
    46 
       
    47     iIdentifier = aIdentifier.AllocL();
       
    48 
       
    49     for ( TInt i = 0; i < aParameters.Count(); ++i )
       
    50         {
       
    51         iParameters.AppendL( aParameters[ i ] );
       
    52         }
       
    53     }
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CCFScriptEvent::NewL
       
    57 // Two-phased constructor.
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 EXPORT_C CCFScriptEvent* CCFScriptEvent::NewL( const TInt& aScriptId, 
       
    61     const RKeyValueArray& aParameters, 
       
    62     const TDesC& aIdentifier )
       
    63     {
       
    64     FUNC_LOG;
       
    65 
       
    66     CCFScriptEvent* event 
       
    67         = CCFScriptEvent::NewLC( aScriptId, aParameters, aIdentifier );
       
    68     CleanupStack::Pop( event );
       
    69     return event;
       
    70     }
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // CCFScriptEvent::NewLC
       
    74 // Two-phased constructor.
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 CCFScriptEvent* CCFScriptEvent::NewLC( const TInt& aScriptId, 
       
    78     const RKeyValueArray& aParameters, 
       
    79     const TDesC& aIdentifier )
       
    80     {
       
    81     FUNC_LOG;
       
    82 
       
    83     CCFScriptEvent* event = new( ELeave ) CCFScriptEvent( aScriptId );
       
    84     CleanupStack::PushL( event );
       
    85     event->ConstructL( aIdentifier, aParameters );
       
    86     return event;
       
    87     }
       
    88 
       
    89 // Destructor
       
    90 CCFScriptEvent::~CCFScriptEvent()
       
    91     {
       
    92     FUNC_LOG;
       
    93 
       
    94     iParameters.Close(); // Content is not owned.
       
    95     delete iIdentifier;
       
    96     }
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // CCFScriptEvent::ScriptId
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 EXPORT_C TInt CCFScriptEvent::ScriptId() const
       
   103     {
       
   104     FUNC_LOG;
       
   105 
       
   106     return iScriptId;
       
   107     }
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CCFScriptEvent::Identifier
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 EXPORT_C TPtrC CCFScriptEvent::Identifier() const
       
   114     {
       
   115     FUNC_LOG;
       
   116 
       
   117     return TPtrC( *iIdentifier );
       
   118     }
       
   119 
       
   120 // -----------------------------------------------------------------------------
       
   121 // CCFScriptEvent::Parameters
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 EXPORT_C const RKeyValueArray& CCFScriptEvent::Parameters() const
       
   125     {
       
   126     FUNC_LOG;
       
   127 
       
   128     return iParameters;
       
   129     }