Symbian3/SDK/Source/GUID-2A6C43A6-D5D3-5DC1-871C-C1428D2DB2E6.dita
changeset 0 89d6a7a84779
equal deleted inserted replaced
-1:000000000000 0:89d6a7a84779
       
     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 xml:lang="en" id="GUID-2A6C43A6-D5D3-5DC1-871C-C1428D2DB2E6"><title>How to access reference counting objects in object containers</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>The following code fragment retrieves a pointer to the reference counting object with the name "Monday". It assumes that such a reference counting object does exist.</p> <codeblock id="GUID-3621E878-0505-5040-B034-6F6937F6D0A1" xml:space="preserve">...
       
    13 class CMyobject : public CObject
       
    14     {
       
    15        ...
       
    16        };
       
    17 
       
    18 _LIT(KMatcher,"Monday");
       
    19 ...
       
    20 CMyobject*  theobject;
       
    21 CObjectCon* thecontainer;
       
    22 TInt        thefindhandle;
       
    23 TName       objname;
       
    24 ...
       
    25 thecontainer-&gt;FindByName(thefindhandle,KMatcher,objname);
       
    26 theobject = (CMyObject*)thecontainer-&gt;AtL(thefindhandle);
       
    27 ...</codeblock> <p>The following code fragment retrieves pointers to all of the reference counting objects whose names end with "day":</p> <codeblock id="GUID-0AA53FC1-FEDA-5C0E-AA68-AAD8D564E4D0" xml:space="preserve">...
       
    28 class CMyobject : public CObject
       
    29     {
       
    30        ...
       
    31        };
       
    32 
       
    33 _LIT(KMatcher,"*day");
       
    34 ...
       
    35 CMyobject*  theobject;
       
    36 CObjectCon* thecontainer;
       
    37 TInt        thefindhandle;
       
    38 TName       objname;
       
    39 ...
       
    40 thefindhandle = 0;
       
    41 while (thecontainer-&gt;FindByName(thefindhandle,KMatcher,objname)==KerrNone)
       
    42     {
       
    43     // objname contains the reference counting object's
       
    44     // name, e.g. "Monday" or "Tuesday"
       
    45     ...
       
    46     theobject = (CMyobject*)thecontainer-&gt;AtL(thefindhandle);
       
    47     ...
       
    48     }
       
    49 // Now found all matching reference counting objects
       
    50 ...</codeblock> </conbody></concept>