phonebookui/Phonebook2/Presentation/src/CPbk2StoreInfoItem.cpp
branchRCL_3
changeset 20 f4a778e096c2
parent 0 e686773b3f54
equal deleted inserted replaced
19:5b6f26637ad3 20:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  A class that reads PBK2_STORE_INFO_ITEM resource
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "CPbk2StoreInfoItem.h"
       
    22 #include <barsread.h>
       
    23 
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CPbk2StoreInfoItem::CPbk2StoreInfoItem
       
    29 // C++ default constructor can NOT contain any code, that
       
    30 // might leave.
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 CPbk2StoreInfoItem::CPbk2StoreInfoItem()
       
    34     {
       
    35     }
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CPbk2StoreInfoItem::ConstructL
       
    39 // Symbian 2nd phase constructor can leave.
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 void CPbk2StoreInfoItem::ConstructL(TResourceReader& aReader)
       
    43     {
       
    44     iItemType = aReader.ReadInt32();
       
    45     iItemTextSingular = aReader.ReadHBufC16L();
       
    46     iItemTextPlural = aReader.ReadHBufC16L();
       
    47     iTextType = static_cast<TPbk2StoreInfoItemTextType>(aReader.ReadInt8());
       
    48     iFlags = aReader.ReadUint32();
       
    49     }
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // CPbk2StoreInfoItem::NewLC
       
    53 // Two-phased constructor.
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 EXPORT_C CPbk2StoreInfoItem* CPbk2StoreInfoItem::NewLC(
       
    57         TResourceReader& aReader)
       
    58     {
       
    59     CPbk2StoreInfoItem* self = new( ELeave ) CPbk2StoreInfoItem;
       
    60     CleanupStack::PushL( self );
       
    61     self->ConstructL(aReader);
       
    62     return self;
       
    63     }
       
    64 
       
    65     
       
    66 // Destructor
       
    67 CPbk2StoreInfoItem::~CPbk2StoreInfoItem()
       
    68     {
       
    69     delete iItemTextSingular;
       
    70     delete iItemTextPlural;
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CPbk2StoreInfoItem::ItemType
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 EXPORT_C TInt CPbk2StoreInfoItem::ItemType() const
       
    78     {
       
    79     return iItemType;
       
    80     }
       
    81     
       
    82 // -----------------------------------------------------------------------------
       
    83 // CPbk2StoreInfoItem::ItemTextSingular
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 EXPORT_C const TDesC& CPbk2StoreInfoItem::ItemTextSingular() const
       
    87     {
       
    88     if (iItemTextSingular)
       
    89         {
       
    90         return *iItemTextSingular;
       
    91         }
       
    92     else
       
    93         {
       
    94         return KNullDesC;
       
    95         }
       
    96     }
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // CPbk2StoreInfoItem::ItemTextPlural
       
   100 // -----------------------------------------------------------------------------
       
   101 //    
       
   102 EXPORT_C const TDesC& CPbk2StoreInfoItem::ItemTextPlural() const
       
   103     {
       
   104     if (iItemTextPlural)
       
   105         {
       
   106         return *iItemTextPlural;
       
   107         }
       
   108     else
       
   109         {
       
   110         return KNullDesC;
       
   111         }
       
   112     }
       
   113     
       
   114 // -----------------------------------------------------------------------------
       
   115 // CPbk2StoreInfoItem::TextType
       
   116 // -----------------------------------------------------------------------------
       
   117 //
       
   118 EXPORT_C TPbk2StoreInfoItemTextType CPbk2StoreInfoItem::TextType() const
       
   119     {
       
   120     return iTextType;
       
   121     }
       
   122     
       
   123 // -----------------------------------------------------------------------------
       
   124 // CPbk2StoreInfoItem::Flags
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 EXPORT_C TUint32 CPbk2StoreInfoItem::Flags() const
       
   128     {
       
   129     return iFlags;
       
   130     }
       
   131     
       
   132 //  End of File