xdmprotocols/src/XdmNamespace.cpp
changeset 0 c8caa15ef882
equal deleted inserted replaced
-1:000000000000 0:c8caa15ef882
       
     1 /*
       
     2 * Copyright (c) 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: CXdmNamespace
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "XdmNamespace.h"
       
    22 
       
    23 // ----------------------------------------------------
       
    24 // CXdmNamespace::CXdmNamespace
       
    25 // 
       
    26 // ----------------------------------------------------
       
    27 //
       
    28 CXdmNamespace::CXdmNamespace()
       
    29     {   
       
    30     }
       
    31 
       
    32 // ----------------------------------------------------
       
    33 // CXdmNamespace::NewL
       
    34 // 
       
    35 // ----------------------------------------------------
       
    36 //
       
    37 EXPORT_C CXdmNamespace* CXdmNamespace::NewL( const TDesC8& aUri, const TDesC8& aPrefix )
       
    38     {
       
    39     CXdmNamespace* self = new ( ELeave ) CXdmNamespace();
       
    40     CleanupStack::PushL( self );
       
    41     self->ConstructL( aUri, aPrefix );
       
    42     CleanupStack::Pop();
       
    43     return self;
       
    44     }
       
    45     
       
    46 // ----------------------------------------------------
       
    47 // CXdmNamespace::ConstructL
       
    48 // 
       
    49 // ----------------------------------------------------
       
    50 //        
       
    51 void CXdmNamespace::ConstructL( const TDesC8& aUri, const TDesC8& aPrefix )
       
    52     {
       
    53     if( aUri.Length() > 0 )
       
    54         {
       
    55         iUri = aUri.AllocL();
       
    56         iPrefix = aPrefix.AllocL();
       
    57         }
       
    58     else User::Leave( KErrArgument );
       
    59     }
       
    60 
       
    61 // ----------------------------------------------------
       
    62 // CXdmNamespace::~CXdmNamespace
       
    63 // 
       
    64 // ----------------------------------------------------
       
    65 //	    
       
    66 EXPORT_C CXdmNamespace::~CXdmNamespace()
       
    67     {
       
    68     delete iUri;
       
    69     delete iPrefix;
       
    70     }
       
    71     
       
    72 // ----------------------------------------------------
       
    73 // CXdmNamespace::Uri
       
    74 // 
       
    75 // ----------------------------------------------------
       
    76 //	
       
    77 EXPORT_C TPtrC8 CXdmNamespace::Uri() const
       
    78     {
       
    79     return iUri != NULL ? iUri->Des() : TPtrC8();
       
    80     }
       
    81 
       
    82 // ----------------------------------------------------
       
    83 // CXdmNamespace::Prefix
       
    84 // 
       
    85 // ----------------------------------------------------
       
    86 //	
       
    87 EXPORT_C TPtrC8 CXdmNamespace::Prefix() const
       
    88     {
       
    89     return iPrefix != NULL ? iPrefix->Des() : TPtrC8();
       
    90     }
       
    91 
       
    92