applayerprotocols/httptransportfw/Test/T_HttpIntegration/CLabeledText.cpp
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // $Header$
       
    15 // Include Files  
       
    16 // 
       
    17 //
       
    18 
       
    19 #include <e32std.h>                     //
       
    20 
       
    21 //-----------------------------------------------------------------------------
       
    22 
       
    23 #include "CLabeledText.h"                    // This module
       
    24 
       
    25 //-----------------------------------------------------------------------------
       
    26 
       
    27 CLabeledText *CLabeledText::NewL(const TDesC& aLabel, const TDesC& aValue )
       
    28 {
       
    29 CLabeledText* self = NewLC(aLabel, aValue);
       
    30 CleanupStack::Pop();
       
    31 return self; 
       
    32 }
       
    33 
       
    34 //-----------------------------------------------------------------------------
       
    35 
       
    36 CLabeledText* CLabeledText::NewLC(const TDesC& aLabel, const TDesC& aValue )
       
    37 {
       
    38 CLabeledText* self = new (ELeave) CLabeledText();
       
    39 CleanupStack::PushL(self);
       
    40 self->ConstructL(aLabel, aValue);
       
    41 return self;
       
    42 }
       
    43 
       
    44 //-----------------------------------------------------------------------------
       
    45 
       
    46 CLabeledText::~CLabeledText()
       
    47 {
       
    48 delete iLabel;
       
    49 iLabel = NULL;
       
    50 delete iValue;
       
    51 iValue = NULL;
       
    52 }
       
    53 
       
    54 //-----------------------------------------------------------------------------
       
    55 
       
    56 void CLabeledText::ConstructL(const TDesC& aLabel, const TDesC& aValue )
       
    57 {
       
    58 iLabel = aLabel.AllocL();
       
    59 iValue = aValue.AllocL();
       
    60 }
       
    61 
       
    62 //-----------------------------------------------------------------------------
       
    63 
       
    64 TPtrC CLabeledText::Label() const
       
    65 {
       
    66 TPtrC label(iLabel->Des());
       
    67 return label;
       
    68 }
       
    69 
       
    70 //-----------------------------------------------------------------------------
       
    71 
       
    72 TPtrC CLabeledText::Value() const
       
    73 {
       
    74 TPtrC value(iValue->Des());
       
    75 return value;
       
    76 }
       
    77 
       
    78 //-----------------------------------------------------------------------------
       
    79 
       
    80 void CLabeledText::SetL(const TDesC& aValue)
       
    81 {
       
    82 delete iValue;
       
    83 iValue = NULL;
       
    84 iValue = aValue.AllocL();
       
    85 }
       
    86 
       
    87 //-----------------------------------------------------------------------------
       
    88 //  End of File  
       
    89 //-----------------------------------------------------------------------------
       
    90