epoc32/include/gsmubuf.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
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@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.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
 @file
williamr@2
    20
*/
williamr@2
    21
williamr@2
    22
#ifndef __GSMUBUF_H__
williamr@2
    23
#define __GSMUBUF_H__
williamr@2
    24
williamr@2
    25
#include <e32std.h>
williamr@2
    26
#include <s32strm.h>
williamr@2
    27
williamr@2
    28
class CEditableText;
williamr@2
    29
class RReadStream;
williamr@2
    30
class RWriteStream;
williamr@2
    31
williamr@2
    32
williamr@2
    33
/**
williamr@2
    34
 *  The base class for all SMS buffers.
williamr@2
    35
 *  @publishedAll
williamr@2
    36
 *  @released
williamr@2
    37
 */
williamr@2
    38
class CSmsBufferBase : public CBase
williamr@2
    39
	{
williamr@2
    40
public:
williamr@2
    41
	enum
williamr@2
    42
		{
williamr@2
    43
		EMaxBufLength=0x100
williamr@2
    44
		};
williamr@2
    45
public:
williamr@2
    46
	/**
williamr@2
    47
	 *  Gets the number of characters in the buffer.
williamr@2
    48
	 *  
williamr@2
    49
	 *  	@return The number of characters in the buffer. 
williamr@2
    50
	 */
williamr@2
    51
	virtual TInt Length() const=0;
williamr@2
    52
	/**
williamr@2
    53
	 *  Extracts buffer data to a descriptor.
williamr@2
    54
	 *  
williamr@2
    55
	 *  @param aBuf On return, buffer data
williamr@2
    56
	 *  @param aPos Position within buffer to begin reading
williamr@2
    57
	 *  	@param aLength The number of bytes to read from the buffer 
williamr@2
    58
	 */
williamr@2
    59
	virtual void Extract(TDes& aBuf,TInt aPos,TInt aLength) const=0;
williamr@2
    60
	/**
williamr@2
    61
	 *  Inserts data into the buffer.
williamr@2
    62
	 *  
williamr@2
    63
	 *  @param aPos Position in the buffer to insert the data
williamr@2
    64
	 *  	@param aBuf The data to insert into the buffer 
williamr@2
    65
	 */
williamr@2
    66
	virtual void InsertL(TInt aPos,const TDesC& aBuf)=0;
williamr@2
    67
	/**
williamr@2
    68
	 *  Deletes data from the buffer.
williamr@2
    69
	 *  
williamr@2
    70
	 *  @param aPos Position in the buffer to delete the data
williamr@2
    71
	 *  	@param aLength The number of bytes to delete from the buffer 
williamr@2
    72
	 */
williamr@2
    73
	virtual void DeleteL(TInt aPos,TInt aLength)=0;
williamr@2
    74
	/** Resets the buffer. */
williamr@2
    75
	virtual void Reset()=0;
williamr@2
    76
	IMPORT_C void InternalizeL(RReadStream& aStream);
williamr@2
    77
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
williamr@2
    78
	};
williamr@2
    79
williamr@2
    80
williamr@2
    81
/**
williamr@2
    82
 *  This is the simplest implementation of CSmsBufferBase.
williamr@2
    83
 *  
williamr@2
    84
 *  It stores the buffer in an array of TTexts.
williamr@2
    85
 *  @publishedAll
williamr@2
    86
 *  @released
williamr@2
    87
 */
williamr@2
    88
class CSmsBuffer : public CSmsBufferBase
williamr@2
    89
	{
williamr@2
    90
public:
williamr@2
    91
	IMPORT_C static CSmsBuffer* NewL();
williamr@2
    92
	IMPORT_C ~CSmsBuffer();
williamr@2
    93
	IMPORT_C TInt Length() const;
williamr@2
    94
	IMPORT_C void Extract(TDes& aBuf,TInt aPos,TInt aLength) const;
williamr@2
    95
	IMPORT_C void InsertL(TInt aPos,const TDesC& aBuf);
williamr@2
    96
	IMPORT_C void DeleteL(TInt aPos,TInt aLength);
williamr@2
    97
	IMPORT_C void Reset();
williamr@2
    98
private:
williamr@2
    99
	CSmsBuffer();
williamr@2
   100
private:
williamr@2
   101
williamr@2
   102
	CArrayFix<TText>* iBuffer;
williamr@2
   103
	};
williamr@2
   104
williamr@2
   105
williamr@2
   106
/**
williamr@2
   107
 *  SMS buffer, implemented as a thin wrapper over CEditableText.
williamr@2
   108
 *  
williamr@2
   109
 *  This class is designed to be used by the Message Server, which stores SMS
williamr@2
   110
 *  text as CRichText, which is derived from CEditableText.
williamr@2
   111
 *  @publishedAll
williamr@2
   112
 *  @released
williamr@2
   113
 */
williamr@2
   114
class CSmsEditorBuffer : public CSmsBufferBase
williamr@2
   115
	{
williamr@2
   116
public:
williamr@2
   117
	IMPORT_C static CSmsEditorBuffer* NewL(CEditableText& aText);
williamr@2
   118
	IMPORT_C ~CSmsEditorBuffer();
williamr@2
   119
	IMPORT_C TInt Length() const;
williamr@2
   120
	IMPORT_C void Extract(TDes& aBuf,TInt aPos,TInt aLength) const;
williamr@2
   121
	IMPORT_C void InsertL(TInt aPos,const TDesC& aBuf);
williamr@2
   122
	IMPORT_C void DeleteL(TInt aPos,TInt aLength);
williamr@2
   123
	IMPORT_C void Reset();
williamr@2
   124
private:
williamr@2
   125
	CSmsEditorBuffer(CEditableText& aText);
williamr@2
   126
private:
williamr@2
   127
	CEditableText& iText;
williamr@2
   128
	};
williamr@2
   129
williamr@2
   130
#endif // !defined __GSMUBUF_H__