diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-01-06 20:12:03 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-01-06 20:12:03 +0000 | 
| commit | 9e6d35490a6542f9c97607f93c2ef8ca8e03cbcc (patch) | |
| tree | dd2a1ddf0476664c2b823409c36cbccd52662ca7 /packages/Python/lldbsuite/test/lang/objc/sample | |
| parent | 3bd2e91faeb9eeec1aae82c64a3253afff551cfd (diff) | |
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/lang/objc/sample')
| -rw-r--r-- | packages/Python/lldbsuite/test/lang/objc/sample/Makefile | 6 | ||||
| -rw-r--r-- | packages/Python/lldbsuite/test/lang/objc/sample/main.m | 70 | 
2 files changed, 76 insertions, 0 deletions
diff --git a/packages/Python/lldbsuite/test/lang/objc/sample/Makefile b/packages/Python/lldbsuite/test/lang/objc/sample/Makefile new file mode 100644 index 000000000000..a1608fe5a664 --- /dev/null +++ b/packages/Python/lldbsuite/test/lang/objc/sample/Makefile @@ -0,0 +1,6 @@ +LEVEL = ../../../make + +OBJC_SOURCES := main.m +LDFLAGS = $(CFLAGS) -lobjc -framework Foundation + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/lang/objc/sample/main.m b/packages/Python/lldbsuite/test/lang/objc/sample/main.m new file mode 100644 index 000000000000..9dffc71aaac6 --- /dev/null +++ b/packages/Python/lldbsuite/test/lang/objc/sample/main.m @@ -0,0 +1,70 @@ +#import <Foundation/Foundation.h> + + +@interface MyString : NSObject { +    NSString *_string; +    NSDate *_date; +} +- (id)initWithNSString:(NSString *)string; + +@property (copy) NSString *string; +@property (readonly,getter=getTheDate) NSDate *date; + +- (NSDate *) getTheDate; +@end + +@implementation MyString + +@synthesize string = _string; +@synthesize date = _date; + +- (id)initWithNSString:(NSString *)string +{ +    if (self = [super init]) +    { +        _string = [NSString stringWithString:string]; +        _date = [NSDate date];             +    } +    return self; +} + +- (void) dealloc +{ +    [_date release]; +    [_string release]; +    [super dealloc]; +} + +- (NSDate *) getTheDate +{ +    return _date; +} + +- (NSString *)description +{ +    return [_string stringByAppendingFormat:@" with timestamp: %@", _date]; +} +@end + +int main (int argc, char const *argv[]) +{ +    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; +    static NSString *g_global_nsstr = @"Howdy"; +     +    MyString *myStr = [[MyString alloc] initWithNSString: [NSString stringWithFormat:@"string %i", 1]]; +    NSString *str1 = myStr.string; +    NSString *str2 = [NSString stringWithFormat:@"string %i", 2]; +    NSString *str3 = [NSString stringWithFormat:@"string %i", 3]; +    NSArray *array = [NSArray arrayWithObjects: str1, str2, str3, nil]; +    NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: +                            str1, @"1",  +                            str2, @"2",  +                            str3, @"3",  +                            myStr.date, @"date", +                            nil]; + +    id str_id = str1; +    SEL sel = @selector(length); +    [pool release]; +    return 0; +}  | 
