|
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-FBE448A4-4728-5EE5-84F2-4790735857B3" xml:lang="en"><title>Basic |
|
13 Types Overview</title><shortdesc>This document is an overview of the basic types.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <section id="GUID-2307C342-3787-4B91-A57E-D5E1A65A48D4"><title>Purpose</title> <p>Provides implementation-independent versions |
|
15 of the C++ built-in types, defines the Symbian platform standard base class |
|
16 for all heap-allocated classes, and provides some useful yet simple global |
|
17 functions.</p> <p>You should avoid using the C++ built-in types directly: |
|
18 always use the Symbian platform types instead.</p> </section> |
|
19 <section id="GUID-CB087D7D-6963-40C0-809A-AB75B656C39E"><title>Description</title> <p>The API defines classes and typedefs |
|
20 for integer, text, Boolean, and floating point types. Additionally, a utility |
|
21 class to help with reference arguments in variable argument functions is provided.</p> <p><b>Heap-allocated classes base</b> </p> <p>Symbian platform requires that |
|
22 all classes that own dynamically allocated resources derive from a standard |
|
23 base class, <xref href="GUID-8F6FE089-E2A8-30F4-B67E-10F286347681.dita"><apiname>CBase</apiname></xref>. Such classes by conventions have a C |
|
24 prefix to their name, and so are referred to as C classes. C classes, and |
|
25 their associated allocation and cleanup idioms, are fundamental to Symbian |
|
26 platform. </p> <p><b>Integral |
|
27 types</b> </p> <p><xref href="GUID-7A2A43EC-6125-3BFE-834B-23C37F7B40D5.dita"><apiname>TInt</apiname></xref> is the natural machine word integer |
|
28 and should be used in all general contexts where integer arithmetic is desired.</p> <p><xref href="GUID-49ACAE7B-1FE4-3BA6-8772-F104D3F01E41.dita"><apiname>TInt32</apiname></xref>, <xref href="GUID-6BE0B3FC-2B36-3982-AA51-971F3354925E.dita"><apiname>TInt16</apiname></xref> and <xref href="GUID-F2669E84-D47E-3C83-A549-D77A883787CC.dita"><apiname>TInt8</apiname></xref> map onto C++ built-in types in most implementations. These |
|
29 types should only be used where the size of the integer is of first importance.</p> <p><xref href="GUID-F9432D7B-41C9-3048-AC50-B5BCF8BE11D0.dita"><apiname>TUint</apiname></xref> is |
|
30 an unsigned integer of the natural machine word size. It should be used for |
|
31 flag and handle words, which are manipulated using bitwise and equality-comparison |
|
32 operations rather than arithmetic. </p> <p><xref href="GUID-F58A1C0D-1B36-37EA-8012-1C74B2D12CAD.dita"><apiname>TUint32</apiname></xref>, <xref href="GUID-4BB532F8-938E-37C7-9D40-6010EB716E7A.dita"><apiname>TUint16</apiname></xref> and <xref href="GUID-F894527F-13A6-3E6D-BA7B-187812CDF20E.dita"><apiname>TUint8</apiname></xref> are |
|
33 available where the specific representation width is important.</p> <p><b>Text types</b> </p> <p><xref href="GUID-317497AE-D70D-3FD5-9865-6446FF4AD035.dita"><apiname>TText</apiname></xref> represents a character |
|
34 in the natural width for the Symbian platform build. From v5.1 onwards, this |
|
35 is 16 bits.</p> <p><xref href="GUID-0DC8E9A8-8B5A-3566-B1C5-27B6E4F47F3C.dita"><apiname>TText8</apiname></xref> is available for build-independent |
|
36 8-bit characters, and <xref href="GUID-9A863E0A-E588-367C-9444-C13AC0D44234.dita"><apiname>TText16</apiname></xref> for build-independent 16-bit |
|
37 characters. </p> <p>The <xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita"><apiname>TChar</apiname></xref> class wraps a character value |
|
38 and provides a number of utility functions to operate upon it.</p> <p><b>Boolean type</b> </p> <p><xref href="GUID-4B942C06-1BAC-3A21-B3B1-89FB5C51ADA0.dita"><apiname>TBool</apiname></xref> represents a Boolean |
|
39 whose value may be true or false. It is implemented as a natural machine-word |
|
40 integer.</p> <p><b>Floating-point |
|
41 types</b> </p> <p><xref href="GUID-2D851BBB-15A1-309A-813D-E397D55A6431.dita"><apiname>TReal</apiname></xref> is a 64-bit double-precision type, |
|
42 used as the argument type for all math functions, and the default type of |
|
43 floating-point literals.</p> <p><xref href="GUID-E694921E-0449-3B0B-81DC-5A9FCC07B345.dita"><apiname>TReal64</apiname></xref> and <xref href="GUID-58CA4B68-0A0F-31E2-A624-0F78F47EE458.dita"><apiname>TReal32</apiname></xref> are |
|
44 available when the precise size is important.</p> <p><b>Value reference type</b> </p> <p>The value reference type is a utility |
|
45 that is provided to overcome problems with specifying a C++ reference argument |
|
46 before the ellipsis argument in variable argument functions.</p> <p>The value |
|
47 reference type is provided by <xref href="GUID-5391E485-A019-358F-85D2-3B55BA439BD1.dita"><apiname>TRefByValue</apiname></xref> <T>.</p> <p><b>Global functions</b> </p> <p><xref href="GUID-B22DC2FB-FA5C-5F62-8F01-A975EAA24E7F.dita">Max()</xref>, <xref href="GUID-B22DC2FB-FA5C-5F62-8F01-A975EAA24E7F.dita">Min()</xref>, <xref href="GUID-B22DC2FB-FA5C-5F62-8F01-A975EAA24E7F.dita">Rng()</xref> and <xref href="GUID-B22DC2FB-FA5C-5F62-8F01-A975EAA24E7F.dita">Abs()</xref> are simple global |
|
48 functions that are useful in many contexts.</p> </section> |
|
49 <section id="GUID-93D4AD68-48DE-4FB1-A0E9-F8DB1487DFD8"><title>See also</title> <p><xref href="GUID-07A31FD0-304A-57CA-8FFE-4DAD8EE9B30F.dita">Maths |
|
50 Overview</xref> </p> </section> |
|
51 </conbody></concept> |