×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    12

    The CArrayX arrays

    I always feel confuing when meet with these classes.

    1, "append" function,
    The "CArrayFixFlat" and "CArrayFixSeg" copy the appended item,so does the CArrayPakFlat.
    How about the "CArrayVarX" and "CArrayPtrX"?


    2,What's the difference between "CArrayVarX" and "CArrayPtrX"?

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Re: The CArrayX arrays

    Nokia Developer Wiki Moderation team

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    12

    Re: The CArrayX arrays

    Quote Originally Posted by kiran10182 View Post
    Hi, kiran10182

    I have read this before.Pity, it doesn't solve my question directly.

  4. #4
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Re: The CArrayX arrays

    Quote Originally Posted by morningbird View Post
    1, "append" function,
    The "CArrayFixFlat" and "CArrayFixSeg" copy the appended item,so does the CArrayPakFlat.
    How about the "CArrayVarX" and "CArrayPtrX"?
    CArrayVarX is used to hold the variable size buffers. For ex: HBufC(which is created on its own heap).
    Code:
    HBufC* first = HBufC::NewL(50);
    ....
    HBufC* second = HBufC::NewL(7);
    ...
    ...
    varArray->AppendL(first, length1);
    varArray->AppendL(second, length2);

    where as CArrayPtrX is used to hold the pointers of CBase derived classes. For e.g: CMyClass. The "append" method will append the variable size buffers for CArrayVarX and CBase derived pointers for CArrayPtrX
    Code:
    CMyClass* c1 = CMyClass::NewL();
    CMyClass* c2 = CMyClass::NewL();
    ...
    ptrArray->AppendL(c1);
    ptrArray->AppendL(c2);
    ...


    Quote Originally Posted by morningbird View Post
    2,What's the difference between "CArrayVarX" and "CArrayPtrX"?
    CArrayVarX is for variable length buffer which is derived from CArrayVarBase and which inturn derives from CBase.
    CArrayPtrX is for storing pointers of CBase derived classes. It is derived from CArrayPtr which is derived from CArrayFix which is used to store the fixed length size objects. So you can append elements from single CBase derived class in on array. See the example above.

    EDIT: You should better try RArray and RPointerArray which are easy to use and have some advantages over their CArrayX counterparts.
    Last edited by kiran10182; 2010-05-19 at 15:13.
    Nokia Developer Wiki Moderation team

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: The CArrayX arrays

    CArrayPtr stores pointers, CArrayVar stores elements (just they can have variable size).
    Ptr does not copy anything, Var allocates space for the new element on the heap, copies it there, and stores its address. Thus Var should store value types (T-classes) only, like Fix and Pak, just with variable size.

Similar Threads

  1. Replies: 3
    Last Post: 2010-04-30, 19:44
  2. How to draw RGB arrays to screen(after YUV to RGB)
    By kdwx in forum Symbian Media (Closed)
    Replies: 19
    Last Post: 2009-01-05, 13:06
  3. Localizing string arrays, please help
    By sikkim.suresh in forum Symbian User Interface
    Replies: 1
    Last Post: 2008-07-17, 14:46
  4. string arrays
    By bullzi in forum Symbian
    Replies: 2
    Last Post: 2004-11-22, 11:41
  5. associative arrays
    By dalore in forum Symbian
    Replies: 1
    Last Post: 2004-01-26, 09:14

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×