ncdengine/provider/protocol/src/ncd_pp_embeddeddataimpl.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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "ncd_pp_dataentity.h"
       
    20 #include "ncd_pp_embeddeddataimpl.h"
       
    21 #include "ncdprotocolutils.h"
       
    22 
       
    23 CNcdPreminetProtocolEmbeddedDataImpl* 
       
    24 CNcdPreminetProtocolEmbeddedDataImpl::NewL() 
       
    25     {
       
    26     CNcdPreminetProtocolEmbeddedDataImpl* self =
       
    27         new (ELeave) CNcdPreminetProtocolEmbeddedDataImpl;
       
    28     CleanupStack::PushL( self );
       
    29     self->ConstructL();
       
    30     CleanupStack::Pop( self );
       
    31     return self;
       
    32     }
       
    33     
       
    34 CNcdPreminetProtocolEmbeddedDataImpl* 
       
    35 CNcdPreminetProtocolEmbeddedDataImpl::NewLC() 
       
    36     {
       
    37     CNcdPreminetProtocolEmbeddedDataImpl* self =
       
    38         new (ELeave) CNcdPreminetProtocolEmbeddedDataImpl;
       
    39     CleanupStack::PushL( self );
       
    40     self->ConstructL();
       
    41     return self;
       
    42     }
       
    43  
       
    44  void CNcdPreminetProtocolEmbeddedDataImpl::ConstructL()
       
    45     {
       
    46     NcdProtocolUtils::AssignEmptyDesL( iParentId );
       
    47     NcdProtocolUtils::AssignEmptyDesL( iId );
       
    48     NcdProtocolUtils::AssignEmptyDesL( iNameSpace );
       
    49     NcdProtocolUtils::AssignEmptyDesL( iName );
       
    50     NcdProtocolUtils::AssignEmptyDesL( iTimeStamp );
       
    51     }
       
    52 
       
    53 CNcdPreminetProtocolEmbeddedDataImpl::~CNcdPreminetProtocolEmbeddedDataImpl()
       
    54     {
       
    55     delete iId;
       
    56     delete iParentId;
       
    57     delete iNameSpace;
       
    58     delete iName;
       
    59     delete iTimeStamp;
       
    60     iDataEntities.ResetAndDestroy();
       
    61     }
       
    62 
       
    63 const TDesC& CNcdPreminetProtocolEmbeddedDataImpl::ParentId() const
       
    64     {
       
    65     return *iParentId;
       
    66     }
       
    67 
       
    68 const TDesC& CNcdPreminetProtocolEmbeddedDataImpl::Id() const
       
    69     {
       
    70     return *iId;
       
    71     }
       
    72 
       
    73 const TDesC& CNcdPreminetProtocolEmbeddedDataImpl::TimeStamp() const
       
    74     {
       
    75     return *iTimeStamp;
       
    76     }
       
    77 
       
    78 const TDesC& CNcdPreminetProtocolEmbeddedDataImpl::NameSpace() const
       
    79     {
       
    80     return *iNameSpace;
       
    81     }
       
    82 
       
    83 const TDesC& CNcdPreminetProtocolEmbeddedDataImpl::Name() const
       
    84     {
       
    85     return *iName;
       
    86     }
       
    87 
       
    88 TInt CNcdPreminetProtocolEmbeddedDataImpl::DataEntityCount() const
       
    89     {
       
    90     return iDataEntities.Count();
       
    91     }
       
    92     
       
    93 const MNcdPreminetProtocolDataEntity&
       
    94     CNcdPreminetProtocolEmbeddedDataImpl::DataEntityL(TInt aIndex) const
       
    95     {
       
    96     DASSERT( aIndex >= 0 && aIndex < iDataEntities.Count() );
       
    97     if ( aIndex < 0 || aIndex >= iDataEntities.Count() ) 
       
    98         {
       
    99         User::Leave(KErrArgument);
       
   100         }
       
   101     return *iDataEntities[aIndex];
       
   102     }
       
   103 
       
   104 
       
   105