syncmlfw/common/wbxml/inc/xmlelement.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 31 Aug 2010 16:04:06 +0300
branchRCL_3
changeset 25 b183ec05bd8c
parent 0 b497e44ab2fc
permissions -rw-r--r--
Revision: 201033 Kit: 201035

/*
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Base class for every element struct.
*
*/


#ifndef __XMLELEMENT_H__
#define __XMLELEMENT_H__

// ------------------------------------------------------------------------------------------------
// Includes
// ------------------------------------------------------------------------------------------------

#include <e32base.h>
#include "NSmlStack.h"

// ------------------------------------------------------------------------------------------------
// Class forwards
// ------------------------------------------------------------------------------------------------
class MWBXMLSyncMLCallbacks;
struct TXMLElementParams;

// ------------------------------------------------------------------------------------------------
// CXMLElement
// ------------------------------------------------------------------------------------------------
class CXMLElement : public CBase
	{
public:
	enum TAction 
		{
		ENone,
		EPop,
		EPopAndDestroy // Pop from stack, callback, delete
		};

	IMPORT_C CXMLElement();
	IMPORT_C virtual ~CXMLElement();

	IMPORT_C virtual void SetDataL( const TDesC8& aData );
	IMPORT_C virtual TPtrC8 Data() const;
	IMPORT_C virtual TBool Validate();
	
	IMPORT_C virtual TBool NeedsCleanup() const;
	IMPORT_C virtual CXMLElement* BeginElementL( TUint8 aTag, const TXMLElementParams& aParams );
	IMPORT_C virtual TAction EndElementL( TAny* aCallbacks, TUint8 aTag );
	};

// ------------------------------------------------------------------------------------------------
// TElementParams
// ------------------------------------------------------------------------------------------------
struct TXMLElementParams
	{
public:
	inline TXMLElementParams();
	IMPORT_C TXMLElementParams( TAny* aCallbacks, CNSmlStack<CXMLElement>* aCmdStack = 0, CNSmlStack<CXMLElement>* aCleanupStack = 0 );

	inline TAny* Callbacks() const;
	inline CNSmlStack<CXMLElement>* CmdStack() const;
	inline CNSmlStack<CXMLElement>* CleanupStack() const;
private:
	TAny* iCallbacks;
	CNSmlStack<CXMLElement>* iCmdStack;
	CNSmlStack<CXMLElement>* iCleanupStack;
	};

#include "xmlelement.inl"

#endif // __XMLELEMENT_H__