LCOV - code coverage report
Current view: top level - Core/Debug - OOTCPStreamDecoderAbstractionLayer.m (source / functions) Hit Total Coverage
Test: coverxygen.info Lines: 0 15 0.0 %
Date: 2025-05-28 07:50:54 Functions: 0 0 -

          Line data    Source code
       1           0 : /*      OOTCPStreamDecoderAbstractionLayer.h
       2             :         
       3             :         Abstraction layer to allow OOTCPStreamDecoder to work with CoreFoundation/
       4             :         CF-Lite, Cocoa Foundation or GNUstep Foundation.
       5             :         
       6             :         Foundation implementation.
       7             : */
       8             : 
       9             : #ifndef OO_EXCLUDE_DEBUG_SUPPORT
      10             : 
      11             : #import "OOTCPStreamDecoderAbstractionLayer.h"
      12             : #import "OOCocoa.h"
      13             : 
      14             : 
      15             : // Simulate literal CF/NS strings. Each literal string that is used becomes a single object. Since it uses pointers as keys, it should only be used with literals.
      16           0 : OOALStringRef OOALGetConstantString(const char *string)
      17             : {
      18             :         static NSMutableDictionary              *sStrings = nil;
      19             :         NSValue                                                 *key = nil;
      20             :         NSString                                                *value = nil;
      21             :         
      22             :         if (sStrings == nil)
      23             :         {
      24             :                 sStrings = [[NSMutableDictionary alloc] init];
      25             :         }
      26             :         
      27             :         key = [NSValue valueWithPointer:string];
      28             :         value = [sStrings objectForKey:key];
      29             :         if (value == nil)
      30             :         {
      31             :                 // Note: non-ASCII strings are not permitted, but we don't bother to detect them.
      32             :                 value = [NSString stringWithUTF8String:string];
      33             :                 if (value != nil)  [sStrings setObject:value forKey:key];
      34             :         }
      35             :         
      36             :         return value;
      37             : }
      38             : 
      39             : 
      40           0 : void OOALRelease(OOALObjectRef object)
      41             : {
      42             :         [object release];
      43             : }
      44             : 
      45             : 
      46           0 : OOALStringRef OOTypeDescription(OOALObjectRef object)
      47             : {
      48             :         return [[object class] description];
      49             : }
      50             : 
      51             : 
      52           0 : bool OOALIsString(OOALObjectRef object)
      53             : {
      54             :         return [object isKindOfClass:[NSString class]];
      55             : }
      56             : 
      57             : 
      58           0 : OOALStringRef OOALStringCreateWithFormatAndArguments(OOALStringRef format, va_list args)
      59             : {
      60             :         return [[NSString alloc] initWithFormat:format arguments:args];
      61             : }
      62             : 
      63             : 
      64           0 : bool OOALIsDictionary(OOALObjectRef object)
      65             : {
      66             :         return [object isKindOfClass:[NSDictionary class]];
      67             : }
      68             : 
      69             : 
      70           0 : OOALObjectRef OOALDictionaryGetValue(OOALDictionaryRef dictionary, OOALObjectRef key)
      71             : {
      72             :         return [dictionary objectForKey:key];
      73             : }
      74             : 
      75             : 
      76           0 : bool OOALIsData(OOALObjectRef object)
      77             : {
      78             :         return [object isKindOfClass:[NSData class]];
      79             : }
      80             : 
      81             : 
      82           0 : OOALMutableDataRef OOALDataCreateMutable(size_t capacity)
      83             : {
      84             :         return [[NSMutableData alloc] initWithCapacity:capacity];
      85             : }
      86             : 
      87             : 
      88           0 : void OOALMutableDataAppendBytes(OOALMutableDataRef data, const void *bytes, size_t length)
      89             : {
      90             :         [data appendBytes:bytes length:length];
      91             : }
      92             : 
      93             : 
      94           0 : const void *OOALDataGetBytePtr(OOALDataRef data)
      95             : {
      96             :         return [data bytes];
      97             : }
      98             : 
      99             : 
     100           0 : size_t OOALDataGetLength(OOALDataRef data)
     101             : {
     102             :         return [data length];
     103             : }
     104             : 
     105             : 
     106           0 : OOALAutoreleasePoolRef OOALCreateAutoreleasePool(void)
     107             : {
     108             :         return [[NSAutoreleasePool alloc] init];
     109             : }
     110             : 
     111             : 
     112           0 : OOALObjectRef OOALPropertyListFromData(OOALMutableDataRef data, OOALStringRef *errStr)
     113             : {
     114             :         id result = [NSPropertyListSerialization propertyListFromData:data
     115             :                                                                                                  mutabilityOption:NSPropertyListImmutable
     116             :                                                                                                                    format:NULL
     117             :                                                                                                  errorDescription:errStr];
     118             :         [result retain];
     119             :         
     120             : #if !OOLITE_RELEASE_PLIST_ERROR_STRINGS
     121             :         [*errStr retain];
     122             : #endif
     123             :         
     124             :         return result;
     125             : }
     126             : 
     127             : #endif /* OO_EXCLUDE_DEBUG_SUPPORT */

Generated by: LCOV version 1.14