diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-2A6C43A6-D5D3-5DC1-871C-C1428D2DB2E6.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-2A6C43A6-D5D3-5DC1-871C-C1428D2DB2E6.dita Wed Mar 31 11:11:55 2010 +0100 @@ -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