equal
deleted
inserted
replaced
|
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 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "config.h" |
|
20 #include "DeprecatedString.h" |
|
21 |
|
22 namespace WebCore { |
|
23 |
|
24 void DeprecatedString::setBufferFromDes(const TDesC& des) |
|
25 { |
|
26 setUnicode((const DeprecatedChar *)des.Ptr(), (unsigned)des.Length()); |
|
27 } |
|
28 |
|
29 void DeprecatedString::setBufferFromDes(const TDesC8& des) |
|
30 { |
|
31 setLatin1((const char*)des.Ptr(), (unsigned)des.Length()); |
|
32 } |
|
33 |
|
34 DeprecatedString DeprecatedString::fromDes(const TDesC& des) |
|
35 { |
|
36 DeprecatedString s; |
|
37 s.setBufferFromDes(des); |
|
38 return s; |
|
39 } |
|
40 |
|
41 DeprecatedString DeprecatedString::fromDes(const TDesC8& des) |
|
42 { |
|
43 DeprecatedString s; |
|
44 s.setBufferFromDes(des); |
|
45 return s; |
|
46 } |
|
47 |
|
48 TPtrC DeprecatedString::des() const |
|
49 { |
|
50 if (!dataHandle[0]->_isUnicodeValid) |
|
51 dataHandle[0]->makeUnicode(); |
|
52 |
|
53 TPtrC tstr((const TUint16*)unicode(), length() ); |
|
54 |
|
55 return tstr; |
|
56 } |
|
57 |
|
58 TPtrC8 DeprecatedString::des8() const |
|
59 { |
|
60 TPtrC8 tstr((const TUint8*)latin1(), length()); |
|
61 |
|
62 return tstr; |
|
63 } |
|
64 |
|
65 } |