contextframework/cfwplugins/PSStateSourcePlugIn/src/textpair.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2007-2007 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:  Encapsulates uid and name.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "textpair.h"
       
    20 
       
    21 
       
    22 // ======== MEMBER FUNCTIONS ========
       
    23 
       
    24 CTextPair::CTextPair( ) 
       
    25     {
       
    26     }
       
    27 
       
    28 void CTextPair::ConstructL( const TDesC& aText1, const TDesC& aText2 )
       
    29     {
       
    30     iText1 = aText1.AllocL();
       
    31     iText2 = aText2.AllocL();
       
    32     }
       
    33 
       
    34 CTextPair* CTextPair::NewL( const TDesC& aText1, const TDesC& aText2 )
       
    35     {
       
    36     CTextPair* self = CTextPair::NewLC( aText1, aText2 );
       
    37     CleanupStack::Pop( self );
       
    38 
       
    39     return self;
       
    40     }
       
    41 
       
    42 CTextPair* CTextPair::NewLC( const TDesC& aText1, const TDesC& aText2 )
       
    43     {
       
    44     CTextPair* self = new( ELeave ) CTextPair( );
       
    45     CleanupStack::PushL( self );
       
    46     self->ConstructL( aText1, aText2 );
       
    47 
       
    48     return self;
       
    49     }
       
    50 
       
    51 CTextPair::~CTextPair()
       
    52     {
       
    53     delete iText1;
       
    54     delete iText2;
       
    55     }
       
    56 
       
    57 
       
    58 //-----------------------------------------------------------------------------
       
    59 // CTextPair::Text1
       
    60 //-----------------------------------------------------------------------------
       
    61 //
       
    62 const TDesC& CTextPair::Text1() const
       
    63     {
       
    64     if( !iText1 )
       
    65         {
       
    66         return KNullDesC;
       
    67         }
       
    68     else
       
    69         {
       
    70         return *iText1;
       
    71         }
       
    72     }
       
    73 
       
    74 //-----------------------------------------------------------------------------
       
    75 // CTextPair::Text2
       
    76 //-----------------------------------------------------------------------------
       
    77 //
       
    78 const TDesC& CTextPair::Text2() const
       
    79     {
       
    80     if( !iText2 )
       
    81         {
       
    82         return KNullDesC;
       
    83         }
       
    84     else
       
    85         {
       
    86         return *iText2;
       
    87         }
       
    88     }