epoc32/include/gsmubuf.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     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
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
// This file contains the header file of the CSmsBuffers.
williamr@2
    15
// 
williamr@2
    16
//
williamr@2
    17
williamr@2
    18
williamr@2
    19
williamr@2
    20
/**
williamr@2
    21
 @file
williamr@2
    22
*/
williamr@2
    23
williamr@2
    24
#ifndef __GSMUBUF_H__
williamr@2
    25
#define __GSMUBUF_H__
williamr@2
    26
williamr@2
    27
#include <e32std.h>
williamr@2
    28
#include <s32strm.h>
williamr@2
    29
williamr@2
    30
class CEditableText;
williamr@2
    31
class RReadStream;
williamr@2
    32
class RWriteStream;
williamr@2
    33
williamr@2
    34
williamr@2
    35
/**
williamr@2
    36
 *  The base class for all SMS buffers.
williamr@2
    37
 *  @publishedAll
williamr@2
    38
 *  @released
williamr@2
    39
 */
williamr@2
    40
class CSmsBufferBase : public CBase
williamr@2
    41
	{
williamr@2
    42
public:
williamr@2
    43
	enum
williamr@2
    44
		{
williamr@2
    45
		EMaxBufLength=0x100
williamr@2
    46
		};
williamr@2
    47
public:
williamr@2
    48
	/**
williamr@2
    49
	 *  Gets the number of characters in the buffer.
williamr@2
    50
	 *  
williamr@2
    51
	 *  	@return The number of characters in the buffer. 
williamr@2
    52
	 */
williamr@2
    53
	virtual TInt Length() const=0;
williamr@2
    54
	/**
williamr@2
    55
	 *  Extracts buffer data to a descriptor.
williamr@2
    56
	 *  
williamr@2
    57
	 *  @param aBuf On return, buffer data
williamr@2
    58
	 *  @param aPos Position within buffer to begin reading
williamr@2
    59
	 *  	@param aLength The number of bytes to read from the buffer 
williamr@2
    60
	 */
williamr@2
    61
	virtual void Extract(TDes& aBuf,TInt aPos,TInt aLength) const=0;
williamr@2
    62
	/**
williamr@2
    63
	 *  Inserts data into the buffer.
williamr@2
    64
	 *  
williamr@2
    65
	 *  @param aPos Position in the buffer to insert the data
williamr@2
    66
	 *  	@param aBuf The data to insert into the buffer 
williamr@2
    67
	 */
williamr@2
    68
	virtual void InsertL(TInt aPos,const TDesC& aBuf)=0;
williamr@2
    69
	/**
williamr@2
    70
	 *  Deletes data from the buffer.
williamr@2
    71
	 *  
williamr@2
    72
	 *  @param aPos Position in the buffer to delete the data
williamr@2
    73
	 *  	@param aLength The number of bytes to delete from the buffer 
williamr@2
    74
	 */
williamr@2
    75
	virtual void DeleteL(TInt aPos,TInt aLength)=0;
williamr@2
    76
	/** Resets the buffer. */
williamr@2
    77
	virtual void Reset()=0;
williamr@2
    78
	IMPORT_C void InternalizeL(RReadStream& aStream);
williamr@2
    79
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
williamr@2
    80
	};
williamr@2
    81
williamr@2
    82
williamr@2
    83
/**
williamr@2
    84
 *  This is the simplest implementation of CSmsBufferBase.
williamr@2
    85
 *  
williamr@2
    86
 *  It stores the buffer in an array of TTexts.
williamr@2
    87
 *  @publishedAll
williamr@2
    88
 *  @released
williamr@2
    89
 */
williamr@2
    90
class CSmsBuffer : public CSmsBufferBase
williamr@2
    91
	{
williamr@2
    92
public:
williamr@2
    93
	IMPORT_C static CSmsBuffer* NewL();
williamr@2
    94
	IMPORT_C ~CSmsBuffer();
williamr@2
    95
	IMPORT_C TInt Length() const;
williamr@2
    96
	IMPORT_C void Extract(TDes& aBuf,TInt aPos,TInt aLength) const;
williamr@2
    97
	IMPORT_C void InsertL(TInt aPos,const TDesC& aBuf);
williamr@2
    98
	IMPORT_C void DeleteL(TInt aPos,TInt aLength);
williamr@2
    99
	IMPORT_C void Reset();
williamr@2
   100
private:
williamr@2
   101
	CSmsBuffer();
williamr@2
   102
private:
williamr@2
   103
williamr@2
   104
	CArrayFix<TText>* iBuffer;
williamr@2
   105
	};
williamr@2
   106
williamr@2
   107
williamr@2
   108
/**
williamr@2
   109
 *  SMS buffer, implemented as a thin wrapper over CEditableText.
williamr@2
   110
 *  
williamr@2
   111
 *  This class is designed to be used by the Message Server, which stores SMS
williamr@2
   112
 *  text as CRichText, which is derived from CEditableText.
williamr@2
   113
 *  @publishedAll
williamr@2
   114
 *  @released
williamr@2
   115
 */
williamr@2
   116
class CSmsEditorBuffer : public CSmsBufferBase
williamr@2
   117
	{
williamr@2
   118
public:
williamr@2
   119
	IMPORT_C static CSmsEditorBuffer* NewL(CEditableText& aText);
williamr@2
   120
	IMPORT_C ~CSmsEditorBuffer();
williamr@2
   121
	IMPORT_C TInt Length() const;
williamr@2
   122
	IMPORT_C void Extract(TDes& aBuf,TInt aPos,TInt aLength) const;
williamr@2
   123
	IMPORT_C void InsertL(TInt aPos,const TDesC& aBuf);
williamr@2
   124
	IMPORT_C void DeleteL(TInt aPos,TInt aLength);
williamr@2
   125
	IMPORT_C void Reset();
williamr@2
   126
private:
williamr@2
   127
	CSmsEditorBuffer(CEditableText& aText);
williamr@2
   128
private:
williamr@2
   129
	CEditableText& iText;
williamr@2
   130
	};
williamr@2
   131
williamr@2
   132
#endif // !defined __GSMUBUF_H__