menufw/menufwui/mmwidgets/inc/mmsubcellssetupcode.inl
changeset 0 f72a12da539e
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2009 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:  
       
    15 *  Version     : 2 << Don't touch! Updated by Synergy at check-out.
       
    16 *
       
    17 */
       
    18 
       
    19 #include "mmwidgetsconstants.h"
       
    20 
       
    21 // -----------------------------------------------------------------------------
       
    22 //
       
    23 // -----------------------------------------------------------------------------
       
    24 //
       
    25 inline TMmSubcellsSetupCode::TMmSubcellsSetupCode()
       
    26     : iCode( 0 )
       
    27     {
       
    28     }
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 inline void TMmSubcellsSetupCode::AddSubcellInfo( TSubcellType aSubcellType )
       
    35     {
       
    36     // 8 == 2 ^ KNumberOfBitsToStoreSubcellType
       
    37     __ASSERT_DEBUG( aSubcellType < 8, User::Invariant() );
       
    38     
       
    39     iCode <<= KNumberOfBitsToStoreSubcellType;
       
    40     iCode |= aSubcellType;
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 inline void TMmSubcellsSetupCode::AddTemplateInfo( TInt aTemplateIdentifier )
       
    48     {
       
    49     // 256 == 2 ^ KNumberOfBitsToStoreTemplateId
       
    50     __ASSERT_DEBUG( aTemplateIdentifier < 256, User::Invariant() );
       
    51     
       
    52     iCode <<= KNumberOfBitsToStoreTemplateId;
       
    53     iCode |= aTemplateIdentifier;
       
    54     }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 inline void TMmSubcellsSetupCode::AddIsCurrentInfo( TBool aIsCurrent )
       
    61     {
       
    62     iCode <<= KNumberOfBitsToStoreIsCurrentInfo;
       
    63     // remember that TBool is in fact an integer
       
    64     iCode |= ( aIsCurrent ? 1 : 0 );
       
    65     }
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 inline void TMmSubcellsSetupCode::Clear()
       
    72     {
       
    73     iCode = 0;
       
    74     }
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 inline TBool TMmSubcellsSetupCode::operator==(
       
    81         const TMmSubcellsSetupCode aOther ) const
       
    82     {
       
    83     return iCode == aOther.iCode;
       
    84     }
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 inline TBool TMmSubcellsSetupCode::operator!=(
       
    91         const TMmSubcellsSetupCode aOther ) const
       
    92     {
       
    93     return iCode != aOther.iCode;
       
    94     }