1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // This file contains the header file of the CSmsBuffers.
36 * The base class for all SMS buffers.
40 class CSmsBufferBase : public CBase
49 * Gets the number of characters in the buffer.
51 * @return The number of characters in the buffer.
53 virtual TInt Length() const=0;
55 * Extracts buffer data to a descriptor.
57 * @param aBuf On return, buffer data
58 * @param aPos Position within buffer to begin reading
59 * @param aLength The number of bytes to read from the buffer
61 virtual void Extract(TDes& aBuf,TInt aPos,TInt aLength) const=0;
63 * Inserts data into the buffer.
65 * @param aPos Position in the buffer to insert the data
66 * @param aBuf The data to insert into the buffer
68 virtual void InsertL(TInt aPos,const TDesC& aBuf)=0;
70 * Deletes data from the buffer.
72 * @param aPos Position in the buffer to delete the data
73 * @param aLength The number of bytes to delete from the buffer
75 virtual void DeleteL(TInt aPos,TInt aLength)=0;
76 /** Resets the buffer. */
77 virtual void Reset()=0;
78 IMPORT_C void InternalizeL(RReadStream& aStream);
79 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
84 * This is the simplest implementation of CSmsBufferBase.
86 * It stores the buffer in an array of TTexts.
90 class CSmsBuffer : public CSmsBufferBase
93 IMPORT_C static CSmsBuffer* NewL();
94 IMPORT_C ~CSmsBuffer();
95 IMPORT_C TInt Length() const;
96 IMPORT_C void Extract(TDes& aBuf,TInt aPos,TInt aLength) const;
97 IMPORT_C void InsertL(TInt aPos,const TDesC& aBuf);
98 IMPORT_C void DeleteL(TInt aPos,TInt aLength);
99 IMPORT_C void Reset();
104 CArrayFix<TText>* iBuffer;
109 * SMS buffer, implemented as a thin wrapper over CEditableText.
111 * This class is designed to be used by the Message Server, which stores SMS
112 * text as CRichText, which is derived from CEditableText.
116 class CSmsEditorBuffer : public CSmsBufferBase
119 IMPORT_C static CSmsEditorBuffer* NewL(CEditableText& aText);
120 IMPORT_C ~CSmsEditorBuffer();
121 IMPORT_C TInt Length() const;
122 IMPORT_C void Extract(TDes& aBuf,TInt aPos,TInt aLength) const;
123 IMPORT_C void InsertL(TInt aPos,const TDesC& aBuf);
124 IMPORT_C void DeleteL(TInt aPos,TInt aLength);
125 IMPORT_C void Reset();
127 CSmsEditorBuffer(CEditableText& aText);
129 CEditableText& iText;
132 #endif // !defined __GSMUBUF_H__