textinput/peninputcommonlayout/src/peninputshiftcapsInfo.cpp
changeset 40 2cb9bae34d17
parent 31 f1bdd6b078d1
child 49 37f5d84451bd
equal deleted inserted replaced
31:f1bdd6b078d1 40:2cb9bae34d17
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  shift&caps info implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // User includes
       
    20 #include "peninputshiftcapsInfo.h"
       
    21 
       
    22 
       
    23 // ======== MEMBER FUNCTIONS ========
       
    24 
       
    25 // ------------------------------------------------------------------------
       
    26 // CPeninputShiftCapsInfo::NewL
       
    27 // (other items were commented in a header)
       
    28 // ------------------------------------------------------------------------
       
    29 //
       
    30 EXPORT_C CPeninputShiftCapsInfo* CPeninputShiftCapsInfo::NewL( 
       
    31     TResourceReader& aReader )
       
    32     {
       
    33     CPeninputShiftCapsInfo* self = NewLC( aReader );
       
    34     CleanupStack::Pop( self );
       
    35     
       
    36     return self;
       
    37     }
       
    38 
       
    39 // ------------------------------------------------------------------------
       
    40 // CPeninputShiftCapsInfo::NewLC
       
    41 // (other items were commented in a header)
       
    42 // ------------------------------------------------------------------------
       
    43 //
       
    44 EXPORT_C CPeninputShiftCapsInfo* CPeninputShiftCapsInfo::NewLC( 
       
    45     TResourceReader& aReader )
       
    46     {
       
    47     CPeninputShiftCapsInfo* self = new ( ELeave ) CPeninputShiftCapsInfo();
       
    48 
       
    49     CleanupStack::PushL( self );
       
    50     self->ConstructL( aReader );
       
    51 
       
    52     return self;
       
    53     }
       
    54 
       
    55 // ------------------------------------------------------------------------
       
    56 // CPeninputShiftCapsInfo::~CPeninputShiftCapsInfo
       
    57 // (other items were commented in a header)
       
    58 // ------------------------------------------------------------------------
       
    59 //
       
    60 EXPORT_C CPeninputShiftCapsInfo::~CPeninputShiftCapsInfo()
       
    61     {
       
    62     iShiftCapsSingleList.ResetAndDestroy();
       
    63     iShiftCapsSingleList.Close();
       
    64     }
       
    65 
       
    66 // ------------------------------------------------------------------------
       
    67 // CPeninputShiftCapsInfo::FindShiftCapsSingleById
       
    68 // (other items were commented in a header)
       
    69 // ------------------------------------------------------------------------
       
    70 //
       
    71 EXPORT_C CPeninputShiftCapsInfo::TPeninputShiftCapsSingle* 
       
    72     CPeninputShiftCapsInfo::FindShiftCapsSingleById( TInt aId )
       
    73     {
       
    74     const TInt count = iShiftCapsSingleList.Count();
       
    75 
       
    76     for ( TInt i = 0; i < count; i++ )
       
    77         {
       
    78         if ( iShiftCapsSingleList[i]->iId == aId )
       
    79             {
       
    80             return iShiftCapsSingleList[i];
       
    81             }
       
    82         }
       
    83 
       
    84     return NULL;
       
    85     }
       
    86 
       
    87 // ------------------------------------------------------------------------
       
    88 // CPeninputShiftCapsInfo::FindShiftCapsSingleByCase
       
    89 // (other items were commented in a header)
       
    90 // ------------------------------------------------------------------------
       
    91 //
       
    92 EXPORT_C CPeninputShiftCapsInfo::TPeninputShiftCapsSingle* 
       
    93     CPeninputShiftCapsInfo::FindShiftCapsSingleByCase( TInt aCase )
       
    94     {
       
    95     const TInt count = iShiftCapsSingleList.Count();
       
    96 
       
    97     for ( TInt i = 0; i < count; i++ )
       
    98         {
       
    99         if ( iShiftCapsSingleList[i]->iCaseUsed == aCase )
       
   100             {
       
   101             return iShiftCapsSingleList[i];
       
   102             }
       
   103         }
       
   104 
       
   105     return NULL;
       
   106     }
       
   107     
       
   108 // ------------------------------------------------------------------------
       
   109 // CPeninputShiftCapsInfo::ConstructL
       
   110 // (other items were commented in a header)
       
   111 // ------------------------------------------------------------------------
       
   112 //
       
   113 void CPeninputShiftCapsInfo::ConstructL( TResourceReader& aReader )
       
   114     {
       
   115     ConstructFromResourceL( aReader );
       
   116     }
       
   117 
       
   118 // ------------------------------------------------------------------------
       
   119 // CPeninputShiftCapsInfo::ConstructFromResourceL
       
   120 // (other items were commented in a header)
       
   121 // ------------------------------------------------------------------------
       
   122 //
       
   123 void CPeninputShiftCapsInfo::ConstructFromResourceL( 
       
   124     TResourceReader& aReader )
       
   125     {
       
   126     iRangeId = aReader.ReadInt16();
       
   127 
       
   128     const TInt count = aReader.ReadInt16();
       
   129     for ( TInt i = 0; i < count; i++ )
       
   130         {
       
   131         TPeninputShiftCapsSingle* shiftCapsSingle = 
       
   132             new ( ELeave ) TPeninputShiftCapsSingle();
       
   133         
       
   134         shiftCapsSingle->iId = aReader.ReadInt16();
       
   135         shiftCapsSingle->iVkbLayoutId = aReader.ReadInt16();
       
   136         shiftCapsSingle->iCaseUsed = aReader.ReadInt16();
       
   137 
       
   138         iShiftCapsSingleList.Append( shiftCapsSingle );
       
   139         }
       
   140     }