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