|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE reference |
|
11 PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd"> |
|
12 <reference id="GUID-7FCFB114-B186-5615-9134-08612BB675EE" xml:lang="en"><title>tcharexample: |
|
13 TChar example</title><shortdesc>This example application demonstrates how to use <apiname>TChar</apiname>, <apiname>TCharF</apiname>, <apiname>TCharLC</apiname> and <apiname>TCharUC</apiname> classes.</shortdesc><prolog><metadata><keywords/></metadata></prolog><refbody> |
|
14 <section id="GUID-5EC052E8-4E6E-4F84-8F20-46C70AA6B637"> </section> |
|
15 <section id="GUID-7ECA6815-84B4-5BA0-A73F-7E2DEBE2AFFF"><title>Purpose</title> <p> <codeph>TChar</codeph> represents |
|
16 a single character. It stores the character's value as a 32-bit unsigned integer |
|
17 and it provides various functions to manipulate the character and retrieve |
|
18 its properties. </p> <p>TChar and its derived classes can be used to represent |
|
19 Unicode values outside plane <b>0</b> (that is, Unicode values within the |
|
20 extended Unicode range from <codeph>0x10000</codeph> to <codeph>0xFFFFF</codeph>). |
|
21 This differentiates them from the related class <codeph>TText</codeph>, which |
|
22 can only be used for 16-bit Unicode character values. </p> </section> |
|
23 <section id="GUID-3615DBD7-5EEA-4548-A7A8-F183E3EF3977"><title>Class summary</title><ul> |
|
24 <li><p><xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita"><apiname>TChar</apiname></xref> - Holds a character value and provides a number |
|
25 of utility functions to manipulate it and test its properties.</p></li> |
|
26 <li><p><xref href="GUID-02D39887-4F76-3C42-B9B0-61E7AB8553C3.dita"><apiname>TCharF</apiname></xref> - Folds a specified character and provides |
|
27 functions to fold additional characters after construction of the object.</p></li> |
|
28 <li><p><xref href="GUID-08D4F858-475F-3391-B2BD-2F0DAE88298A.dita"><apiname>TCharLC</apiname></xref> - Converts a specified character to lower |
|
29 case and provides functions to convert additional characters after construction |
|
30 of the object.</p></li> |
|
31 <li><p><xref href="GUID-43BDE741-3C5B-388D-BF6B-851475FB9EAE.dita"><apiname>TCharUC</apiname></xref> - Converts a specified character to upper |
|
32 case and provides functions to convert additional characters after construction |
|
33 of the object.</p></li> |
|
34 </ul></section> |
|
35 <section id="GUID-A7AA11C2-9F69-4C1F-B078-789A34B78A37"><title>Download</title> <p>Click on the following link to download |
|
36 the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-53527143-a65f-4fee-857a-6045a2c53370.zip" scope="external">tcharexample.zip</xref>.</p><p>click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-53527143-a65f-4fee-857a-6045a2c53370.html" scope="peer">browse</xref> to view the example code.</p> </section> |
|
37 <section id="GUID-6F406325-07F5-59FC-845C-F248DF0DCB3A"><title>Design and |
|
38 implementation</title> <p><b>Using TChar </b> </p> <p>The example retrieves |
|
39 information about a character using: </p> <ul> |
|
40 <li id="GUID-FEED5E65-C2E9-5F95-95A5-8AE6AACC6FAC"><p>various <codeph>Is...()</codeph> functions, |
|
41 for instance its case (e.g. <xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita#GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D/GUID-41EB7098-6282-3C9C-9C19-1DEA3C53E8F4"><apiname>TChar::IsLower()</apiname></xref>), whether |
|
42 it is alphabetic (<xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita#GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D/GUID-E166314C-A8BE-32B7-A4E6-95987A5CDB76"><apiname>TChar::IsAlpha()</apiname></xref>), a decimal digit (<xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita#GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D/GUID-1AFEF873-6968-34A5-A7DF-4E303B56FC3E"><apiname>TChar::IsDigit()</apiname></xref>), |
|
43 and whether it is printable (<xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita#GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D/GUID-A3E01D65-C348-347A-8EBA-242C9B532B3A"><apiname>TChar::IsPrint()</apiname></xref>). </p> </li> |
|
44 <li id="GUID-82028A1F-A5BC-5337-9D7A-90A9BBE35291"><p>various <codeph>Get...()</codeph> functions, |
|
45 for instance its upper, lower and title case versions, e.g. (<xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita#GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D/GUID-D51385D5-977F-313C-966D-8015400D476F"><apiname>TChar::GetUpperCase()</apiname></xref>), |
|
46 and the character width for Chinese, Japanese and Korean characters (<xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita#GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D/GUID-8BD67CC9-6BCE-348B-B46A-AD2DF71CD4F5"><apiname>TChar::GetCjkWidth()</apiname></xref>). </p> </li> |
|
47 <li id="GUID-6AFA657D-3CA9-5129-A359-38A9F4D377CE"><p>the <xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita#GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D/GUID-AF251970-9134-3F62-99E1-05A853286113"><apiname>TChar::TCharInfo</apiname></xref> struct. |
|
48 This struct holds most of the information about the character, including its |
|
49 Unicode category, and is populated by calling <xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita#GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D/GUID-0290D155-32E2-3240-A8E4-F31CD117BF9A"><apiname>TChar::GetInfo()</apiname></xref>. </p> </li> |
|
50 </ul> <p><b>Using TCharF, TCharLC and TCharUC </b> </p><p>Related APIs</p><ul> |
|
51 <li><p><xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita#GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D/GUID-8BD67CC9-6BCE-348B-B46A-AD2DF71CD4F5"><apiname>TChar::GetCjkWidth()</apiname></xref></p></li> |
|
52 <li><p><xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita#GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D/GUID-0290D155-32E2-3240-A8E4-F31CD117BF9A"><apiname>TChar::GetInfo()</apiname></xref></p></li> |
|
53 <li><p><xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita#GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D/GUID-D51385D5-977F-313C-966D-8015400D476F"><apiname>TChar::GetUpperCase()</apiname></xref></p></li> |
|
54 <li><p><xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita#GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D/GUID-E166314C-A8BE-32B7-A4E6-95987A5CDB76"><apiname>TChar::IsAlpha()</apiname></xref></p></li> |
|
55 <li><p><xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita#GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D/GUID-1AFEF873-6968-34A5-A7DF-4E303B56FC3E"><apiname>TChar::IsDigit()</apiname></xref></p></li> |
|
56 <li><p><xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita#GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D/GUID-41EB7098-6282-3C9C-9C19-1DEA3C53E8F4"><apiname>TChar::IsLower()</apiname></xref></p></li> |
|
57 <li><p><xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita#GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D/GUID-A3E01D65-C348-347A-8EBA-242C9B532B3A"><apiname>TChar::IsPrint()</apiname></xref></p></li> |
|
58 <li><p><xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita#GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D/GUID-AF251970-9134-3F62-99E1-05A853286113"><apiname>TChar::TCharInfo</apiname></xref> - A structure to hold information |
|
59 about a Unicode character.</p></li> |
|
60 </ul> <p> <xref href="GUID-02D39887-4F76-3C42-B9B0-61E7AB8553C3.dita"><apiname>TCharF</apiname></xref> represents a folded character. The example |
|
61 demonstrates how folding a character removes case and accent distinctions. </p> <p>The |
|
62 example also demonstrates converting characters between lower and upper case |
|
63 using <xref href="GUID-08D4F858-475F-3391-B2BD-2F0DAE88298A.dita"><apiname>TCharLC</apiname></xref> and <xref href="GUID-43BDE741-3C5B-388D-BF6B-851475FB9EAE.dita"><apiname>TCharUC</apiname></xref>. </p></section> |
|
64 <section id="GUID-5D7398C3-10AA-5A9F-A9EE-CE2C0E5D751F"><title>Building and |
|
65 configuring</title> <p>To build the example: </p> <ul> |
|
66 <li id="GUID-FC094F4A-A486-5539-AFAB-8319BCF9A762"><p>You can build the example |
|
67 from your IDE or the command line. </p> <p>If you use an IDE, import the <filepath>bld.inf</filepath> file |
|
68 of the example into your IDE, and use the build command of the IDE. </p> <p>If |
|
69 you use the command line, open a command prompt, and set the current directory |
|
70 to the source code directory of the example. You can then build the example |
|
71 with the SBSv1 build tools with the following commands: </p> <p><userinput>bldmake |
|
72 bldfiles</userinput> </p> <p><userinput>abld build</userinput> </p> <p> <xref href="GUID-793A5EF9-CC16-5EEB-9011-6431EA76EB15.dita">How to use bldmake</xref> and <xref href="GUID-B6B54E07-3B34-5D5C-8815-93383FA8FB4B.dita">How to use abld</xref> describe |
|
73 how to use the SBSv1 build tools. </p> </li> |
|
74 <li id="GUID-FE66EDF9-B29C-5847-828E-6399E633D131"><p>For the emulator, the |
|
75 example builds an executable called <filepath>tcharexample.exe</filepath> in |
|
76 the <filepath>epoc32\release\winscw\<udeb or urel>\</filepath> folder. </p> </li> |
|
77 </ul> </section> |
|
78 <section id="GUID-98BBBB36-DC53-5EC1-B724-1857E9C27A6F"><title>Running the |
|
79 example</title> <p>The example application displays a list of options and |
|
80 sub options to the user and takes input from the user. </p> <fig id="GUID-DE40E9EB-B045-551C-84FF-C5C116462DC2"> |
|
81 <title> Screenshot for TChar example </title> |
|
82 <image href="GUID-016704BE-DC2B-5AD3-B9BE-76A327678B38_d0e348099_href.jpg" placement="inline"/> |
|
83 </fig> </section> |
|
84 </refbody></reference> |