diff -r 89d6a7a84779 -r 25a17d01db0c Symbian3/PDK/Source/GUID-2A6C43A6-D5D3-5DC1-871C-C1428D2DB2E6.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/PDK/Source/GUID-2A6C43A6-D5D3-5DC1-871C-C1428D2DB2E6.dita Fri Jan 22 18:26:19 2010 +0000 @@ -0,0 +1,50 @@ + + + + + +How to access reference counting objects in object containers

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.

... +class CMyobject : public CObject + { + ... + }; + +_LIT(KMatcher,"Monday"); +... +CMyobject* theobject; +CObjectCon* thecontainer; +TInt thefindhandle; +TName objname; +... +thecontainer->FindByName(thefindhandle,KMatcher,objname); +theobject = (CMyObject*)thecontainer->AtL(thefindhandle); +...

The following code fragment retrieves pointers to all of the reference counting objects whose names end with "day":

... +class CMyobject : public CObject + { + ... + }; + +_LIT(KMatcher,"*day"); +... +CMyobject* theobject; +CObjectCon* thecontainer; +TInt thefindhandle; +TName objname; +... +thefindhandle = 0; +while (thecontainer->FindByName(thefindhandle,KMatcher,objname)==KerrNone) + { + // objname contains the reference counting object's + // name, e.g. "Monday" or "Tuesday" + ... + theobject = (CMyobject*)thecontainer->AtL(thefindhandle); + ... + } +// Now found all matching reference counting objects +...
\ No newline at end of file