javamanager/javaregistry/client/src/javaattribute.cpp
branchRCL_3
changeset 19 04becd199f91
child 47 f40128debb5d
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 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:  CJavaAttribute implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "javaattribute.h"
       
    20 
       
    21 using namespace Java;
       
    22 
       
    23 // ============================ MEMBER FUNCTIONS ==============================
       
    24 
       
    25 // ---------------------------------------------------------------------------
       
    26 // CJavaAttribute::NewL
       
    27 // Constructs a CJavaAttribute object.
       
    28 // ---------------------------------------------------------------------------
       
    29 EXPORT_C CJavaAttribute* CJavaAttribute::
       
    30 NewL(const TDesC& aName, const TDesC& aValue, TBool aTrusted)
       
    31 {
       
    32     CJavaAttribute* self = CJavaAttribute::NewLC(aName, aValue, aTrusted);
       
    33     CleanupStack::Pop(self);
       
    34     return self;
       
    35 }
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // CJavaAttribute::NewLC
       
    39 // Constructs a CJavaAttribute object.
       
    40 // ---------------------------------------------------------------------------
       
    41 EXPORT_C CJavaAttribute* CJavaAttribute::
       
    42 NewLC(const TDesC& aName, const TDesC& aValue, TBool aTrusted)
       
    43 {
       
    44     if (aName == KNullDesC || aValue == KNullDesC)
       
    45     {
       
    46         User::Leave(KErrArgument);
       
    47     }
       
    48     CJavaAttribute* self = new(ELeave) CJavaAttribute;
       
    49     CleanupStack::PushL(self);
       
    50     self->ConstructL(aName, aValue, aTrusted);
       
    51     return self;
       
    52 }
       
    53 
       
    54 // ---------------------------------------------------------------------------
       
    55 // CJavaAttribute::ConstructL
       
    56 // ---------------------------------------------------------------------------
       
    57 void CJavaAttribute::
       
    58 ConstructL(const TDesC& aName, const TDesC& aValue, TBool aTrusted)
       
    59 {
       
    60     iName = aName.AllocL();
       
    61     iValue = aValue.AllocL();
       
    62     iTrusted = aTrusted;
       
    63 }
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // CJavaAttribute::Name
       
    67 // Returns name of attribute
       
    68 // ---------------------------------------------------------------------------
       
    69 const TDesC& CJavaAttribute::Name() const
       
    70 {
       
    71     return *iName;
       
    72 }
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // CJavaAttribute::Value
       
    76 // Returns attribute's value
       
    77 // ---------------------------------------------------------------------------
       
    78 const TDesC& CJavaAttribute::Value() const
       
    79 {
       
    80     return *iValue;
       
    81 }
       
    82 
       
    83 // ---------------------------------------------------------------------------
       
    84 // CJavaAttribute::Trusted
       
    85 // Returns if attribute is trusted
       
    86 // ---------------------------------------------------------------------------
       
    87 TBool CJavaAttribute::Trusted() const
       
    88 {
       
    89     return iTrusted;
       
    90 }
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // CJavaAttribute::~MJavaAttribute
       
    94 // ---------------------------------------------------------------------------
       
    95 CJavaAttribute::~CJavaAttribute()
       
    96 {
       
    97     delete iName;
       
    98     delete iValue;
       
    99 }
       
   100 
       
   101 
       
   102 
       
   103 // End of File