msg_plat/smil_engine_api/inc/smiltextbuf.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 19 Aug 2010 09:51:11 +0300
branchRCL_3
changeset 25 fa1df4b99609
parent 0 72b543305e3a
permissions -rw-r--r--
Revision: 201031 Kit: 201033

/*
* Copyright (c) 2003 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: smiltextbuf  declaration
*
*/



#ifndef SMILTEXTBUF_H
#define SMILTEXTBUF_H

#include <e32base.h>

class RSmilTextBuf
	{
public:
	inline TInt MaxLength() const;
	inline TPtr& Text();
	inline const TPtr& Text() const;
	inline void SetTextL(const TDesC &aDes);

	RSmilTextBuf()
		: iPtr(NULL,0), iText(NULL)
		{}
	~RSmilTextBuf()
		{
		delete [] iText;
		}

private:
	TPtr iPtr;
	TText* iText;
	};


inline TPtr& RSmilTextBuf::Text()
	{return(iPtr);}
inline const TPtr& RSmilTextBuf::Text() const
	{return(iPtr);}
inline TInt RSmilTextBuf::MaxLength() const
	{return(iPtr.MaxLength());}
inline void RSmilTextBuf::SetTextL(const TDesC &aDes)
	{
	if (MaxLength()<aDes.Length())
		{
		delete [] iText;
		iText=NULL;
		iPtr.Set(NULL,0,0);
		iText=new TText[aDes.Length()+1];
		iPtr.Set(iText,0,aDes.Length());
		}
	iPtr.Copy(aDes);
	}

#endif