landmarks/locationlandmarks/converter/src/EPos_CPosLmParsedLmBuffer.cpp
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 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: Class for holding landmarks and landmark categories while parsing
       
    15 * a Landmark XML file to a landmark(s).
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "EPos_CPosLmParsedLmBuffer.h"
       
    23 
       
    24 // ================= MEMBER FUNCTIONS =======================
       
    25 
       
    26 // C++ default constructor can NOT contain any code, that
       
    27 // might leave.
       
    28 //
       
    29 CPosLmParsedLmBuffer::CPosLmParsedLmBuffer()
       
    30     {
       
    31     }
       
    32 
       
    33 // EPOC default constructor can leave.
       
    34 void CPosLmParsedLmBuffer::ConstructL(
       
    35     CPosLandmark& aLm,
       
    36     RPointerArray<CPosLandmarkCategory>& aLmCategories)
       
    37     {
       
    38     iLandmark = CPosLandmark::NewL(aLm);
       
    39     for (TInt i=0; i<aLmCategories.Count(); i++)
       
    40         {
       
    41         User::LeaveIfError(iLandmarkCategories.Append(aLmCategories[i]));
       
    42         }
       
    43     }
       
    44 
       
    45 // Two-phased constructor.
       
    46 CPosLmParsedLmBuffer* CPosLmParsedLmBuffer::NewLC(
       
    47     CPosLandmark& aLm,
       
    48     RPointerArray<CPosLandmarkCategory>& aLmCategories)
       
    49     {
       
    50     CPosLmParsedLmBuffer* self = new (ELeave) CPosLmParsedLmBuffer();
       
    51     CleanupStack::PushL(self);
       
    52     self->ConstructL(aLm, aLmCategories);
       
    53     return self;
       
    54     }
       
    55 
       
    56 // Destructor
       
    57 CPosLmParsedLmBuffer::~CPosLmParsedLmBuffer()
       
    58     {
       
    59     delete iLandmark;
       
    60     iLandmarkCategories.ResetAndDestroy();
       
    61     iLandmarkCategories.Close();
       
    62     }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CPosLmParsedLmBuffer::Landmark
       
    66 //
       
    67 // (other items were commented in a header).
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 CPosLandmark* CPosLmParsedLmBuffer::Landmark() const
       
    71     {
       
    72     return iLandmark;
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CPosLmParsedLmBuffer::Categories
       
    77 //
       
    78 // (other items were commented in a header).
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 RPointerArray<CPosLandmarkCategory> CPosLmParsedLmBuffer::Categories() const
       
    82     {
       
    83     return iLandmarkCategories;
       
    84     }
       
    85 
       
    86 //  End of File