|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "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 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of the ClientDataBuffer class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "ClientDataBuffer.h" |
|
20 |
|
21 using namespace multimedia; |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // Contructor |
|
25 // --------------------------------------------------------------------------- |
|
26 CClientDataBuffer::CClientDataBuffer() |
|
27 : iDataBufferDes(NULL,0), |
|
28 iLastBuffer(EFalse) |
|
29 { |
|
30 } |
|
31 |
|
32 // --------------------------------------------------------------------------- |
|
33 // Second Phase Constructor |
|
34 // --------------------------------------------------------------------------- |
|
35 |
|
36 void CClientDataBuffer::ConstructL(TUint aBufferSize) |
|
37 { |
|
38 if ( aBufferSize == 0 ) |
|
39 { |
|
40 User::Leave(KErrGeneral); |
|
41 } |
|
42 |
|
43 iDataBuffer = HBufC8::NewL(aBufferSize); |
|
44 iDataBufferDes.Set(iDataBuffer->Des()); |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // NewL method |
|
49 // --------------------------------------------------------------------------- |
|
50 CClientDataBuffer* CClientDataBuffer::NewL(TUint aBufferSize) |
|
51 { |
|
52 CClientDataBuffer* self = new(ELeave) CClientDataBuffer(); |
|
53 CleanupStack::PushL(self); |
|
54 self->ConstructL(aBufferSize); |
|
55 CleanupStack::Pop(); |
|
56 return self; |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // Destructor |
|
61 // --------------------------------------------------------------------------- |
|
62 CClientDataBuffer::~CClientDataBuffer() |
|
63 { |
|
64 delete iDataBuffer; |
|
65 } |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // Returns the Pointer Descriptor for the Buffer |
|
69 // --------------------------------------------------------------------------- |
|
70 TPtr8& CClientDataBuffer::GetBufferPtr() |
|
71 { |
|
72 return iDataBufferDes; |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // Returns the Last Buffer Flag |
|
77 // --------------------------------------------------------------------------- |
|
78 TBool CClientDataBuffer::IsLastBuffer() |
|
79 { |
|
80 return iLastBuffer; |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // Sets the Last Buffer Flag |
|
85 // --------------------------------------------------------------------------- |
|
86 void CClientDataBuffer::SetLastBuffer(TBool aStatus) |
|
87 { |
|
88 iLastBuffer = aStatus; |
|
89 } |
|
90 |
|
91 // End of file |