javamanager/javaregistry/client/src/javaattribute.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 23 Jun 2010 18:07:10 +0300
changeset 47 f40128debb5d
parent 21 2a9601315dfc
child 83 26b2b12093af
permissions -rw-r--r--
Revision: v2.2.2 Kit: 2010125

/*
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  CJavaAttribute implementation
*
*/


#include "javaattribute.h"

using namespace Java;

// ============================ MEMBER FUNCTIONS ==============================

// ---------------------------------------------------------------------------
// CJavaAttribute::NewL
// Constructs a CJavaAttribute object.
// ---------------------------------------------------------------------------
EXPORT_C CJavaAttribute* CJavaAttribute::
NewL(const TDesC& aName, const TDesC& aValue, TBool aTrusted)
{
    CJavaAttribute* self = CJavaAttribute::NewLC(aName, aValue, aTrusted);
    CleanupStack::Pop(self);
    return self;
}

// ---------------------------------------------------------------------------
// CJavaAttribute::NewLC
// Constructs a CJavaAttribute object.
// ---------------------------------------------------------------------------
EXPORT_C CJavaAttribute* CJavaAttribute::
NewLC(const TDesC& aName, const TDesC& aValue, TBool aTrusted)
{
    if (aName == KNullDesC || aValue == KNullDesC)
    {
        User::Leave(KErrArgument);
    }
    CJavaAttribute* self = new(ELeave) CJavaAttribute;
    CleanupStack::PushL(self);
    self->ConstructL(aName, aValue, aTrusted);
    return self;
}

// ---------------------------------------------------------------------------
// CJavaAttribute::ConstructL
// ---------------------------------------------------------------------------
void CJavaAttribute::
ConstructL(const TDesC& aName, const TDesC& aValue, TBool aTrusted)
{
    iName = aName.AllocL();
    iValue = aValue.AllocL();
    iTrusted = aTrusted;
}

// ---------------------------------------------------------------------------
// CJavaAttribute::Name
// Returns name of attribute
// ---------------------------------------------------------------------------
const TDesC& CJavaAttribute::Name() const
{
    return *iName;
}

// ---------------------------------------------------------------------------
// CJavaAttribute::Value
// Returns attribute's value
// ---------------------------------------------------------------------------
const TDesC& CJavaAttribute::Value() const
{
    return *iValue;
}

// ---------------------------------------------------------------------------
// CJavaAttribute::Trusted
// Returns if attribute is trusted
// ---------------------------------------------------------------------------
TBool CJavaAttribute::Trusted() const
{
    return iTrusted;
}

// ---------------------------------------------------------------------------
// CJavaAttribute::~MJavaAttribute
// ---------------------------------------------------------------------------
EXPORT_C CJavaAttribute::~CJavaAttribute()
{
    delete iName;
    delete iValue;
}



// End of File