msg_plat/smil_engine_api/inc/smiltextbuf.h
branchRCL_3
changeset 60 7fdbb852d323
parent 0 72b543305e3a
equal deleted inserted replaced
57:ebe688cedc25 60:7fdbb852d323
       
     1 /*
       
     2 * Copyright (c) 2003 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: smiltextbuf  declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef SMILTEXTBUF_H
       
    21 #define SMILTEXTBUF_H
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 class RSmilTextBuf
       
    26 	{
       
    27 public:
       
    28 	inline TInt MaxLength() const;
       
    29 	inline TPtr& Text();
       
    30 	inline const TPtr& Text() const;
       
    31 	inline void SetTextL(const TDesC &aDes);
       
    32 
       
    33 	RSmilTextBuf()
       
    34 		: iPtr(NULL,0), iText(NULL)
       
    35 		{}
       
    36 	~RSmilTextBuf()
       
    37 		{
       
    38 		delete [] iText;
       
    39 		}
       
    40 
       
    41 private:
       
    42 	TPtr iPtr;
       
    43 	TText* iText;
       
    44 	};
       
    45 
       
    46 
       
    47 inline TPtr& RSmilTextBuf::Text()
       
    48 	{return(iPtr);}
       
    49 inline const TPtr& RSmilTextBuf::Text() const
       
    50 	{return(iPtr);}
       
    51 inline TInt RSmilTextBuf::MaxLength() const
       
    52 	{return(iPtr.MaxLength());}
       
    53 inline void RSmilTextBuf::SetTextL(const TDesC &aDes)
       
    54 	{
       
    55 	if (MaxLength()<aDes.Length())
       
    56 		{
       
    57 		delete [] iText;
       
    58 		iText=NULL;
       
    59 		iPtr.Set(NULL,0,0);
       
    60 		iText=new TText[aDes.Length()+1];
       
    61 		iPtr.Set(iText,0,aDes.Length());
       
    62 		}
       
    63 	iPtr.Copy(aDes);
       
    64 	}
       
    65 
       
    66 #endif