24
|
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".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// This file contains the header file of the CSmsBuffers.
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
*/
|
|
21 |
|
|
22 |
#ifndef __GSMUBUF_H__
|
|
23 |
#define __GSMUBUF_H__
|
|
24 |
|
|
25 |
#include <e32std.h>
|
|
26 |
#include <s32strm.h>
|
|
27 |
|
|
28 |
class CEditableText;
|
|
29 |
class RReadStream;
|
|
30 |
class RWriteStream;
|
|
31 |
|
|
32 |
|
|
33 |
/**
|
|
34 |
* The base class for all SMS buffers.
|
|
35 |
* @publishedAll
|
|
36 |
* @released
|
|
37 |
*/
|
|
38 |
class CSmsBufferBase : public CBase
|
|
39 |
{
|
|
40 |
public:
|
|
41 |
enum
|
|
42 |
{
|
|
43 |
EMaxBufLength=0x100
|
|
44 |
};
|
|
45 |
public:
|
|
46 |
/**
|
|
47 |
* Gets the number of characters in the buffer.
|
|
48 |
*
|
|
49 |
* @return The number of characters in the buffer.
|
|
50 |
*/
|
|
51 |
virtual TInt Length() const=0;
|
|
52 |
/**
|
|
53 |
* Extracts buffer data to a descriptor.
|
|
54 |
*
|
|
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
|
|
58 |
*/
|
|
59 |
virtual void Extract(TDes& aBuf,TInt aPos,TInt aLength) const=0;
|
|
60 |
/**
|
|
61 |
* Inserts data into the buffer.
|
|
62 |
*
|
|
63 |
* @param aPos Position in the buffer to insert the data
|
|
64 |
* @param aBuf The data to insert into the buffer
|
|
65 |
*/
|
|
66 |
virtual void InsertL(TInt aPos,const TDesC& aBuf)=0;
|
|
67 |
/**
|
|
68 |
* Deletes data from the buffer.
|
|
69 |
*
|
|
70 |
* @param aPos Position in the buffer to delete the data
|
|
71 |
* @param aLength The number of bytes to delete from the buffer
|
|
72 |
*/
|
|
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;
|
|
78 |
};
|
|
79 |
|
|
80 |
|
|
81 |
/**
|
|
82 |
* This is the simplest implementation of CSmsBufferBase.
|
|
83 |
*
|
|
84 |
* It stores the buffer in an array of TTexts.
|
|
85 |
* @publishedAll
|
|
86 |
* @released
|
|
87 |
*/
|
|
88 |
class CSmsBuffer : public CSmsBufferBase
|
|
89 |
{
|
|
90 |
public:
|
|
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();
|
|
98 |
private:
|
|
99 |
CSmsBuffer();
|
|
100 |
private:
|
|
101 |
|
|
102 |
CArrayFix<TText>* iBuffer;
|
|
103 |
};
|
|
104 |
|
|
105 |
|
|
106 |
/**
|
|
107 |
* SMS buffer, implemented as a thin wrapper over CEditableText.
|
|
108 |
*
|
|
109 |
* This class is designed to be used by the Message Server, which stores SMS
|
|
110 |
* text as CRichText, which is derived from CEditableText.
|
|
111 |
* @publishedAll
|
|
112 |
* @released
|
|
113 |
*/
|
|
114 |
class CSmsEditorBuffer : public CSmsBufferBase
|
|
115 |
{
|
|
116 |
public:
|
|
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();
|
|
124 |
private:
|
|
125 |
CSmsEditorBuffer(CEditableText& aText);
|
|
126 |
private:
|
|
127 |
CEditableText& iText;
|
|
128 |
};
|
|
129 |
|
|
130 |
#endif // !defined __GSMUBUF_H__
|