supl/locationsuplfw/terminalinitiationapi/src/epos_suplterminalptrholder.cpp
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     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:   Pointer holder for client's data
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "epos_suplterminalptrholder.h"
       
    21 
       
    22 //-----------------------------------------------------------------------------
       
    23 // CSuplSubSessnPtrHolder
       
    24 //-----------------------------------------------------------------------------
       
    25 
       
    26 /**
       
    27  * Allocates and constructs a <code>CSuplSubSessnPtrHolder</code> object.
       
    28  *
       
    29  * The function leaves if there is insufficient memory.
       
    30  *
       
    31  * @publishedAll
       
    32  * @param aNumberOfPtrs is the number of modifiable pointer descriptors to
       
    33  * create. These are used for asynchronous 'get' requests.
       
    34  * @param aNumberOfPtrCs is the number of read-only pointer descriptors to
       
    35  * create. These are used for asynchronous 'set' requests.
       
    36  * @return a newly created CSuplSubSessnPtrHolder object.
       
    37  */
       
    38 EXPORT_C CSuplSubSessnPtrHolder* CSuplSubSessnPtrHolder::NewL(TInt aNumberOfPtrs,
       
    39                                                             TInt aNumberOfPtrCs)
       
    40 	{
       
    41 	CSuplSubSessnPtrHolder* self = new (ELeave) CSuplSubSessnPtrHolder;
       
    42 	CleanupStack::PushL(self);
       
    43 	self->ConstructL(aNumberOfPtrs, aNumberOfPtrCs);
       
    44 	CleanupStack::Pop(self);
       
    45 	return self;
       
    46 	}
       
    47 
       
    48 /**
       
    49  * Leaving constructor for CSuplSubSessnPtrHolder.
       
    50  *
       
    51  * @publishedAll
       
    52  * @param aNumberOfPtrs is the number of modifiable pointer descriptors to
       
    53  * create. These are used for asynchronous 'get' requests.
       
    54  * @param aNumberOfPtrCs is the number of read-only pointer descriptors to
       
    55  * create. These are used for asynchronous 'set' requests.
       
    56  */
       
    57 EXPORT_C void CSuplSubSessnPtrHolder::ConstructL(TInt aNumberOfPtrs,
       
    58                                                 TInt aNumberOfPtrCs)
       
    59 	{
       
    60 	TPtr8 ptr(NULL, 0);
       
    61 	TInt i;
       
    62 	for (i = 0; i < aNumberOfPtrs; i++)
       
    63 		{
       
    64 		User::LeaveIfError(iPtrArray.Append(ptr));
       
    65 		}
       
    66 
       
    67 	TPtrC8 ptrC(NULL, 0);
       
    68 	for (i = 0; i < aNumberOfPtrCs; i++)
       
    69 		{
       
    70 		User::LeaveIfError(iPtrCArray.Append(ptrC));
       
    71 		}
       
    72 	}
       
    73 
       
    74 /**
       
    75  * Destructor for CSuplSubSessnPtrHolder.
       
    76  *
       
    77  * @publishedAll
       
    78  */
       
    79 EXPORT_C CSuplSubSessnPtrHolder::~CSuplSubSessnPtrHolder()
       
    80 	{
       
    81 	iPtrCArray.Close();
       
    82 	iPtrArray.Close();
       
    83 	}
       
    84 
       
    85 /**
       
    86  * An accessor for the modifiable pointer descriptors.
       
    87  *
       
    88  * @publishedAll
       
    89  * @param aIndex specifies the descriptor to return.
       
    90  * @return a reference to one of our contained pointer descriptors.
       
    91  */
       
    92 EXPORT_C TPtr8& CSuplSubSessnPtrHolder::Ptr(TInt aIndex)
       
    93 	{
       
    94 	return iPtrArray[aIndex];
       
    95 	}
       
    96 
       
    97 /**
       
    98  * An accessor for the read-only pointer descriptors.
       
    99  *
       
   100  * @publishedAll
       
   101  * @param aIndex specifies the descriptor to return.
       
   102  * @return a reference to one of our contained pointer descriptors.
       
   103  */
       
   104 EXPORT_C TPtrC8& CSuplSubSessnPtrHolder::PtrC(TInt aIndex)
       
   105 	{
       
   106 	return iPtrCArray[aIndex];
       
   107 	}