Professional Web Applications Themes

Getting keys by index from a CFDictionary? - Mac Programming

I notice a conspicuous lack of any function like "CFDictionaryGetIndexedKey". How does one do this sort of thing with a CFDictionary? Must I actually get a copy of the entire dictionary using CFDictionaryGetKeysAndValues and then index into it manually? This seems bersome, especially in a mutable dictionary, where it would be harder to cache this data for future reuse! -- -Thomas <http://www.bitjuggler.com/>...

  1. #1

    Default Getting keys by index from a CFDictionary?

    I notice a conspicuous lack of any function like
    "CFDictionaryGetIndexedKey". How does one do this sort of thing with a
    CFDictionary? Must I actually get a copy of the entire dictionary
    using CFDictionaryGetKeysAndValues and then index into it manually?
    This seems bersome, especially in a mutable dictionary, where it
    would be harder to cache this data for future reuse!

    --
    -Thomas

    <http://www.bitjuggler.com/>
    Thomas Guest

  2. #2

    Default Re: Getting keys by index from a CFDictionary?

    In article <300420041506225227%spam.me>,
    Thomas Reed <spam.me> wrote:
     

    Your question doesn't make sense because dictionary keys are not kept at fixed
    indices, especially not in a mutable dictionary.

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Guest

  3. #3

    Default Re: Getting keys by index from a CFDictionary?

    Miro Jurisic <org> wrote:
     
    >
    > Your question doesn't make sense because dictionary keys are not kept at fixed
    > indices[/ref]

    I was going to say this, but I was afraid Miro would snap at me for
    being rude. m.

    --
    matt neuburg, phd = com, http://www.tidbits.com/matt/
    AppleScript: The Definitive Guide
    http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt
    Read TidBITS! It's free and smart. http://www.tidbits.com
    matt Guest

  4. #4

    Default Re: Getting keys by index from a CFDictionary?

    In article <mit.edu>,
    Miro Jurisic <org> wrote:
     

    I was used to REALbasic's Dictionary class, which has a way to get
    indexed keys as a way of iterating over each element in the dictionary.
    (Though the order of elements is not guaranteed, so it's really only
    useful for iteration.) I had also been using a REALbasic plugin that
    wraps the Core Foundation, and it provides a similar function. So I
    assumed there was some easier way to do it.

    I was hoping to maintain some compatibility with these things in my own
    Core Foundation classes, but I think supplying a way to use
    CFDictionaryApplyFunction to iterate over values would probably be
    best.

    Anyway, sorry for the somewhat nonsensical question! :-)

    --
    -Thomas

    <http://www.bitjuggler.com/>
    Thomas Guest

  5. #5

    Default Re: Getting keys by index from a CFDictionary?

    In article <010520040618062516%spam.me>,
    Thomas Reed <spam.me> wrote:
     

    Yes, CFDictionaryApplyFunction is the right answer.

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Guest

Similar Threads

  1. Determining all shortcut keys in use (including Function keys)?
    By Jeff_Bowell@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 1
    Last Post: December 31st, 07:01 PM
  2. Replies: 4
    Last Post: August 3rd, 03:11 PM
  3. Newb query: index.htm & index.php & the server default
    By Lab309 in forum PHP Development
    Replies: 7
    Last Post: September 22nd, 02:08 PM
  4. Multiple index columns (keys)
    By Tony in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: August 25th, 04:34 PM
  5. Replies: 0
    Last Post: July 16th, 12:52 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139