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 "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // This file contains the header file of the CSmsBuffers.
34 * The base class for all SMS buffers.
38 class CSmsBufferBase : public CBase
47 * Gets the number of characters in the buffer.
49 * @return The number of characters in the buffer.
51 virtual TInt Length() const=0;
53 * Extracts buffer data to a descriptor.
55 * @param aBuf On return, buffer data
56 * @param aPos Position within buffer to begin reading
57 * @param aLength The number of bytes to read from the buffer
59 virtual void Extract(TDes& aBuf,TInt aPos,TInt aLength) const=0;
61 * Inserts data into the buffer.
63 * @param aPos Position in the buffer to insert the data
64 * @param aBuf The data to insert into the buffer
66 virtual void InsertL(TInt aPos,const TDesC& aBuf)=0;
68 * Deletes data from the buffer.
70 * @param aPos Position in the buffer to delete the data
71 * @param aLength The number of bytes to delete from the buffer
73 virtual void DeleteL(TInt aPos,TInt aLength)=0;
74 /** Resets the buffer. */
75 virtual void Reset()=0;
76 IMPORT_C void InternalizeL(RReadStream& aStream);
77 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
82 * This is the simplest implementation of CSmsBufferBase.
84 * It stores the buffer in an array of TTexts.
88 class CSmsBuffer : public CSmsBufferBase
91 IMPORT_C static CSmsBuffer* NewL();
92 IMPORT_C ~CSmsBuffer();
93 IMPORT_C TInt Length() const;
94 IMPORT_C void Extract(TDes& aBuf,TInt aPos,TInt aLength) const;
95 IMPORT_C void InsertL(TInt aPos,const TDesC& aBuf);
96 IMPORT_C void DeleteL(TInt aPos,TInt aLength);
97 IMPORT_C void Reset();
102 CArrayFix<TText>* iBuffer;
107 * SMS buffer, implemented as a thin wrapper over CEditableText.
109 * This class is designed to be used by the Message Server, which stores SMS
110 * text as CRichText, which is derived from CEditableText.
114 class CSmsEditorBuffer : public CSmsBufferBase
117 IMPORT_C static CSmsEditorBuffer* NewL(CEditableText& aText);
118 IMPORT_C ~CSmsEditorBuffer();
119 IMPORT_C TInt Length() const;
120 IMPORT_C void Extract(TDes& aBuf,TInt aPos,TInt aLength) const;
121 IMPORT_C void InsertL(TInt aPos,const TDesC& aBuf);
122 IMPORT_C void DeleteL(TInt aPos,TInt aLength);
123 IMPORT_C void Reset();
125 CSmsEditorBuffer(CEditableText& aText);
127 CEditableText& iText;
130 #endif // !defined __GSMUBUF_H__