webservices/wsxml/src/senbaseattribute.cpp
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 // INCLUDE FILES
       
    26 #include "SenBaseAttribute.h"
       
    27 #include "SenXmlUtils.h"
       
    28 
       
    29 EXPORT_C CSenBaseAttribute* CSenBaseAttribute::NewL(const TDesC8& aName,
       
    30                                                     const TDesC8& aValue)
       
    31     {
       
    32     CSenBaseAttribute* pNew = new (ELeave) CSenBaseAttribute;
       
    33     CleanupStack::PushL(pNew);
       
    34     SenXmlUtils::LeaveOnXmlEscapesL(aName);
       
    35     pNew->BaseConstructL(aName, aValue);
       
    36     CleanupStack::Pop();
       
    37     return pNew;
       
    38     }
       
    39 
       
    40 EXPORT_C CSenBaseAttribute* CSenBaseAttribute::NewL(const TDesC8& aQName,
       
    41                                                     const TDesC8& aName,
       
    42                                                     const TDesC8& aValue)
       
    43     {
       
    44     CSenBaseAttribute* pNew = new (ELeave) CSenBaseAttribute;
       
    45     CleanupStack::PushL(pNew);
       
    46     SenXmlUtils::LeaveOnInvalidElementNameL(aName);
       
    47     SenXmlUtils::LeaveOnInvalidElementNameL(aQName);
       
    48     pNew->BaseConstructL(aQName, aName, aValue);
       
    49     CleanupStack::Pop();
       
    50     return pNew;
       
    51     }
       
    52 
       
    53 
       
    54 EXPORT_C CSenBaseAttribute::CSenBaseAttribute()
       
    55     {
       
    56     }
       
    57 
       
    58 EXPORT_C void CSenBaseAttribute::BaseConstructL(const TDesC8& aName,
       
    59                                                 const TDesC8& aValue)
       
    60     {
       
    61     ipName = aName.AllocL();
       
    62     ipValue = aValue.AllocL();
       
    63     }
       
    64 
       
    65 EXPORT_C void CSenBaseAttribute::BaseConstructL(const TDesC8& aQName,
       
    66                                                 const TDesC8& /* aName */,
       
    67                                                 const TDesC8& aValue)
       
    68     {
       
    69     ipValue = aValue.AllocL();
       
    70     ipName = aQName.AllocL(); // name means nothing here..
       
    71     }
       
    72 
       
    73 
       
    74 
       
    75 EXPORT_C CSenBaseAttribute::~CSenBaseAttribute()
       
    76     {
       
    77     delete ipName;
       
    78     delete ipValue;
       
    79     }
       
    80 
       
    81 const TDesC8& CSenBaseAttribute::Name() const
       
    82     {
       
    83     return *ipName;
       
    84     }
       
    85 
       
    86 const TDesC8& CSenBaseAttribute::Value() const
       
    87     {
       
    88     return *ipValue;
       
    89     }
       
    90 
       
    91 const TDesC8& CSenBaseAttribute::SetValueL(const TDesC8& aValue)
       
    92     {
       
    93     HBufC8* pValue = aValue.AllocL();
       
    94     delete ipValue;
       
    95     ipValue = pValue;
       
    96     return *ipValue;
       
    97     }
       
    98 
       
    99 // End of File
       
   100 
       
   101