multimediacommsengine/tsrc/MCETestUI/MCETestUIEngine/src/CMCETestUIQuestionDataQuery.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2004 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:    Implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 //INCLUDES
       
    22 
       
    23 #include "CMCETestUIQuestionDataQuery.h"
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // CMCETestUIQuestionDataQuery::NewL
       
    27 // -----------------------------------------------------------------------------
       
    28 //
       
    29 CMCETestUIQuestionDataQuery* CMCETestUIQuestionDataQuery::NewLC()
       
    30     {
       
    31 
       
    32     CMCETestUIQuestionDataQuery* self = 
       
    33             new (ELeave) CMCETestUIQuestionDataQuery();
       
    34     CleanupStack::PushL( self );
       
    35     return self;  
       
    36     }
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CMCETestUIQuestionDataQuery::CMCETestUIQuestionDataQuery
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 CMCETestUIQuestionDataQuery::CMCETestUIQuestionDataQuery() 
       
    43 	{
       
    44 	}
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // CMCETestUIQuestionDataQuery::~CMCETestUIQuestionDataQuery
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 EXPORT_C CMCETestUIQuestionDataQuery::~CMCETestUIQuestionDataQuery()
       
    51 	{
       
    52 	delete iAnswer8;
       
    53 	delete iAnswer;
       
    54 	delete iDefaultValue;
       
    55 	}
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // CMCETestUIQuestionDataQuery::SetAnswerL
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 EXPORT_C void CMCETestUIQuestionDataQuery::SetAnswerL( const TDesC16& aAnswer )
       
    62     {
       
    63     delete iAnswer8;
       
    64     delete iAnswer;
       
    65     iAnswer = aAnswer.AllocL();
       
    66     iAnswer8 = HBufC8::NewL( iAnswer->Length() );
       
    67     TPtr8 ptrAnswer8 = iAnswer8->Des();
       
    68     ptrAnswer8.Copy( *iAnswer );  
       
    69     }
       
    70 
       
    71 // -----------------------------------------------------------------------------
       
    72 // CMCETestUIQuestionDataQuery::Answer
       
    73 // -----------------------------------------------------------------------------
       
    74 //
       
    75 const TDesC16& CMCETestUIQuestionDataQuery::Answer() const
       
    76     {
       
    77     if ( iAnswer )
       
    78         {
       
    79         return *iAnswer;
       
    80         }
       
    81     return KNullDesC16;    
       
    82     }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // CMCETestUIQuestionDataQuery::Answer8
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 const TDesC8& CMCETestUIQuestionDataQuery::Answer8() const
       
    89     {
       
    90     if ( iAnswer8 )
       
    91         {
       
    92         return *iAnswer8;
       
    93         }
       
    94     return KNullDesC8;    
       
    95     }   
       
    96 
       
    97 // -----------------------------------------------------------------------------
       
    98 // CMCETestUIQuestionDataQuery::DefaultValue
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 EXPORT_C const TDesC& CMCETestUIQuestionDataQuery::DefaultValue() const
       
   102     {
       
   103     if ( iDefaultValue )
       
   104         {    
       
   105         return *iDefaultValue;    
       
   106         }
       
   107     return KNullDesC;
       
   108     }
       
   109 
       
   110 // -----------------------------------------------------------------------------
       
   111 // CMCETestUIQuestionDataQuery::SetDefaultValueL
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 void CMCETestUIQuestionDataQuery::SetDefaultValueL( 
       
   115             const TDesC16& aDefaultValue )
       
   116     {
       
   117     delete iDefaultValue;
       
   118     iDefaultValue = aDefaultValue.AllocL(); 
       
   119     }
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 // CMCETestUIQuestionDataQuery::SetDefaultValueL
       
   123 // -----------------------------------------------------------------------------
       
   124 //
       
   125 void CMCETestUIQuestionDataQuery::SetDefaultValueL( const TDesC8& aDefaultValue )
       
   126     {
       
   127     delete iDefaultValue;
       
   128     HBufC* tmp = HBufC::NewL( aDefaultValue.Length() );
       
   129     TPtr ptr = tmp->Des(); 
       
   130     ptr.Copy( aDefaultValue );
       
   131     iDefaultValue = tmp; 
       
   132     }
       
   133 
       
   134 
       
   135 
       
   136 // End of File