upnp/upnpstack/serviceframework/src/upnpdescriptionproperty.cpp
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 /** @file
       
     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:  Defines the CUpnpDescriptionProperty class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "upnpdescriptionproperty.h"
       
    21 
       
    22 // ============================ MEMBER FUNCTIONS ===============================
       
    23 
       
    24 // -----------------------------------------------------------------------------
       
    25 // CUpnpDescriptionProperty::CUpnpDescriptionProperty
       
    26 // Default C++ constructor
       
    27 // -----------------------------------------------------------------------------
       
    28 //
       
    29 CUpnpDescriptionProperty::CUpnpDescriptionProperty()
       
    30     {         
       
    31     }
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // CUpnpDescriptionProperty::NewL
       
    35 // Two-phased constructor
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 CUpnpDescriptionProperty* CUpnpDescriptionProperty::NewL( const TDesC8& aName , const TDesC8& aValue )
       
    39     {
       
    40     CUpnpDescriptionProperty* self = new ( ELeave ) CUpnpDescriptionProperty();
       
    41     CleanupStack::PushL( self );
       
    42     self->ConstructL( aName, aValue );
       
    43     CleanupStack::Pop( self );
       
    44     return self;
       
    45     }
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CUpnpDescriptionProperty::ConstructL
       
    49 // 2nd phase constructor
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 void CUpnpDescriptionProperty::ConstructL( const TDesC8& aName , const TDesC8& aValue )
       
    53     {
       
    54     iName = aName.AllocL();
       
    55     if ( &aValue )
       
    56         {
       
    57         iValue = aValue.AllocL();
       
    58         iValue->Des().TrimAll();        
       
    59         }
       
    60     else
       
    61         {
       
    62         iValue = HBufC8::NewMaxL(0);            
       
    63         }
       
    64     }
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // CUpnpDescriptionProperty::CUpnpDescriptionProperty
       
    68 // Destructor of CUpnpDescriptionProperty class
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 CUpnpDescriptionProperty::~CUpnpDescriptionProperty()
       
    72     {
       
    73     delete iName;
       
    74     delete iValue;
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CUpnpDescriptionProperty::SetNameL
       
    79 // Setter for property name 
       
    80 // -----------------------------------------------------------------------------
       
    81 //	
       
    82 void CUpnpDescriptionProperty::SetNameL( const TDesC8& aName)
       
    83     {     
       
    84     HBufC8* tmp = aName.AllocL();
       
    85     delete iName;
       
    86     iName = tmp;
       
    87     }	
       
    88 
       
    89 // -----------------------------------------------------------------------------
       
    90 // CUpnpDescriptionProperty::SetValueL
       
    91 // Setter for property value
       
    92 // -----------------------------------------------------------------------------
       
    93 //        
       
    94 void CUpnpDescriptionProperty::SetValueL(const TDesC8& aValue)
       
    95     {     
       
    96     HBufC8* tmp = aValue.AllocL();
       
    97     delete iValue;
       
    98     iValue = tmp;
       
    99     }
       
   100 
       
   101 // -----------------------------------------------------------------------------
       
   102 // CUpnpDescriptionProperty::Name
       
   103 // Getter for property name 
       
   104 // -----------------------------------------------------------------------------
       
   105 //
       
   106 const TDesC8& CUpnpDescriptionProperty::Name()
       
   107     {
       
   108     return *iName;
       
   109     }
       
   110 
       
   111 // -----------------------------------------------------------------------------
       
   112 // CUpnpDescriptionProperty::Value
       
   113 // Getter for property value 
       
   114 // -----------------------------------------------------------------------------
       
   115 //    
       
   116 const TDesC8& CUpnpDescriptionProperty::Value()
       
   117     {
       
   118     return *iValue;
       
   119     }
       
   120 
       
   121 // End of File