Skip to content

Instantly share code, notes, and snippets.

@jorbsd
Created May 18, 2010 18:09
Show Gist options
  • Save jorbsd/405313 to your computer and use it in GitHub Desktop.
Save jorbsd/405313 to your computer and use it in GitHub Desktop.
- (NSString *)description {
[self buildHeap];
CFBinaryHeapRef tempHeap = CFBinaryHeapCreateCopy(NULL, 0, self.objs);
// This is technically not working now, there is a bug in CFBinaryHeap, the description is incorrect
// on Snow Leopard.
// FIXME: rdar://problem/7219189
//return [NSString stringWithFormat:@"JBBPriorityQueue = %@", [NSMakeCollectable(CFCopyDescription(tempHeap)) autorelease]];
NSMutableString *result = [NSMutableString stringWithFormat:@"<JBBPriorityQueue: %p> {", self];
if (CFBinaryHeapGetCount(tempHeap) != 0) {
[result appendFormat:@"\n"];
CFBinaryHeapApplyFunction(tempHeap, JBBBuildDescriptionCallBack, result);
}
[result appendFormat:@"}"];
CFRelease(tempHeap);
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment