|
1 /* |
|
2 * Copyright (c) 2008 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 ChspsByteBuffer. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "hspsbytebuffer.h" |
|
20 |
|
21 //---------------------------------------------------------------------------- |
|
22 // ChspsByteBuffer::~ChspsByteBuffer |
|
23 // ---------------------------------------------------------------------------- |
|
24 // |
|
25 ChspsByteBuffer::~ChspsByteBuffer() |
|
26 { |
|
27 delete[] iBuffer; |
|
28 iBuffer = NULL; |
|
29 } |
|
30 |
|
31 //---------------------------------------------------------------------------- |
|
32 // ChspsByteBuffer::NewL |
|
33 // ---------------------------------------------------------------------------- |
|
34 // |
|
35 ChspsByteBuffer* ChspsByteBuffer::NewL( const TInt aSize ) |
|
36 { |
|
37 ChspsByteBuffer* self = new (ELeave) ChspsByteBuffer(); |
|
38 CleanupStack::PushL( self ); |
|
39 self->ConstructL( aSize ); |
|
40 CleanupStack::Pop( self ); |
|
41 return self; |
|
42 } |
|
43 |
|
44 //---------------------------------------------------------------------------- |
|
45 // ChspsByteBuffer::Buffer |
|
46 // ---------------------------------------------------------------------------- |
|
47 // |
|
48 TUint8* ChspsByteBuffer::Buffer() |
|
49 { |
|
50 return iBuffer; |
|
51 } |
|
52 |
|
53 //---------------------------------------------------------------------------- |
|
54 // ChspsByteBuffer::Size |
|
55 // ---------------------------------------------------------------------------- |
|
56 // |
|
57 TInt ChspsByteBuffer::Size() |
|
58 { |
|
59 return iSize; |
|
60 } |
|
61 |
|
62 //---------------------------------------------------------------------------- |
|
63 // ChspsByteBuffer::ChspsByteBuffer |
|
64 // ---------------------------------------------------------------------------- |
|
65 // |
|
66 ChspsByteBuffer::ChspsByteBuffer() |
|
67 { |
|
68 // No implementation required |
|
69 } |
|
70 |
|
71 //---------------------------------------------------------------------------- |
|
72 // ChspsByteBuffer::ConstructL |
|
73 // ---------------------------------------------------------------------------- |
|
74 // |
|
75 void ChspsByteBuffer::ConstructL( const TInt aSize ) |
|
76 { |
|
77 if( aSize <= 0 ) |
|
78 { |
|
79 User::Leave( KErrArgument ); |
|
80 } |
|
81 |
|
82 iBuffer = new (ELeave) TUint8[ aSize ]; |
|
83 iSize = aSize; |
|
84 } |