|
1 /* |
|
2 * Copyright (c) 1998-2009 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 the License "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: |
|
15 * This file contains the implementation of the teletex string ASN1 object. |
|
16 * The teletex string includes the following characters: |
|
17 * <character set currently unknown - awaiting ITU spec> |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 #include <asn1dec.h> |
|
23 |
|
24 EXPORT_C TASN1DecTeletexString::TASN1DecTeletexString(void) |
|
25 { |
|
26 } |
|
27 |
|
28 EXPORT_C TInt TASN1DecTeletexString::CheckValid(const TDesC8& /*aSource*/) |
|
29 |
|
30 { |
|
31 return KErrNone; |
|
32 } |
|
33 |
|
34 /** |
|
35 Decodes an ASN.1 format Teletex string. |
|
36 @param aSource ASN.1 Teletex string to be decoded. |
|
37 @param aPos Offset in aSource from where decoding starts. |
|
38 @return On return, a pointer to a buffer containing the raw data converted to 16bits. |
|
39 */ |
|
40 EXPORT_C HBufC* TASN1DecTeletexString::DecodeDERL(const TDesC8& aSource,TInt& aPos) |
|
41 |
|
42 { |
|
43 TPtrC8 Source=aSource.Mid(aPos); |
|
44 TASN1DecGeneric gen(Source); |
|
45 gen.InitL(); |
|
46 HBufC* res = DecodeContentsL(gen.GetContentDER()); |
|
47 return res; |
|
48 } |
|
49 |
|
50 /** |
|
51 Decodes an ASN.1 format Teletex string. |
|
52 @param aSource ASN.1 Teletex string to be decoded. |
|
53 @return On return, a pointer to a buffer containing the raw data converted to 16bits. |
|
54 */ |
|
55 EXPORT_C HBufC* TASN1DecTeletexString::DecodeDERL(const TASN1DecGeneric& aSource) |
|
56 |
|
57 { |
|
58 return DecodeContentsL(aSource.GetContentDER()); |
|
59 } |
|
60 |
|
61 HBufC* TASN1DecTeletexString::DecodeContentsL(const TDesC8& aSource) |
|
62 { |
|
63 HBufC* res = HBufC::NewL(aSource.Length()); |
|
64 TPtr pRes = res->Des(); |
|
65 pRes.Copy(aSource); |
|
66 return res; |
|
67 } |