|
1 // DynamicBuffer.h |
|
2 // |
|
3 // Copyright (c) 2010 Accenture. All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of the "Eclipse Public License v1.0" |
|
6 // which accompanies this distribution, and is available |
|
7 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 // |
|
9 // Initial Contributors: |
|
10 // Accenture - Initial contribution |
|
11 // |
|
12 |
|
13 #if !defined(AFX_DYNAMICBUFFER_H__FC5FE4BC_8299_4843_BC15_E5B01611B9E2__INCLUDED_) |
|
14 #define AFX_DYNAMICBUFFER_H__FC5FE4BC_8299_4843_BC15_E5B01611B9E2__INCLUDED_ |
|
15 |
|
16 #if _MSC_VER > 1000 |
|
17 #pragma once |
|
18 #endif // _MSC_VER > 1000 |
|
19 |
|
20 |
|
21 class CDynamicReadBuffer |
|
22 { |
|
23 public: |
|
24 static CDynamicReadBuffer* New(int aInitialLength); |
|
25 virtual ~CDynamicReadBuffer(); |
|
26 const char* Buffer() const; |
|
27 char* Buffer(int aLength); |
|
28 private: |
|
29 CDynamicReadBuffer(); |
|
30 void Construct(int aInitialLength); |
|
31 void GrowBuf(int aNewLength); |
|
32 private: |
|
33 char* iBuf; |
|
34 int iMaxBufLength; |
|
35 }; |
|
36 |
|
37 |
|
38 class CDynamicWriteBuffer |
|
39 { |
|
40 public: |
|
41 static CDynamicWriteBuffer* New(int aInitialLength); |
|
42 virtual ~CDynamicWriteBuffer(); |
|
43 void Add(char* aBuf, int aLength); |
|
44 void Remove(int aLength); |
|
45 const char* Buffer() const; |
|
46 int Length() const; |
|
47 private: |
|
48 CDynamicWriteBuffer(); |
|
49 void Construct(int aInitialLength); |
|
50 void GrowBuf(int aNewLength); |
|
51 private: |
|
52 char* iBuf; |
|
53 int iMaxBufLength; |
|
54 int iCurrentBufLength; |
|
55 }; |
|
56 |
|
57 #endif // !defined(AFX_DYNAMICBUFFER_H__FC5FE4BC_8299_4843_BC15_E5B01611B9E2__INCLUDED_) |