|
1 // Copyright (c) 2004-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 // wideascii.h - The WideAscii Class to deal with UNICODE mess |
|
15 // |
|
16 |
|
17 |
|
18 |
|
19 /** |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #ifndef __WIDENARROW_H__ |
|
24 #define __WIDENARROW_H__ |
|
25 |
|
26 // |
|
27 // WideAscii |
|
28 // ********* |
|
29 // The class is only a collection of methods. It does not |
|
30 // describe any instantiable object or variable! |
|
31 // |
|
32 // The primary premise is that the most information in the |
|
33 // internet protocols is represented as a sequence of 8 bit |
|
34 // bytes and is usually encoded as ASCII. When compiling |
|
35 // protocol modules for UNICODE variant, clashes easily occur |
|
36 // when textual ASCII data is transferred between the protocol |
|
37 // message and some generic field that has been declared without |
|
38 // explicit 8/16 specification. |
|
39 // |
|
40 // *NOTE* |
|
41 // The implementation uses the generic Copy method of the |
|
42 // standard descriptor to actually deal with the 8/16 |
|
43 // conversion. One could use the same in the code directly, |
|
44 // but it would be hard to spot those locations. The use of |
|
45 // this class documents the intentional conversions |
|
46 // |
|
47 // In addition to current simple ASCII method, one could |
|
48 // in future more complex transfers, such as UTF8. |
|
49 // |
|
50 class WideNarrow |
|
51 { |
|
52 public: |
|
53 static inline void ASCII(TDes &aDst, const TDesC &aSrc) |
|
54 { aDst = aSrc; } |
|
55 static inline void ASCII(TDes8 &aDst, const TDesC16 &aSrc) |
|
56 { aDst.Copy(aSrc); } |
|
57 static inline void ASCII(TDes16 &aDst, const TDesC8 &aSrc) |
|
58 { aDst.Copy(aSrc); } |
|
59 }; |
|
60 |
|
61 #endif |