ncdengine/provider/protocol/src/ncdstring.cpp
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     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:   CNcdString implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "ncdstring.h"
       
    20 #include "catalogsutils.h"
       
    21 
       
    22 CNcdString* CNcdString::NewLC( const TDesC& aKey,
       
    23                                const TDesC& aData )
       
    24     {
       
    25     CNcdString* self = new(ELeave) CNcdString;
       
    26     CleanupStack::PushL( self );
       
    27     self->ConstructL( aKey, aData );
       
    28     return self;
       
    29     }
       
    30 
       
    31 CNcdString* CNcdString::NewL( const TDesC& aKey,
       
    32                               const TDesC& aData )
       
    33     {
       
    34     CNcdString* self = NewLC( aKey, aData );
       
    35     CleanupStack::Pop( self );
       
    36     return self;
       
    37     }
       
    38 
       
    39 CNcdString* CNcdString::NewLC( RReadStream& aStream )
       
    40     {
       
    41     CNcdString* self = new(ELeave) CNcdString;
       
    42     CleanupStack::PushL( self );
       
    43     self->ConstructL( aStream );
       
    44     return self;
       
    45     }
       
    46 
       
    47 CNcdString* CNcdString::NewL( RReadStream& aStream )
       
    48     {
       
    49     CNcdString* self = NewLC( aStream );
       
    50     CleanupStack::Pop( self );
       
    51     return self;
       
    52     }
       
    53     
       
    54 CNcdString* CNcdString::NewL( const CNcdString& aString ) 
       
    55     {
       
    56     CNcdString* self = NewLC( aString );
       
    57     CleanupStack::Pop( self );
       
    58     return self;
       
    59     }
       
    60     
       
    61 CNcdString* CNcdString::NewLC( const CNcdString& aString )
       
    62     {
       
    63     CNcdString* self = new( ELeave ) CNcdString;
       
    64     CleanupStack::PushL( self );
       
    65     self->ConstructL( aString );
       
    66     return self;
       
    67     }
       
    68 
       
    69 
       
    70 CNcdString::CNcdString()
       
    71     {
       
    72     }
       
    73 
       
    74 void CNcdString::ConstructL( const TDesC& aKey, const TDesC& aData )
       
    75     {
       
    76     SetKeyL( aKey );
       
    77     SetDataL( aData );
       
    78     }
       
    79 
       
    80 void CNcdString::ConstructL( RReadStream& aStream )
       
    81     {
       
    82     InternalizeL( aStream );
       
    83     }
       
    84     
       
    85 void CNcdString::ConstructL( const CNcdString& aString ) 
       
    86     {
       
    87     SetKeyL( aString.Key() );
       
    88     SetDataL( aString.Data() );
       
    89     }
       
    90 
       
    91 CNcdString::~CNcdString()
       
    92     {
       
    93     delete iKey;
       
    94     delete iData;
       
    95     }
       
    96 
       
    97 
       
    98 const TDesC& CNcdString::Key() const
       
    99     {
       
   100     return *iKey;
       
   101     }
       
   102 
       
   103 const TDesC& CNcdString::Data() const
       
   104     {
       
   105     return *iData;
       
   106     }
       
   107 
       
   108 void CNcdString::SetDataL( const TDesC8& aData )
       
   109     {
       
   110     AssignDesL( iData, aData );
       
   111     }
       
   112 
       
   113 void CNcdString::SetKeyL( const TDesC8& aKey )
       
   114     {
       
   115     AssignDesL( iKey, aKey );
       
   116     }
       
   117 
       
   118 void CNcdString::SetDataL( const TDesC16& aData )
       
   119     {
       
   120     AssignDesL( iData, aData );
       
   121     }
       
   122 
       
   123 void CNcdString::SetKeyL( const TDesC16& aKey )
       
   124     {
       
   125     AssignDesL( iKey, aKey );
       
   126     }
       
   127 
       
   128 
       
   129 void CNcdString::ExternalizeL( RWriteStream& aStream ) const
       
   130     {
       
   131     ExternalizeDesL( *iKey, aStream );
       
   132     ExternalizeDesL( *iData, aStream );
       
   133     } 
       
   134 
       
   135 void CNcdString::InternalizeL( RReadStream& aStream )
       
   136     {
       
   137     InternalizeDesL( iKey, aStream );
       
   138     InternalizeDesL( iData, aStream );
       
   139     }