bluetoothapitest/bluetoothsvs/T_BTSdpAPI/src/T_DataSdpAttrValueNil.cpp
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 /*
       
     2 * Copyright (c) 2005-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 *
       
    16 */
       
    17 
       
    18 #include "T_DataSdpAttrValueNil.h"
       
    19 /*@{*/
       
    20 
       
    21 //Commands
       
    22 _LIT(KCmdNewNilL,		"NewNilL");
       
    23 _LIT(KCmdDestructor,	"~");
       
    24 /*@}*/
       
    25 
       
    26 //////////////////////////////////////////////////////////////////////
       
    27 // Construction/Destruction
       
    28 //////////////////////////////////////////////////////////////////////
       
    29 
       
    30 CT_DataSdpAttrValueNil* CT_DataSdpAttrValueNil::NewL()
       
    31 	{
       
    32 	CT_DataSdpAttrValueNil*	ret=new (ELeave) CT_DataSdpAttrValueNil();
       
    33 	CleanupStack::PushL(ret);
       
    34 	ret->ConstructL();
       
    35 	CleanupStack::Pop(ret);
       
    36 	return ret;
       
    37 	}
       
    38 
       
    39 CT_DataSdpAttrValueNil::CT_DataSdpAttrValueNil()
       
    40 :   iAttrValNil(NULL)
       
    41 	{
       
    42 	}
       
    43 
       
    44 void CT_DataSdpAttrValueNil::ConstructL()
       
    45 	{
       
    46 	}
       
    47 
       
    48 CSdpAttrValue* CT_DataSdpAttrValueNil::GetSdpAttrValue() const
       
    49 	{
       
    50 	return iAttrValNil;
       
    51 	}
       
    52 
       
    53 CT_DataSdpAttrValueNil::~CT_DataSdpAttrValueNil()
       
    54 	{
       
    55 	DestroyData();
       
    56 	}
       
    57 
       
    58 void CT_DataSdpAttrValueNil::SetObjectL(TAny* aAny)
       
    59 	{
       
    60 	DestroyData();
       
    61 	iAttrValNil = static_cast<CSdpAttrValueNil*> (aAny);
       
    62 	}
       
    63 
       
    64 void CT_DataSdpAttrValueNil::DisownObjectL()
       
    65 	{
       
    66 	iAttrValNil = NULL;
       
    67 	}
       
    68 
       
    69 void CT_DataSdpAttrValueNil::DestroyData()
       
    70 	{
       
    71 	delete iAttrValNil;
       
    72 	iAttrValNil=NULL;	
       
    73 	}
       
    74 
       
    75 inline TCleanupOperation CT_DataSdpAttrValueNil::CleanupOperation()
       
    76 	{
       
    77 	return CleanupOperation;
       
    78 	}
       
    79 
       
    80 void CT_DataSdpAttrValueNil::CleanupOperation(TAny* aAny)
       
    81 	{
       
    82 	CSdpAttrValueNil* arg=static_cast<CSdpAttrValueNil*>(aAny);
       
    83 	delete arg;
       
    84 	}
       
    85 
       
    86 /**
       
    87  * Process a command read from the ini file
       
    88  *
       
    89  * @param aCommand			The command to process
       
    90  * @param aSection			The section in the ini containing data for the command
       
    91  * @param aAsyncErrorIndex	Command index for async calls to return errors to
       
    92  *
       
    93  * @return					ETrue if the command is processed
       
    94  *
       
    95  * @leave					System wide error
       
    96  */
       
    97 TBool CT_DataSdpAttrValueNil::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
       
    98 	{
       
    99 	TBool	ret = ETrue;
       
   100 
       
   101 	if ( aCommand==KCmdNewNilL )
       
   102 		{
       
   103 		DoCmdNewNil();
       
   104 		}
       
   105 	else if ( aCommand==KCmdDestructor )
       
   106 		{
       
   107 		DoCmdDestructor();
       
   108 		}
       
   109 	else
       
   110 		{
       
   111 		ret=CT_DataSdpAttrValue::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
       
   112 		}
       
   113 
       
   114 	return ret;
       
   115 	}
       
   116 
       
   117 void CT_DataSdpAttrValueNil::DoCmdNewNil()
       
   118 	{
       
   119 	DestroyData();
       
   120 	INFO_PRINTF1(_L("CSdpAttrValueNil NewNilL Call."));
       
   121 	TRAPD(err, iAttrValNil = CSdpAttrValueNil::NewNilL());
       
   122 	if(err != KErrNone)
       
   123 		{
       
   124 		ERR_PRINTF2(_L("CSdpAttrValueNil::NewNilL failed with error %d"), err);
       
   125 		SetError(err);
       
   126 		}
       
   127 	}
       
   128 
       
   129 void CT_DataSdpAttrValueNil::DoCmdDestructor()
       
   130 	{
       
   131 	INFO_PRINTF1(_L("CSdpAttrValueNil Destructor Call."));
       
   132 	DestroyData();
       
   133 	}