|
1 // Copyright (c) 2006-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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @publishedPartner |
|
19 */ |
|
20 |
|
21 #include <mtp/mtpdatatypeconstants.h> |
|
22 #include <mtp/tmtptypeint64.h> |
|
23 |
|
24 /** |
|
25 Default constructor. |
|
26 */ |
|
27 EXPORT_C TMTPTypeInt64::TMTPTypeInt64() : |
|
28 iData(0) |
|
29 { |
|
30 |
|
31 } |
|
32 |
|
33 /** |
|
34 Conversion constructor from native type. |
|
35 */ |
|
36 EXPORT_C TMTPTypeInt64::TMTPTypeInt64(TInt64 aData) : |
|
37 iData(aData) |
|
38 { |
|
39 |
|
40 } |
|
41 |
|
42 /** |
|
43 Destructor |
|
44 */ |
|
45 EXPORT_C TMTPTypeInt64::~TMTPTypeInt64() |
|
46 { |
|
47 |
|
48 } |
|
49 |
|
50 /** |
|
51 Sets the data type to the specified value. |
|
52 */ |
|
53 EXPORT_C void TMTPTypeInt64::Set(TInt64 aValue) |
|
54 { |
|
55 iData = aValue; |
|
56 } |
|
57 |
|
58 /** |
|
59 Provides data types's value. |
|
60 @return The value of the data type |
|
61 */ |
|
62 EXPORT_C TInt64 TMTPTypeInt64::Value() const |
|
63 { |
|
64 return iData; |
|
65 } |
|
66 |
|
67 EXPORT_C TInt TMTPTypeInt64::FirstReadChunk(TPtrC8& aChunk) const |
|
68 { |
|
69 aChunk.Set(reinterpret_cast<const TUint8*>(&iData), sizeof(iData)); |
|
70 return KMTPChunkSequenceCompletion; |
|
71 } |
|
72 |
|
73 EXPORT_C TInt TMTPTypeInt64::NextReadChunk(TPtrC8& aChunk) const |
|
74 { |
|
75 aChunk.Set(NULL, 0); |
|
76 return KErrNotReady; |
|
77 } |
|
78 |
|
79 EXPORT_C TInt TMTPTypeInt64::FirstWriteChunk(TPtr8& aChunk) |
|
80 { |
|
81 aChunk.Set(reinterpret_cast<TUint8*>(&iData), 0, sizeof(iData)); |
|
82 return KMTPChunkSequenceCompletion; |
|
83 } |
|
84 |
|
85 EXPORT_C TInt TMTPTypeInt64::NextWriteChunk(TPtr8& aChunk) |
|
86 { |
|
87 aChunk.Set(NULL, 0, 0); |
|
88 return KErrNotReady; |
|
89 } |
|
90 |
|
91 EXPORT_C TUint64 TMTPTypeInt64::Size() const |
|
92 { |
|
93 return sizeof(iData); |
|
94 } |
|
95 |
|
96 EXPORT_C TUint TMTPTypeInt64::Type() const |
|
97 { |
|
98 return EMTPTypeINT64; |
|
99 } |