|
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 concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-2DDAAD1C-D9EB-5741-B6AE-2383646E0EDB" xml:lang="en"><title>Pointer |
|
13 descriptors</title><shortdesc>Describes non-modifiable pointer descriptors and modifiable pointer |
|
14 descriptors.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
15 <p>A pointer descriptor represents data which can live in ROM or RAM and this |
|
16 location is separate from the pointer descriptor object itself. </p> |
|
17 <p>A pointer descriptor is an instance of a class that encapsulates a pointer |
|
18 to the location of the data. </p> |
|
19 <p>A pointer descriptor comes in two forms: </p> |
|
20 <ul> |
|
21 <li id="GUID-A836665F-9AB7-5364-891E-6297D68B291D"><p>a non-modifiable pointer |
|
22 descriptor. </p> </li> |
|
23 <li id="GUID-C46BB0C8-08ED-5835-9516-D164383D1313"><p>a modifiable pointer |
|
24 descriptor. </p> </li> |
|
25 </ul> |
|
26 <section id="GUID-DE207726-9C75-4DD9-964A-6B7B16226C4A"><title>Non-modifiable pointer descriptor</title> <p>The data represented |
|
27 by a non-modifiable pointer descriptor can be accessed, but not changed, through |
|
28 this descriptor. </p> <p>Data is accessed through functions provided by the |
|
29 base class. </p> <p>A non-modifiable pointer descriptor is supplied in two |
|
30 variants: </p> <ul> |
|
31 <li id="GUID-CF4D06B5-B5EB-5C4D-BA87-B990053CD15D"><p>the 16 bit variant, |
|
32 a <codeph>TPtrC16</codeph>, for representing Unicode strings. </p> </li> |
|
33 <li id="GUID-A1005460-2D2A-5DB4-9414-2747056A7DBC"><p>the 8 bit variant, a <codeph>TPtrC8</codeph>, |
|
34 for representing non-Unicode strings and binary data. </p> </li> |
|
35 </ul> <p>There is also a build independent type, <codeph>TPtrC</codeph>. This |
|
36 is the type which is most commonly used in program code; the appropriate variant |
|
37 is selected at build time. </p> <p>An explicit 8 bit variant is chosen for |
|
38 binary data. The explicit 16 bit variant is rarely used. </p> <p>The base |
|
39 class, <codeph>TDesC</codeph>, contains a data member which holds the length |
|
40 of the data. The following drawing shows the layout of a <codeph>TPtrC</codeph> object |
|
41 for a string of five characters representing the English word "Hello". </p> <fig id="GUID-D3F0600A-D575-5309-8182-CFA98D184E29"> |
|
42 <image href="GUID-37D2EFAE-FB55-5015-90CE-1361144C411E_d0e195991_href.png" placement="inline"/> |
|
43 <p>Non-modifiable pointer descriptor</p> |
|
44 </fig> </section> |
|
45 <section id="GUID-33072A44-C95A-4688-AB85-019EFDC4F1B2"><title>Modifiable pointer descriptor</title> <p>The data represented |
|
46 by a modifiable pointer descriptor can be both accessed and changed through |
|
47 this descriptor. </p> <p>The length of the data can vary between zero and |
|
48 the maximum length. The maximum length of the descriptor is set by the constructor. |
|
49 When the length of the data is less than the maximum, a portion of the data |
|
50 area represented by the descriptor is unused. </p> <p>Data is accessed and |
|
51 modified through functions provided by the base classes. </p> <p>A modifiable |
|
52 pointer descriptor is supplied in two variants: </p> <ul> |
|
53 <li id="GUID-2DD694B8-8408-58F8-BE98-1D031666DEC5"><p>the 16 bit variant, |
|
54 a <codeph>TPtr16</codeph>, for representing Unicode strings. </p> </li> |
|
55 <li id="GUID-5D1EB254-6B9D-576C-9631-3461AC8FFD32"><p>the 8 bit variant, a <codeph>TPtr8</codeph>, |
|
56 for representing non-Unicode strings and binary data. </p> </li> |
|
57 </ul> <p>There is also a build independent type, <codeph>TPtr</codeph>. This |
|
58 is the type which is most commonly used in program code; the appropriate variant |
|
59 is selected at build time. </p> <p>An explicit 8 bit variant is chosen for |
|
60 binary data. The explicit 16 bit variant is rarely used. </p> <p>The base |
|
61 class <codeph>TDesC</codeph>, contains a data member that holds the length |
|
62 of the data. The base class <codeph>TDes</codeph>, contains a data member |
|
63 that holds the maximum length of the data. The following drawing shows the |
|
64 layout of a <codeph>TPtr</codeph> object for a string of five characters representing |
|
65 the English word "Hello". The maximum length to be represented by the descriptor |
|
66 is 12. </p> <fig id="GUID-B6213E7F-AE00-5854-BBB7-C82BE71CB495"> |
|
67 <image href="GUID-8983A095-3F5A-5262-8920-8A13ADD045DC_d0e196056_href.png" placement="inline"/> |
|
68 <p>Modifiable pointer descriptor</p> |
|
69 </fig> </section> |
|
70 </conbody></concept> |