browserplugin/cpixnpplugin/src/cobjectinterface.cpp
changeset 0 ccd0fd43f247
equal deleted inserted replaced
-1:000000000000 0:ccd0fd43f247
       
     1 /*
       
     2 * Copyright (c) 2010 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 #include "CObjectInterface.h"
       
    19 #include "CCPixNPPluginEcom.h"
       
    20 #include <utf.h>
       
    21 
       
    22 
       
    23 // ============================ MEMBER FUNCTIONS ===============================
       
    24 CObjectInterface::CObjectInterface()
       
    25 	{
       
    26 	}
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 
       
    30 CObjectInterface::~CObjectInterface()
       
    31 	{
       
    32     delete [] iPropertyIdentifiers;
       
    33     delete [] iMethodIdentifiers; 
       
    34 	}
       
    35 
       
    36 void CObjectInterface::Deallocate () 
       
    37     {
       
    38     delete this; 
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 
       
    43 void CObjectInterface::SetIdentifiersL( const NPUTF8** aPropertyNames, TInt aPropertyCount, const NPUTF8** aMethodNames, TInt aMethodCount )
       
    44 	{
       
    45 	iPropertyCount = aPropertyCount;
       
    46 	if (aPropertyNames)
       
    47 	    {
       
    48 	    iPropertyIdentifiers = new (ELeave) NPIdentifier[iPropertyCount];
       
    49 	    NPN_GetStringIdentifiers( aPropertyNames, iPropertyCount, iPropertyIdentifiers );
       
    50 	    }
       
    51 	iMethodCount = aMethodCount;
       
    52 	if (aMethodNames)
       
    53 	    {
       
    54 	    iMethodIdentifiers = new (ELeave) NPIdentifier[iMethodCount];
       
    55 	    NPN_GetStringIdentifiers( aMethodNames, iMethodCount, iMethodIdentifiers );
       
    56 	    }
       
    57 	}
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 
       
    61 bool CObjectInterface::HasProperty( NPIdentifier name )
       
    62     {
       
    63     for ( TInt i= 0; i < iPropertyCount; ++i )
       
    64         {
       
    65         if ( name == iPropertyIdentifiers[i] ) return true;
       
    66         }
       
    67     return false;
       
    68     }
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 
       
    72 bool CObjectInterface::HasMethod( NPIdentifier name )
       
    73     {
       
    74     for ( TInt i= 0; i < iMethodCount; ++i )
       
    75         {
       
    76         if ( name == iMethodIdentifiers[i] ) return true;
       
    77         }
       
    78     return false;
       
    79     }
       
    80