syncmlfw/common/alertqueue/src/NSmlMessageItem.cpp
changeset 0 b497e44ab2fc
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     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:  Alert queue and handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "NSmlAlertQueue.h"
       
    21 
       
    22 // CONSTANTS
       
    23 const TInt CNSmlMessageItem::iOffset = _FOFF(CNSmlMessageItem,iDlink);
       
    24 
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS ===============================
       
    27 
       
    28 // ---------------------------------------------------------
       
    29 // CNSmlMessageItem::NewL( const TDesC8& aMessage, TSmlUsageType aType, 
       
    30 // TSmlProtocolVersion aVersion, TSmlTransportId aBearerType )
       
    31 // Two phase constructor
       
    32 // ---------------------------------------------------------
       
    33 //
       
    34 EXPORT_C CNSmlMessageItem* CNSmlMessageItem::NewL( 
       
    35     const TDesC8& aMessage, 
       
    36     TSmlUsageType aType, 
       
    37     TSmlProtocolVersion aVersion, 
       
    38     TSmlTransportId aBearerType )
       
    39 	{
       
    40 	CNSmlMessageItem* self = new (ELeave) CNSmlMessageItem();
       
    41 	CleanupStack::PushL(self);
       
    42 	self->ConstructL(aMessage, aType, aVersion, aBearerType );
       
    43 	CleanupStack::Pop(); //self
       
    44 	return self;
       
    45 	}
       
    46 
       
    47 // ---------------------------------------------------------
       
    48 // CNSmlMessageItem::CNSmlMessageItem()
       
    49 // Constructor
       
    50 // ---------------------------------------------------------
       
    51 CNSmlMessageItem::CNSmlMessageItem()
       
    52 : iMessage(NULL)
       
    53 	{
       
    54 	
       
    55 	}
       
    56 
       
    57 // ---------------------------------------------------------
       
    58 // CNSmlMessageItem::~CNSmlMessageItem()
       
    59 // Destructor
       
    60 // ---------------------------------------------------------
       
    61 CNSmlMessageItem::~CNSmlMessageItem()
       
    62 	{
       
    63 	delete iMessage;
       
    64 	iMessage = NULL;
       
    65 	}
       
    66 
       
    67 // ---------------------------------------------------------
       
    68 // CNSmlMessageItem::ConstructL( const TDesC8& aMessage, 
       
    69 // TSmlUsageType aType, TSmlProtocolVersion aVersion, TSmlTransportId aBearerType )
       
    70 // Second constructor
       
    71 // ---------------------------------------------------------
       
    72 void CNSmlMessageItem::ConstructL( 
       
    73     const TDesC8& aMessage, 
       
    74     TSmlUsageType aType, 
       
    75     TSmlProtocolVersion aVersion, 
       
    76     TSmlTransportId aBearerType )
       
    77 	{
       
    78 	iUsageType = aType;
       
    79 	iProtocol = aVersion; 
       
    80 	iMessage = aMessage.AllocL();
       
    81 	iBearerType = aBearerType;	
       
    82 	}
       
    83 
       
    84 // ---------------------------------------------------------
       
    85 // CNSmlMessageItem::Message()
       
    86 // Returns reference to message buffer
       
    87 // ---------------------------------------------------------
       
    88 EXPORT_C TDesC8& CNSmlMessageItem::Message()
       
    89 	{
       
    90 	return *iMessage;
       
    91 	}