imstutils/imconversationview/imcvuiapp/src/cimcvappsmilestring.cpp
branchRCL_3
changeset 22 3104fc151679
parent 21 2b7283837edb
child 23 9a48e301e94b
equal deleted inserted replaced
21:2b7283837edb 22:3104fc151679
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Class for storing one smiley with index to icon array.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "cimcvappsmilestring.h"
       
    21 #include "imcvlogger.h"
       
    22 
       
    23 // ================= MEMBER FUNCTIONS =======================
       
    24 
       
    25 // Two-phased constructor.
       
    26 CIMCVAppSmileString* CIMCVAppSmileString::NewL()
       
    27     {
       
    28     IM_CV_LOGS(TXT("CIMCVAppSmileString::NewL() start") );
       
    29     CIMCVAppSmileString* self = new (ELeave) CIMCVAppSmileString();
       
    30     IM_CV_LOGS(TXT("CIMCVAppSmileString::NewL() end") );
       
    31     return self;
       
    32     }
       
    33 
       
    34 // Destructor
       
    35 CIMCVAppSmileString::~CIMCVAppSmileString()
       
    36     {
       
    37     if(iSmiley)
       
    38 	    {
       
    39 	    delete iSmiley;
       
    40 	    iSmiley = NULL;
       
    41 	    }
       
    42 	if(iShortestSmileyString)
       
    43 		{
       
    44 	    delete iShortestSmileyString;
       
    45 	    iShortestSmileyString = NULL;
       
    46 		}
       
    47 	}
       
    48 
       
    49 // C++ constructor can NOT contain any code, that
       
    50 // might leave.
       
    51 //
       
    52 CIMCVAppSmileString::CIMCVAppSmileString()
       
    53     {
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------
       
    57 // CIMCVAppSmileString::SmileIconIndex
       
    58 // (other items were commented in a header).
       
    59 // ---------------------------------------------------------
       
    60 //
       
    61 TInt CIMCVAppSmileString::SmileIconIndex() const
       
    62 	{
       
    63 	return iIndex;
       
    64 	}
       
    65 
       
    66 // ---------------------------------------------------------
       
    67 // CIMCVAppSmileString::SmileString
       
    68 // (other items were commented in a header).
       
    69 // ---------------------------------------------------------
       
    70 //
       
    71 const TDesC& CIMCVAppSmileString::SmileString() const
       
    72     {
       
    73 	return *iSmiley;
       
    74 	}
       
    75 
       
    76 // ---------------------------------------------------------
       
    77 // CIMCVAppSmileString::Set
       
    78 // (other items were commented in a header).
       
    79 // ---------------------------------------------------------
       
    80 //
       
    81 void CIMCVAppSmileString::Set( const HBufC* aSmileyString, TInt aIndex )
       
    82 	{
       
    83 	IM_CV_LOGS(TXT("CIMCVAppSmileString::Set() start") );
       
    84 	// detect (ignore) double assignment
       
    85 	if( aSmileyString != iSmiley )
       
    86 	    {
       
    87     	delete iSmiley;
       
    88     	iSmiley = aSmileyString;
       
    89 	    }
       
    90     iIndex = aIndex;
       
    91     IM_CV_LOGS(TXT("CIMCVAppSmileString::Set() end") );
       
    92 	}
       
    93 
       
    94 // ---------------------------------------------------------
       
    95 // CIMCVAppSmileString::SetShortestSmileStringL
       
    96 // (other items were commented in a header).
       
    97 // ---------------------------------------------------------
       
    98 //
       
    99 void CIMCVAppSmileString::SetShortestSmileStringL( const TDesC& aSmileyString )
       
   100     {
       
   101     IM_CV_LOGS(TXT("CIMCVAppSmileString::SetShortestSmileStringL() start") );
       
   102     HBufC* temp = aSmileyString.AllocL();
       
   103     delete iShortestSmileyString;
       
   104     iShortestSmileyString = temp;
       
   105     IM_CV_LOGS(TXT("CIMCVAppSmileString::SetShortestSmileStringL() end") );
       
   106     }
       
   107 
       
   108 // ---------------------------------------------------------
       
   109 // CIMCVAppSmileString::HasShortestString
       
   110 // (other items were commented in a header).
       
   111 // ---------------------------------------------------------
       
   112 //
       
   113 TBool CIMCVAppSmileString::HasShortestString() const
       
   114     {
       
   115     return iShortestSmileyString ? ETrue : EFalse;
       
   116     }
       
   117 
       
   118 // ---------------------------------------------------------
       
   119 // CIMCVAppSmileString::ShortestSmileString
       
   120 // (other items were commented in a header).
       
   121 // ---------------------------------------------------------
       
   122 //    
       
   123 const TDesC& CIMCVAppSmileString::ShortestSmileString() const
       
   124     {
       
   125     return *iShortestSmileyString;
       
   126     }
       
   127 // End of File