Overview
| Comment: | Prepare OFSet and OFMutableSet for OFCountedSet. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
5207c4ea4dcb31330b25fb486101036f |
| User & Date: | js on 2011-07-26 18:12:58 |
| Other Links: | manifest | tags |
Context
|
2011-07-26
| ||
| 21:42 | Add OFCountedSet. (check-in: eb791d09d1 user: js tags: trunk) | |
| 18:12 | Prepare OFSet and OFMutableSet for OFCountedSet. (check-in: 5207c4ea4d user: js tags: trunk) | |
|
2011-07-24
| ||
| 20:05 | Add a few defines for runtime methods so they always have the same name. (check-in: c7bc7b93d9 user: js tags: trunk) | |
Changes
Modified src/OFMutableSet.m from [842dbccb4e] to [ff741b1139].
| ︙ | ︙ | |||
16 17 18 19 20 21 22 | #include "config.h" #define OF_MUTABLE_SET_M #import "OFMutableSet.h" #import "OFDictionary.h" | | | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
#include "config.h"
#define OF_MUTABLE_SET_M
#import "OFMutableSet.h"
#import "OFDictionary.h"
#import "OFArray.h"
#import "OFNumber.h"
#import "OFAutoreleasePool.h"
@implementation OFMutableSet
- (void)addObject: (id)object
{
[dictionary _setObject: [OFNumber numberWithSize: 1]
forKey: object
copyKey: NO];
mutations++;
}
- (void)removeObject: (id)object
|
| ︙ | ︙ |
Modified src/OFSet.m from [055b4111d5] to [b1d260547d].
| ︙ | ︙ | |||
17 18 19 20 21 22 23 | #include "config.h" #define OF_SET_M #import "OFSet.h" #import "OFDictionary.h" #import "OFArray.h" | | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
#include "config.h"
#define OF_SET_M
#import "OFSet.h"
#import "OFDictionary.h"
#import "OFArray.h"
#import "OFString.h"
#import "OFNumber.h"
#import "OFAutoreleasePool.h"
@implementation OFSet
+ set
{
return [[[self alloc] init] autorelease];
}
|
| ︙ | ︙ | |||
66 67 68 69 70 71 72 |
}
return self;
}
- initWithSet: (OFSet*)set
{
| | > > > > | > > > > > | > | > > > > < | > > | 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 |
}
return self;
}
- initWithSet: (OFSet*)set
{
self = [self init];
@try {
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFNumber *one = [OFNumber numberWithSize: 1];
OFEnumerator *enumerator = [set objectEnumerator];
id object;
/*
* We can't just copy the dictionary as the specified set might
* be a counted set, but we're just a normal set.
*/
while ((object = [enumerator nextObject]) != nil)
[dictionary _setObject: one
forKey: object
copyKey: NO];
[pool release];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- initWithArray: (OFArray*)array
{
self = [self init];
@try {
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFNumber *one = [OFNumber numberWithSize: 1];
id *cArray = [array cArray];
size_t i, count = [array count];
for (i = 0; i < count; i++)
[dictionary _setObject: one
forKey: cArray[i]
copyKey: NO];
[pool release];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
|
| ︙ | ︙ | |||
120 121 122 123 124 125 126 |
- initWithObject: (id)firstObject
arguments: (va_list)arguments
{
self = [self init];
@try {
| > | | | > > | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
- initWithObject: (id)firstObject
arguments: (va_list)arguments
{
self = [self init];
@try {
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFNumber *one = [OFNumber numberWithSize: 1];
id object;
[dictionary _setObject: one
forKey: firstObject
copyKey: NO];
while ((object = va_arg(arguments, id)) != nil)
[dictionary _setObject: one
forKey: object
copyKey: NO];
[pool release];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
|
| ︙ | ︙ |