simpleengine/xmlutils/src/simplenamespace.cpp
changeset 0 c8caa15ef882
equal deleted inserted replaced
-1:000000000000 0:c8caa15ef882
       
     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:    Simple Engine
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #include <e32std.h>
       
    24 
       
    25 #include <SenNameSpace.h>
       
    26 #include "simplenamespace.h"
       
    27 
       
    28 
       
    29 
       
    30 // ================= MEMBER FUNCTIONS =======================
       
    31 //
       
    32 
       
    33 // ----------------------------------------------------------
       
    34 // CSimpleNamespace::CSimpleNamespace
       
    35 // ----------------------------------------------------------
       
    36 //
       
    37 CSimpleNamespace::CSimpleNamespace(  )
       
    38 : iPrefix( NULL ), iUri(NULL)
       
    39     {
       
    40     }
       
    41 
       
    42 // ----------------------------------------------------------
       
    43 // CSimpleNamespace::~CSimpleNamespace
       
    44 // ----------------------------------------------------------
       
    45 //
       
    46 CSimpleNamespace::~CSimpleNamespace()
       
    47     {
       
    48     delete iPrefix;
       
    49     delete iUri;
       
    50     }
       
    51 
       
    52 // ----------------------------------------------------------
       
    53 // CSimpleNamespace::NewL
       
    54 // ----------------------------------------------------------
       
    55 //
       
    56 CSimpleNamespace* CSimpleNamespace::NewL(
       
    57     const TDesC8& aPrefix,
       
    58   const TDesC8& aUri)
       
    59     {
       
    60     CSimpleNamespace* self = new (ELeave) CSimpleNamespace( );
       
    61     CleanupStack::PushL( self );
       
    62     self->ConstructL( aPrefix, aUri );
       
    63     CleanupStack::Pop( self );
       
    64     return self;
       
    65     }
       
    66 
       
    67 // ----------------------------------------------------------
       
    68 // CSimpleNamespace::ConstructL
       
    69 // ----------------------------------------------------------
       
    70 //
       
    71 void CSimpleNamespace::ConstructL(
       
    72     const TDesC8& aPrefix,
       
    73   const TDesC8& aUri)
       
    74     {
       
    75     iUri = aUri.AllocL();
       
    76     iPrefix = aPrefix.AllocL();
       
    77     }
       
    78 
       
    79 // ----------------------------------------------------------
       
    80 // CSimpleNamespace::Close
       
    81 // ----------------------------------------------------------
       
    82 //
       
    83 void CSimpleNamespace::Close()
       
    84     {
       
    85     delete this;
       
    86     }
       
    87 
       
    88 // ----------------------------------------------------------
       
    89 // CSimpleNamespace::URI
       
    90 // ----------------------------------------------------------
       
    91 //
       
    92 TPtrC8 CSimpleNamespace::URI()
       
    93     {
       
    94     if ( iUri )
       
    95         {
       
    96         return TPtrC8(*iUri);
       
    97         }
       
    98     else
       
    99         {
       
   100         return TPtrC8();
       
   101         }
       
   102     }
       
   103 
       
   104 // ----------------------------------------------------------
       
   105 // CSimpleNamespace::Prefix
       
   106 // ----------------------------------------------------------
       
   107 //
       
   108 TPtrC8 CSimpleNamespace::Prefix()
       
   109     {
       
   110     if ( iPrefix )
       
   111         {
       
   112         return TPtrC8(*iPrefix);
       
   113         }
       
   114     else
       
   115         {
       
   116         return TPtrC8();
       
   117         }
       
   118     }
       
   119 
       
   120 // ----------------------------------------------------------
       
   121 // CSimpleNamespace::SetUriL
       
   122 // ----------------------------------------------------------
       
   123 //
       
   124 void CSimpleNamespace::SetUriL(const TDesC8& aUri)
       
   125     {
       
   126     delete iUri;
       
   127     iUri = NULL;
       
   128     iUri = aUri.AllocL();
       
   129     }
       
   130 
       
   131 // ----------------------------------------------------------
       
   132 // CSimpleNamespace::SetPrefixL
       
   133 // ----------------------------------------------------------
       
   134 //
       
   135 void CSimpleNamespace::SetPrefixL(const TDesC8& aPrefix)
       
   136     {
       
   137     delete iPrefix;
       
   138     iPrefix = NULL;
       
   139     iPrefix = aPrefix.AllocL();
       
   140     }
       
   141