Symbian3/PDK/Source/GUID-9309D482-8931-58FC-9B34-D0E5E942E404.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     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-9309D482-8931-58FC-9B34-D0E5E942E404" xml:lang="en"><title>Array
       
    13 keys</title><shortdesc>This document provides an introduction to array keys.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>A key is used by an array for sorting and finding elements and can also
       
    15 be used to locate the insertion position for new elements.</p>
       
    16 <p>The characteristics of a key are defined by a key object, constructed from
       
    17 one of the three concrete classes: <codeph>TKeyArrayFix</codeph>, <codeph>TKeyArrayVar</codeph> and <codeph>TKeyArrayPak</codeph>.
       
    18 In general, the choice of key class depends on the type of array being used
       
    19 and the specific member function of that array.</p>
       
    20 <p><codeph>TKeyArrayFix</codeph> is used by the following functions accessible
       
    21 through the <codeph>CArrayFixFlat</codeph> and <codeph>CArrayFixSeg</codeph> classes:</p>
       
    22 <ul>
       
    23 <li id="GUID-0E7B4699-4F6C-55C2-89B1-745150DC093F"><p><codeph>Sort()</codeph> </p> </li>
       
    24 <li id="GUID-A93FD22C-3AF2-52B9-A0A0-97AD55A4AD10"><p><codeph>InsertIsqL()</codeph> </p> </li>
       
    25 <li id="GUID-517388FF-9C57-57C2-B298-0CAAB089F115"><p><codeph>Find()</codeph>  </p> </li>
       
    26 <li id="GUID-361EC51C-F9C6-59CE-94F3-080B709A5CEE"><p><codeph>FindIsq()</codeph> </p> </li>
       
    27 </ul>
       
    28 <p><codeph>TKeyArrayVar</codeph> is used by the following functions accessible
       
    29 through the <codeph>CArrayVarFlat</codeph> and <codeph>CArrayVarSeg</codeph> classes:</p>
       
    30 <ul>
       
    31 <li id="GUID-FDC42164-4F6A-59A4-8068-253E2D7B4702"><p><codeph>Sort()</codeph> </p> </li>
       
    32 <li id="GUID-DF54D24C-B784-5297-8995-B9DFA228E773"><p><codeph>InsertIsqL()</codeph> </p> </li>
       
    33 <li id="GUID-CC54EE8D-EA27-527A-B9CB-3BEA2D672547"><p><codeph>Find()</codeph>  </p> </li>
       
    34 <li id="GUID-68A69B6F-1906-59C1-8502-74FAC80C2677"><p><codeph>FindIsq()</codeph> </p> </li>
       
    35 </ul>
       
    36 <p><codeph>TKeyArrayVar</codeph> is also used by <codeph>CArrayPakFlat::SortL()</codeph>.</p>
       
    37 <p><codeph>TKeyArrayPak</codeph> is used by the following functions accessible
       
    38 through the <codeph>CArrayPakFlat</codeph> class:</p>
       
    39 <ul>
       
    40 <li id="GUID-B180F59C-24BF-502B-BC94-2C1E67CB80DB"><p><codeph>InsertIsqL()</codeph> </p> </li>
       
    41 <li id="GUID-E4023130-CE1E-5E46-90AC-76958E346424"><p><codeph>Find()</codeph>  </p> </li>
       
    42 <li id="GUID-D31FCB05-78CB-51C5-8320-8B53362B83CD"><p><codeph>FindIsq()</codeph> </p> </li>
       
    43 </ul>
       
    44 <p>The concrete classes are all derived from the abstract base class <codeph>TKey</codeph> that
       
    45 encapsulates the characteristics of a key and defines the basic behaviour
       
    46 of keys. A class such as <codeph>TKeyArrayFix</codeph> provides an implementation
       
    47 for specific arrays or types of array.</p>
       
    48 <p>A key object is not a component of an array class but is constructed separately
       
    49 and passed, as an argument, to the appropriate array class member function.
       
    50 A key definition is not an integral part of an array, but is <i>used</i> by
       
    51 an array.</p>
       
    52 <p>A <codeph>TKey</codeph> derived object is also passed as an argument to
       
    53 the <codeph>User::BinarySearch()</codeph> and <codeph>User::QuickSort()</codeph> functions.</p>
       
    54 <p>An array can use various different key definitions during its life.</p>
       
    55 <p>The characteristics of a key as defined by the base <codeph>TKey</codeph> class
       
    56 are:</p>
       
    57 <ul>
       
    58 <li id="GUID-B73CBD70-BA02-55CF-915C-5E2CB5B1D2D3"><p>The type of data forming
       
    59 the key.</p> </li>
       
    60 <li id="GUID-0CD99B8B-0339-56F3-9ADA-888100D9EE05"><p>The type of comparison
       
    61 to be made between two keys.</p> </li>
       
    62 <li id="GUID-22BE001D-5C54-53C8-B4BE-7253182C5672"><p>The length of the key
       
    63 within an array element.</p> </li>
       
    64 <li id="GUID-394C8FE9-C9FB-593A-9A2B-6B682F0E8939"><p>The location of the
       
    65 key within an array element.</p> </li>
       
    66 </ul>
       
    67 <p>See also:</p>
       
    68 <ul>
       
    69 <li id="GUID-3B74F364-852D-58E8-B24B-368290034A8C"><p><xref href="GUID-E3F403EE-717B-5EA6-BC4E-6840097CAC10.dita">Using
       
    70 dynamic arrays</xref> </p> </li>
       
    71 </ul>
       
    72 </conbody></concept>