1.1 --- a/epoc32/include/gsmubuf.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/gsmubuf.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,132 @@
1.4 -gsmubuf.h
1.5 +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// 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
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +// This file contains the header file of the CSmsBuffers.
1.19 +//
1.20 +//
1.21 +
1.22 +
1.23 +
1.24 +/**
1.25 + @file
1.26 +*/
1.27 +
1.28 +#ifndef __GSMUBUF_H__
1.29 +#define __GSMUBUF_H__
1.30 +
1.31 +#include <e32std.h>
1.32 +#include <s32strm.h>
1.33 +
1.34 +class CEditableText;
1.35 +class RReadStream;
1.36 +class RWriteStream;
1.37 +
1.38 +
1.39 +/**
1.40 + * The base class for all SMS buffers.
1.41 + * @publishedAll
1.42 + * @released
1.43 + */
1.44 +class CSmsBufferBase : public CBase
1.45 + {
1.46 +public:
1.47 + enum
1.48 + {
1.49 + EMaxBufLength=0x100
1.50 + };
1.51 +public:
1.52 + /**
1.53 + * Gets the number of characters in the buffer.
1.54 + *
1.55 + * @return The number of characters in the buffer.
1.56 + */
1.57 + virtual TInt Length() const=0;
1.58 + /**
1.59 + * Extracts buffer data to a descriptor.
1.60 + *
1.61 + * @param aBuf On return, buffer data
1.62 + * @param aPos Position within buffer to begin reading
1.63 + * @param aLength The number of bytes to read from the buffer
1.64 + */
1.65 + virtual void Extract(TDes& aBuf,TInt aPos,TInt aLength) const=0;
1.66 + /**
1.67 + * Inserts data into the buffer.
1.68 + *
1.69 + * @param aPos Position in the buffer to insert the data
1.70 + * @param aBuf The data to insert into the buffer
1.71 + */
1.72 + virtual void InsertL(TInt aPos,const TDesC& aBuf)=0;
1.73 + /**
1.74 + * Deletes data from the buffer.
1.75 + *
1.76 + * @param aPos Position in the buffer to delete the data
1.77 + * @param aLength The number of bytes to delete from the buffer
1.78 + */
1.79 + virtual void DeleteL(TInt aPos,TInt aLength)=0;
1.80 + /** Resets the buffer. */
1.81 + virtual void Reset()=0;
1.82 + IMPORT_C void InternalizeL(RReadStream& aStream);
1.83 + IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
1.84 + };
1.85 +
1.86 +
1.87 +/**
1.88 + * This is the simplest implementation of CSmsBufferBase.
1.89 + *
1.90 + * It stores the buffer in an array of TTexts.
1.91 + * @publishedAll
1.92 + * @released
1.93 + */
1.94 +class CSmsBuffer : public CSmsBufferBase
1.95 + {
1.96 +public:
1.97 + IMPORT_C static CSmsBuffer* NewL();
1.98 + IMPORT_C ~CSmsBuffer();
1.99 + IMPORT_C TInt Length() const;
1.100 + IMPORT_C void Extract(TDes& aBuf,TInt aPos,TInt aLength) const;
1.101 + IMPORT_C void InsertL(TInt aPos,const TDesC& aBuf);
1.102 + IMPORT_C void DeleteL(TInt aPos,TInt aLength);
1.103 + IMPORT_C void Reset();
1.104 +private:
1.105 + CSmsBuffer();
1.106 +private:
1.107 +
1.108 + CArrayFix<TText>* iBuffer;
1.109 + };
1.110 +
1.111 +
1.112 +/**
1.113 + * SMS buffer, implemented as a thin wrapper over CEditableText.
1.114 + *
1.115 + * This class is designed to be used by the Message Server, which stores SMS
1.116 + * text as CRichText, which is derived from CEditableText.
1.117 + * @publishedAll
1.118 + * @released
1.119 + */
1.120 +class CSmsEditorBuffer : public CSmsBufferBase
1.121 + {
1.122 +public:
1.123 + IMPORT_C static CSmsEditorBuffer* NewL(CEditableText& aText);
1.124 + IMPORT_C ~CSmsEditorBuffer();
1.125 + IMPORT_C TInt Length() const;
1.126 + IMPORT_C void Extract(TDes& aBuf,TInt aPos,TInt aLength) const;
1.127 + IMPORT_C void InsertL(TInt aPos,const TDesC& aBuf);
1.128 + IMPORT_C void DeleteL(TInt aPos,TInt aLength);
1.129 + IMPORT_C void Reset();
1.130 +private:
1.131 + CSmsEditorBuffer(CEditableText& aText);
1.132 +private:
1.133 + CEditableText& iText;
1.134 + };
1.135 +
1.136 +#endif // !defined __GSMUBUF_H__