javamanager/javaregistry/legacy/server/src/javaregproperty.cpp
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  javaregproperty implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "javaregproperty.h"
       
    20 
       
    21 using namespace Java::Manager::Registry;
       
    22 
       
    23 // ============================ MEMBER FUNCTIONS ==============================
       
    24 
       
    25 // ---------------------------------------------------------------------------
       
    26 // CJavaProperty::NewL
       
    27 // Constructs a java property object.
       
    28 // ---------------------------------------------------------------------------
       
    29 
       
    30 EXPORT_C CJavaProperty* CJavaProperty::NewL(TInt32 aId, const TDesC&  aValue)
       
    31 {
       
    32     CJavaProperty*  self = NewLC(aId, aValue);
       
    33     CleanupStack::Pop();
       
    34     return self;
       
    35 }
       
    36 
       
    37 
       
    38 // ---------------------------------------------------------------------------
       
    39 // CJavaProperty::NewLC
       
    40 // Constructs a java property object.
       
    41 // ---------------------------------------------------------------------------
       
    42 EXPORT_C CJavaProperty* CJavaProperty::NewLC(TInt32 aId, const TDesC&  aValue)
       
    43 {
       
    44     CJavaProperty*  self = new(ELeave) CJavaProperty();
       
    45     CleanupStack::PushL(self);
       
    46     self->ConstructL(aId, aValue);
       
    47     return self;
       
    48 }
       
    49 
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // CJavaProperty::ConstructL
       
    53 // ---------------------------------------------------------------------------
       
    54 void CJavaProperty::ConstructL(TInt32 aId, const TDesC&  aValue)
       
    55 {
       
    56     iId = aId;
       
    57     iValue = aValue.AllocL();
       
    58 }
       
    59 
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // CJavaProperty::Id
       
    63 // Returns property ID.
       
    64 // ---------------------------------------------------------------------------
       
    65 EXPORT_C TInt32 CJavaProperty::Id() const
       
    66 {
       
    67     return iId;
       
    68 }
       
    69 
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // CJavaProperty::Value
       
    73 // Returns property value.
       
    74 // ---------------------------------------------------------------------------
       
    75 EXPORT_C const TDesC& CJavaProperty::Value() const
       
    76 {
       
    77     return *iValue;
       
    78 }
       
    79 
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // operator==
       
    83 // ---------------------------------------------------------------------------
       
    84 EXPORT_C TBool CJavaProperty::operator==(const CJavaProperty& aProp)
       
    85 {
       
    86     return ((iId == aProp.Id()) &&
       
    87             (iValue->Compare(aProp.Value()) == 0));
       
    88 }
       
    89 
       
    90 
       
    91 // ---------------------------------------------------------------------------
       
    92 // CJavaProperty::~CJavaProperty
       
    93 // Destructor
       
    94 // ---------------------------------------------------------------------------
       
    95 EXPORT_C CJavaProperty::~CJavaProperty()
       
    96 {
       
    97     delete iValue;
       
    98 }
       
    99