Beispiel #1
0
static RSStringRef __RSQueueClassDescription(RSTypeRef rs)
{
    RSQueueRef queue = (RSQueueRef)rs;
    RSMutableStringRef result;
    RSAllocatorRef allocator;
    RSIndex idx, cnt;
    cnt = RSQueueGetCount(queue);
    allocator = RSGetAllocator(queue);
    result = RSStringCreateMutable(allocator, 0);
    RSStringAppendStringWithFormat(result, RSSTR("<RSQueue %p [%p]>{type = mutable-small, count = %u, values = (%s"), rs, allocator, cnt, cnt ? "\n" : "");
    for (idx = 0; idx < cnt; idx++)
    {
        RSStringRef desc = nil;
        
        RSTypeRef val = nil;
        desc = (RSStringRef)INVOKE_CALLBACK1(RSDescription, val = RSArrayObjectAtIndex(queue->_queueCore, idx));
        if (nil != desc)
        {
            RSStringAppendStringWithFormat(result, RSSTR("\t%u : %R\n"), idx, desc);
            RSRelease(desc);
        } else {
            RSStringAppendStringWithFormat(result, RSSTR("\t%u : <%p>\n"), idx, val);
        }
    }
    RSStringAppendString(result, RSSTR(")}"));
    return result;
}
Beispiel #2
0
static RSStringRef __RSErrorClassDescription(RSTypeRef obj)
{
    RSErrorRef err = (RSErrorRef)obj;
    RSMutableStringRef description = RSStringCreateMutable(RSAllocatorSystemDefault, 128);
    if (err->_userInfo) {
        RSStringAppendStringWithFormat(description,
                                       RSSTR("RSError = {\n\tError Code = %ld\n\tDomain = %R\n\tUser Information = %R\n"),
                                       err->_code,
                                       err->_domain,
                                       err->_userInfo);
    }else {
        RSStringAppendStringWithFormat(description, RSSTR("RSError = {\n\tError Code = %ld\n\tDomain = %R\n\tUser Information = nil.\n"),
                                       err->_code,
                                       err->_domain);
    }
    
    return description;
}