Comment: | Add deserialization. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
dca3061dfcb44b35535beed51921492f |
User & Date: | js on 2011-06-03 15:14:18 |
Other Links: | manifest | tags |
2011-06-04
| ||
13:29 | Fix -[OFURL isEqual:]. check-in: 9d48ed225c user: js tags: trunk | |
2011-06-03
| ||
15:14 | Add deserialization. check-in: dca3061dfc user: js tags: trunk | |
2011-05-29
| ||
21:47 | Inline of_condition_* on Win32 as well to prevent warnings. check-in: a1c5b19c7c user: js tags: trunk | |
Modified ObjFW.xcodeproj/project.pbxproj from [a5bc71a558] to [65c853b1de].
︙ | ︙ | |||
227 228 229 230 231 232 233 234 235 236 237 238 239 240 | 4B90B7A2133AD87D00BD33CB /* OFBindFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B90B798133AD87D00BD33CB /* OFBindFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B90B7A3133AD87D00BD33CB /* OFBindFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B90B799133AD87D00BD33CB /* OFBindFailedException.m */; }; 4B90B7A4133AD87D00BD33CB /* OFConnectionFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B90B79A133AD87D00BD33CB /* OFConnectionFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B90B7A5133AD87D00BD33CB /* OFConnectionFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B90B79B133AD87D00BD33CB /* OFConnectionFailedException.m */; }; 4B90B7A6133AD87D00BD33CB /* OFListenFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B90B79C133AD87D00BD33CB /* OFListenFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B90B7A7133AD87D00BD33CB /* OFListenFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B90B79D133AD87D00BD33CB /* OFListenFailedException.m */; }; 4B989C2F13771A3700109A30 /* OFSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B989C2E13771A3700109A30 /* OFSerialization.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4BD98C03133814220048DD5B /* objfw-defs.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD98C011338140B0048DD5B /* objfw-defs.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4BDF37B51338055600F9A81A /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDF37B41338055600F9A81A /* config.h */; }; 4BF33AFB133807590059CEF7 /* ObjFW.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B3D23761337FBC800DD29B8 /* ObjFW.framework */; }; 4BF33AFC133807A20059CEF7 /* OFArrayTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF66E1235358D0076B512 /* OFArrayTests.m */; }; 4BF33AFD133807A20059CEF7 /* OFBlockTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BE5F0E412DF4259005C7A0C /* OFBlockTests.m */; }; 4BF33AFE133807A20059CEF7 /* OFDataArrayTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF66F1235358D0076B512 /* OFDataArrayTests.m */; }; 4BF33AFF133807A20059CEF7 /* OFDateTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BE5F0E512DF4259005C7A0C /* OFDateTests.m */; }; | > | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | 4B90B7A2133AD87D00BD33CB /* OFBindFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B90B798133AD87D00BD33CB /* OFBindFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B90B7A3133AD87D00BD33CB /* OFBindFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B90B799133AD87D00BD33CB /* OFBindFailedException.m */; }; 4B90B7A4133AD87D00BD33CB /* OFConnectionFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B90B79A133AD87D00BD33CB /* OFConnectionFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B90B7A5133AD87D00BD33CB /* OFConnectionFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B90B79B133AD87D00BD33CB /* OFConnectionFailedException.m */; }; 4B90B7A6133AD87D00BD33CB /* OFListenFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B90B79C133AD87D00BD33CB /* OFListenFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B90B7A7133AD87D00BD33CB /* OFListenFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B90B79D133AD87D00BD33CB /* OFListenFailedException.m */; }; 4B989C2F13771A3700109A30 /* OFSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B989C2E13771A3700109A30 /* OFSerialization.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4BC5E7D6137F0D0E0076F962 /* OFSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BC5E7D5137F0D0E0076F962 /* OFSerialization.m */; }; 4BD98C03133814220048DD5B /* objfw-defs.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD98C011338140B0048DD5B /* objfw-defs.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4BDF37B51338055600F9A81A /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDF37B41338055600F9A81A /* config.h */; }; 4BF33AFB133807590059CEF7 /* ObjFW.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B3D23761337FBC800DD29B8 /* ObjFW.framework */; }; 4BF33AFC133807A20059CEF7 /* OFArrayTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF66E1235358D0076B512 /* OFArrayTests.m */; }; 4BF33AFD133807A20059CEF7 /* OFBlockTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BE5F0E412DF4259005C7A0C /* OFBlockTests.m */; }; 4BF33AFE133807A20059CEF7 /* OFDataArrayTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF66F1235358D0076B512 /* OFDataArrayTests.m */; }; 4BF33AFF133807A20059CEF7 /* OFDateTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BE5F0E512DF4259005C7A0C /* OFDateTests.m */; }; |
︙ | ︙ | |||
520 521 522 523 524 525 526 527 528 529 530 531 532 533 | 4BAF5F48123460C900F4E111 /* OFStreamObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFStreamObserver.m; path = src/OFStreamObserver.m; sourceTree = "<group>"; }; 4BAF5F49123460C900F4E111 /* OFStreamSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFStreamSocket.h; path = src/OFStreamSocket.h; sourceTree = "<group>"; }; 4BAF5F4A123460C900F4E111 /* OFStreamSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFStreamSocket.m; path = src/OFStreamSocket.m; sourceTree = "<group>"; }; 4BB50DCF12F863C700C9393F /* of_asprintf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = of_asprintf.h; path = src/of_asprintf.h; sourceTree = SOURCE_ROOT; }; 4BB50DD012F863C700C9393F /* of_asprintf.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = of_asprintf.m; path = src/of_asprintf.m; sourceTree = SOURCE_ROOT; }; 4BBA36C411406AB700CBA3AC /* atomic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = atomic.h; path = src/atomic.h; sourceTree = "<group>"; }; 4BBA36C511406AB700CBA3AC /* macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = macros.h; path = src/macros.h; sourceTree = "<group>"; }; 4BD86D801237A6C600ED9912 /* OFBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFBlock.h; path = src/OFBlock.h; sourceTree = SOURCE_ROOT; }; 4BD86D811237A6C600ED9912 /* OFBlock.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFBlock.m; path = src/OFBlock.m; sourceTree = SOURCE_ROOT; }; 4BD98C011338140B0048DD5B /* objfw-defs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "objfw-defs.h"; path = "src/objfw-defs.h"; sourceTree = SOURCE_ROOT; }; 4BDF37B41338055600F9A81A /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = SOURCE_ROOT; }; 4BE17AD812FD744C002CEB0B /* foundation-compat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "foundation-compat.m"; path = "src/foundation-compat.m"; sourceTree = SOURCE_ROOT; }; 4BE17AD912FD746D002CEB0B /* OFDataArray+Hashing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "OFDataArray+Hashing.h"; path = "src/OFDataArray+Hashing.h"; sourceTree = SOURCE_ROOT; }; 4BE17ADA12FD746D002CEB0B /* OFDataArray+Hashing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "OFDataArray+Hashing.m"; path = "src/OFDataArray+Hashing.m"; sourceTree = SOURCE_ROOT; }; | > | 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | 4BAF5F48123460C900F4E111 /* OFStreamObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFStreamObserver.m; path = src/OFStreamObserver.m; sourceTree = "<group>"; }; 4BAF5F49123460C900F4E111 /* OFStreamSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFStreamSocket.h; path = src/OFStreamSocket.h; sourceTree = "<group>"; }; 4BAF5F4A123460C900F4E111 /* OFStreamSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFStreamSocket.m; path = src/OFStreamSocket.m; sourceTree = "<group>"; }; 4BB50DCF12F863C700C9393F /* of_asprintf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = of_asprintf.h; path = src/of_asprintf.h; sourceTree = SOURCE_ROOT; }; 4BB50DD012F863C700C9393F /* of_asprintf.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = of_asprintf.m; path = src/of_asprintf.m; sourceTree = SOURCE_ROOT; }; 4BBA36C411406AB700CBA3AC /* atomic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = atomic.h; path = src/atomic.h; sourceTree = "<group>"; }; 4BBA36C511406AB700CBA3AC /* macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = macros.h; path = src/macros.h; sourceTree = "<group>"; }; 4BC5E7D5137F0D0E0076F962 /* OFSerialization.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFSerialization.m; path = src/OFSerialization.m; sourceTree = "<group>"; }; 4BD86D801237A6C600ED9912 /* OFBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFBlock.h; path = src/OFBlock.h; sourceTree = SOURCE_ROOT; }; 4BD86D811237A6C600ED9912 /* OFBlock.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFBlock.m; path = src/OFBlock.m; sourceTree = SOURCE_ROOT; }; 4BD98C011338140B0048DD5B /* objfw-defs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "objfw-defs.h"; path = "src/objfw-defs.h"; sourceTree = SOURCE_ROOT; }; 4BDF37B41338055600F9A81A /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = SOURCE_ROOT; }; 4BE17AD812FD744C002CEB0B /* foundation-compat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "foundation-compat.m"; path = "src/foundation-compat.m"; sourceTree = SOURCE_ROOT; }; 4BE17AD912FD746D002CEB0B /* OFDataArray+Hashing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "OFDataArray+Hashing.h"; path = "src/OFDataArray+Hashing.h"; sourceTree = SOURCE_ROOT; }; 4BE17ADA12FD746D002CEB0B /* OFDataArray+Hashing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "OFDataArray+Hashing.m"; path = "src/OFDataArray+Hashing.m"; sourceTree = SOURCE_ROOT; }; |
︙ | ︙ | |||
787 788 789 790 791 792 793 794 795 796 797 798 799 800 | 4B6799771099E7C50041064A /* OFObject.h */, 4B6799781099E7C50041064A /* OFObject.m */, 4B6799791099E7C50041064A /* OFPlugin.h */, 4B67997A1099E7C50041064A /* OFPlugin.m */, 4B981CDE116F71DD00294DB7 /* OFSeekableStream.h */, 4B981CDF116F71DD00294DB7 /* OFSeekableStream.m */, 4B989C2E13771A3700109A30 /* OFSerialization.h */, 4BF1BCC411C9663F0025511F /* OFSHA1Hash.h */, 4BF1BCC511C9663F0025511F /* OFSHA1Hash.m */, 4B67997D1099E7C50041064A /* OFStream.h */, 4B67997E1099E7C50041064A /* OFStream.m */, 4BAF5F47123460C900F4E111 /* OFStreamObserver.h */, 4BAF5F48123460C900F4E111 /* OFStreamObserver.m */, 4BAF5F49123460C900F4E111 /* OFStreamSocket.h */, | > | 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 | 4B6799771099E7C50041064A /* OFObject.h */, 4B6799781099E7C50041064A /* OFObject.m */, 4B6799791099E7C50041064A /* OFPlugin.h */, 4B67997A1099E7C50041064A /* OFPlugin.m */, 4B981CDE116F71DD00294DB7 /* OFSeekableStream.h */, 4B981CDF116F71DD00294DB7 /* OFSeekableStream.m */, 4B989C2E13771A3700109A30 /* OFSerialization.h */, 4BC5E7D5137F0D0E0076F962 /* OFSerialization.m */, 4BF1BCC411C9663F0025511F /* OFSHA1Hash.h */, 4BF1BCC511C9663F0025511F /* OFSHA1Hash.m */, 4B67997D1099E7C50041064A /* OFStream.h */, 4B67997E1099E7C50041064A /* OFStream.m */, 4BAF5F47123460C900F4E111 /* OFStreamObserver.h */, 4BAF5F48123460C900F4E111 /* OFStreamObserver.m */, 4BAF5F49123460C900F4E111 /* OFStreamSocket.h */, |
︙ | ︙ | |||
1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 | 4B55A100133ABEA900B58A93 /* OFThreadJoinFailedException.m in Sources */, 4B55A102133ABEA900B58A93 /* OFThreadStartFailedException.m in Sources */, 4B55A104133ABEA900B58A93 /* OFThreadStillRunningException.m in Sources */, 4B17FFAA133A34E7003E6DCD /* OFTruncatedDataException.m in Sources */, 4B17FFB6133A375B003E6DCD /* OFUnboundNamespaceException.m in Sources */, 4B17FFB2133A3664003E6DCD /* OFUnsupportedProtocolException.m in Sources */, 4B55A117133AC24600B58A93 /* OFWriteFailedException.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 4BF33AEC133807310059CEF7 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( | > | 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 | 4B55A100133ABEA900B58A93 /* OFThreadJoinFailedException.m in Sources */, 4B55A102133ABEA900B58A93 /* OFThreadStartFailedException.m in Sources */, 4B55A104133ABEA900B58A93 /* OFThreadStillRunningException.m in Sources */, 4B17FFAA133A34E7003E6DCD /* OFTruncatedDataException.m in Sources */, 4B17FFB6133A375B003E6DCD /* OFUnboundNamespaceException.m in Sources */, 4B17FFB2133A3664003E6DCD /* OFUnsupportedProtocolException.m in Sources */, 4B55A117133AC24600B58A93 /* OFWriteFailedException.m in Sources */, 4BC5E7D6137F0D0E0076F962 /* OFSerialization.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 4BF33AEC133807310059CEF7 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( |
︙ | ︙ |
Modified src/Makefile from [2f646cb5ed] to [bff15d4ff7].
︙ | ︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 | OFMutableArray.m \ OFMutableDictionary.m \ OFMutableString.m \ OFNumber.m \ OFObject.m \ ${OFPLUGIN_M} \ OFSeekableStream.m \ OFSHA1Hash.m \ OFStream.m \ OFStreamObserver.m \ OFStreamSocket.m \ OFString.m \ OFString+Hashing.m \ OFString+URLEncoding.m \ | > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | OFMutableArray.m \ OFMutableDictionary.m \ OFMutableString.m \ OFNumber.m \ OFObject.m \ ${OFPLUGIN_M} \ OFSeekableStream.m \ OFSerialization.m \ OFSHA1Hash.m \ OFStream.m \ OFStreamObserver.m \ OFStreamSocket.m \ OFString.m \ OFString+Hashing.m \ OFString+URLEncoding.m \ |
︙ | ︙ | |||
47 48 49 50 51 52 53 | OFXMLParser.m \ base64.m \ of_asprintf.m \ unicode.m INCLUDES := ${SRCS:.m=.h} \ OFCollection.h \ | < | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | OFXMLParser.m \ base64.m \ of_asprintf.m \ unicode.m INCLUDES := ${SRCS:.m=.h} \ OFCollection.h \ ObjFW.h \ asprintf.h \ ${ATOMIC_H} \ macros.h \ objfw-defs.h \ ${THREADING_H} |
︙ | ︙ |
Modified src/OFArray.m from [d444e53917] to [8ef39fadce].
︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #import "OFArray.h" #import "OFDataArray.h" #import "OFString.h" #import "OFXMLElement.h" #import "OFAutoreleasePool.h" #import "OFEnumerationMutationException.h" #import "OFOutOfRangeException.h" #import "macros.h" @implementation OFArray + array { | > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #import "OFArray.h" #import "OFDataArray.h" #import "OFString.h" #import "OFXMLElement.h" #import "OFAutoreleasePool.h" #import "OFEnumerationMutationException.h" #import "OFInvalidArgumentException.h" #import "OFOutOfRangeException.h" #import "macros.h" @implementation OFArray + array { |
︙ | ︙ | |||
217 218 219 220 221 222 223 224 225 226 227 228 229 230 | for (i = 0; i < length; i++) [objects[i] release]; [self release]; @throw e; } return self; } - (size_t)count { return [array count]; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | for (i = 0; i < length; i++) [objects[i] release]; [self release]; @throw e; } return self; } - initWithSerialization: (OFXMLElement*)element { self = [self init]; @try { OFAutoreleasePool *pool, *pool2; OFEnumerator *enumerator; OFXMLElement *child; pool = [[OFAutoreleasePool alloc] init]; if (![[element name] isEqual: @"object"] || ![[element namespace] isEqual: OF_SERIALIZATION_NS] || ![[[element attributeForName: @"class"] stringValue] isEqual: [isa className]]) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; enumerator = [[element elementsForName: @"object" namespace: OF_SERIALIZATION_NS] objectEnumerator]; pool2 = [[OFAutoreleasePool alloc] init]; while ((child = [enumerator nextObject]) != nil) { id object = [OFSerialization objectByDeserializingXMLElement: child]; [array addItem: &object]; [object retain]; [pool2 releaseObjects]; } [pool release]; } @catch (id e) { [self release]; @throw e; } return self; } - (size_t)count { return [array count]; |
︙ | ︙ |
Modified src/OFDate.m from [e2944cd61c] to [31c04ee022].
︙ | ︙ | |||
234 235 236 237 238 239 240 241 242 243 244 245 246 247 | self = [self init]; seconds += seconds_; microseconds += microseconds_; seconds += microseconds / 1000000; microseconds %= 1000000; return self; } - (BOOL)isEqual: (id)object { OFDate *otherDate; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | self = [self init]; seconds += seconds_; microseconds += microseconds_; seconds += microseconds / 1000000; microseconds %= 1000000; return self; } - initWithSerialization: (OFXMLElement*)element { self = [super init]; @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFXMLElement *secondsElement, *microsecondsElement; if (![[element name] isEqual: @"object"] || ![[element namespace] isEqual: OF_SERIALIZATION_NS] || ![[[element attributeForName: @"class"] stringValue] isEqual: [isa className]]) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; secondsElement = [element elementForName: @"seconds" namespace: OF_SERIALIZATION_NS]; microsecondsElement = [element elementForName: @"microseconds" namespace: OF_SERIALIZATION_NS]; if (secondsElement == nil || microsecondsElement == nil) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; seconds = (int64_t)[[secondsElement stringValue] decimalValue]; microseconds = (uint32_t)[[microsecondsElement stringValue] decimalValue]; [pool release]; } @catch (id e) { [self release]; @throw e; } return self; } - (BOOL)isEqual: (id)object { OFDate *otherDate; |
︙ | ︙ |
Modified src/OFDictionary.m from [5f45c17283] to [a5322a8311].
︙ | ︙ | |||
462 463 464 465 466 467 468 469 470 471 472 473 474 475 | } @catch (id e) { [object release]; @throw e; } data[j]->object = object; } } @catch (id e) { [self release]; @throw e; } return self; } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | } @catch (id e) { [object release]; @throw e; } data[j]->object = object; } } @catch (id e) { [self release]; @throw e; } return self; } - initWithSerialization: (OFXMLElement*)element { @try { OFAutoreleasePool *pool, *pool2; OFMutableDictionary *dictionary; OFArray *pairs; OFEnumerator *enumerator; OFXMLElement *pair; pool = [[OFAutoreleasePool alloc] init]; if (![[element name] isEqual: @"object"] || ![[element namespace] isEqual: OF_SERIALIZATION_NS] || ![[[element attributeForName: @"class"] stringValue] isEqual: [isa className]]) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; dictionary = [OFMutableDictionary dictionary]; pairs = [element elementsForName: @"pair" namespace: OF_SERIALIZATION_NS]; enumerator = [pairs objectEnumerator]; pool2 = [[OFAutoreleasePool alloc] init]; while ((pair = [enumerator nextObject]) != nil) { OFXMLElement *keyElement, *valueElement; id <OFSerialization, OFCopying> key; id <OFSerialization> object; keyElement = [pair elementForName: @"key" namespace: OF_SERIALIZATION_NS]; valueElement = [pair elementForName: @"value" namespace: OF_SERIALIZATION_NS]; if (keyElement == nil || valueElement == nil) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; key = [OFSerialization objectByDeserializingXMLElement: [keyElement elementForName: @"object" namespace: OF_SERIALIZATION_NS]]; object = [OFSerialization objectByDeserializingXMLElement: [valueElement elementForName: @"object" namespace: OF_SERIALIZATION_NS]]; [dictionary setObject: object forKey: key]; [pool2 releaseObjects]; } self = [self initWithDictionary: dictionary]; [pool release]; } @catch (id e) { [self release]; @throw e; } return self; } |
︙ | ︙ |
Modified src/OFList.m from [8b7bb79b80] to [3246422836].
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #import "OFList.h" #import "OFString.h" #import "OFXMLElement.h" #import "OFAutoreleasePool.h" #import "OFEnumerationMutationException.h" #import "macros.h" @implementation OFList + list { return [[[self alloc] init] autorelease]; } | > | | > > > > | > | > > > > > > > > > > > > > > > > > > > > > > > > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | #import "OFList.h" #import "OFString.h" #import "OFXMLElement.h" #import "OFAutoreleasePool.h" #import "OFEnumerationMutationException.h" #import "OFInvalidArgumentException.h" #import "macros.h" @implementation OFList + list { return [[[self alloc] init] autorelease]; } - initWithSerialization: (OFXMLElement*)element { self = [self init]; @try { OFAutoreleasePool *pool, *pool2; OFEnumerator *enumerator; OFXMLElement *child; pool = [[OFAutoreleasePool alloc] init]; if (![[element name] isEqual: @"object"] || ![[element namespace] isEqual: OF_SERIALIZATION_NS] || ![[[element attributeForName: @"class"] stringValue] isEqual: [isa className]]) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; enumerator = [[element elementsForName: @"object" namespace: OF_SERIALIZATION_NS] objectEnumerator]; pool2 = [[OFAutoreleasePool alloc] init]; while ((child = [enumerator nextObject]) != nil) { id object = [OFSerialization objectByDeserializingXMLElement: child]; [self appendObject: object]; [pool2 releaseObjects]; } [pool release]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { of_list_object_t *iter; |
︙ | ︙ | |||
173 174 175 176 177 178 179 | [listObject->object release]; [self freeMemory: listObject]; } - (id)firstObject { | | < < < | < < < | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | [listObject->object release]; [self freeMemory: listObject]; } - (id)firstObject { return (firstListObject != NULL ? firstListObject->object : nil); } - (id)lastObject { return (lastListObject != NULL ? lastListObject->object : nil); } - (size_t)count { return count; } |
︙ | ︙ |
Modified src/OFNumber.m from [01b0cb5868] to [d234546f66].
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include <math.h> #import "OFNumber.h" #import "OFString.h" #import "OFXMLElement.h" #import "OFAutoreleasePool.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "macros.h" #define RETURN_AS(t) \ switch (type) { \ | > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #include <math.h> #import "OFNumber.h" #import "OFString.h" #import "OFXMLElement.h" #import "OFAutoreleasePool.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "macros.h" #define RETURN_AS(t) \ switch (type) { \ |
︙ | ︙ | |||
699 700 701 702 703 704 705 706 707 708 709 710 711 712 | - initWithDouble: (double)double_ { self = [super init]; value.double_ = double_; type = OF_NUMBER_DOUBLE; return self; } - (of_number_type_t)type { return type; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 | - initWithDouble: (double)double_ { self = [super init]; value.double_ = double_; type = OF_NUMBER_DOUBLE; return self; } - initWithSerialization: (OFXMLElement*)element { self = [super init]; @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFString *typeString; if (![[element name] isEqual: @"object"] || ![[element namespace] isEqual: OF_SERIALIZATION_NS] || ![[[element attributeForName: @"class"] stringValue] isEqual: [isa className]]) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; typeString = [[element attributeForName: @"type"] stringValue]; if ([typeString isEqual: @"boolean"]) { type = OF_NUMBER_BOOL; if ([[element stringValue] isEqual: @"YES"]) value.bool_ = YES; else if ([[element stringValue] isEqual: @"NO"]) value.bool_ = NO; else @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; } else if ([typeString isEqual: @"unsigned"]) { /* * FIXME: This will fail if the value is bigger than * INTMAX_MAX! */ type = OF_NUMBER_UINTMAX; value.uintmax = [[element stringValue] decimalValue]; } else if ([typeString isEqual: @"signed"]) { type = OF_NUMBER_INTMAX; value.intmax = [[element stringValue] decimalValue]; } else if ([typeString isEqual: @"float"]) { type = OF_NUMBER_FLOAT; value.float_ = [[element stringValue] floatValue]; } else if ([typeString isEqual: @"double"]) { type = OF_NUMBER_DOUBLE; value.double_ = [[element stringValue] doubleValue]; } else @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; [pool release]; } @catch (id e) { [self release]; @throw e; } return self; } - (of_number_type_t)type { return type; |
︙ | ︙ |
Modified src/OFSerialization.h from [14e103c34d] to [9b361d0e27].
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ @class OFString; @class OFXMLElement; #define OF_SERIALIZATION_NS @"https://webkeks.org/objfw/serialization" /** * \brief A protocol for serializing objects. */ @protocol OFSerialization <OFObject> /** * \brief Serializes the object into an XML element. * * \return The object serialized into an XML element */ - (OFXMLElement*)XMLElementBySerializing; @end | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" @class OFString; @class OFXMLElement; #define OF_SERIALIZATION_NS @"https://webkeks.org/objfw/serialization" /** * \brief A protocol for serializing objects. */ @protocol OFSerialization <OFObject> /** * \brief Initializes the object with the specified XML element serialization. * * \param element An OFXMLElement with the serialized object * \return An initialized object */ - initWithSerialization: (OFXMLElement*)element; /** * \brief Serializes the object into an XML element. * * \return The object serialized into an XML element */ - (OFXMLElement*)XMLElementBySerializing; @end /** * \brief A class that provides class methods for serializing and deserializing * objects. */ @interface OFSerialization: OFObject /** * \brief Creates a string by serializing the specified object. * * \param object The object to serialize * \return The object serialized as a string */ + (OFString*)stringBySerializingObject: (id <OFSerialization>)object; /** * \brief Deserializes the specified string into an object. * * \param string The string describing the serialized object * \return The deserialized object */ + (id)objectByDeserializingString: (OFString*)string; /** * \brief Deserializes the specified XML element into an object. * * \param string The XML element describing the serialized object * \return The deserialized object */ + (id)objectByDeserializingXMLElement: (OFXMLElement*)element; @end |
Added src/OFSerialization.m version [551d38e4e9].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 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 122 123 124 125 126 127 128 129 130 131 | /* * Copyright (c) 2008, 2009, 2010, 2011 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #if defined(OF_APPLE_RUNTIME) || defined(OF_GNU_RUNTIME) # import <objc/runtime.h> #endif #import "OFSerialization.h" #import "OFString.h" #import "OFArray.h" #import "OFXMLElement.h" #import "OFAutoreleasePool.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #if defined(OF_OBJFW_RUNTIME) || defined(OF_OLD_GNU_RUNTIME) # define objc_lookUpClass objc_lookup_class #endif @implementation OFSerialization + (OFString*)stringBySerializingObject: (id <OFSerialization>)object { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFXMLElement *element = [object XMLElementBySerializing]; OFXMLElement *root; OFString *ret; root = [OFXMLElement elementWithName: @"serialization" namespace: OF_SERIALIZATION_NS]; [root addChild: element]; ret = [@"<?xml version='1.0' encoding='UTF-8'?>\n" stringByAppendingString: [root XMLString]]; [ret retain]; @try { [pool release]; } @catch (id e) { [ret release]; } return [ret autorelease]; } + (id)objectByDeserializingString: (OFString*)string { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFXMLElement *root = [OFXMLElement elementWithXMLString: string]; OFXMLElement *element; id object; if ([[root children] count] != 1) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; element = [[root children] firstObject]; object = [[self objectByDeserializingXMLElement: element] retain]; @try { [pool release]; } @catch (id e) { [object release]; @throw e; } return [object autorelease]; } + (id)objectByDeserializingXMLElement: (OFXMLElement*)element { OFAutoreleasePool *pool; OFString *className; Class class; id object; if (element == nil) return nil; pool = [[OFAutoreleasePool alloc] init]; className = [[element attributeForName: @"class"] stringValue]; if (className == nil) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; class = objc_lookUpClass([className cString]); if (class == Nil) @throw [OFNotImplementedException newWithClass: Nil]; if (![class instancesRespondToSelector: @selector(initWithSerialization:)]) @throw [OFNotImplementedException newWithClass: class selector: @selector(initWithSerialization:)]; object = [[class alloc] initWithSerialization: element]; @try { [pool release]; } @catch (id e) { [object release]; @throw e; } return [object autorelease]; } - init { Class c = isa; [self release]; @throw [OFNotImplementedException newWithClass: c selector: _cmd]; } @end |
Modified src/OFString.m from [581a424007] to [6df5a31603].
︙ | ︙ | |||
755 756 757 758 759 760 761 | string = [self allocMemoryWithSize: (length * 4) + 1]; for (i = 0; i < length_; i++) { of_unichar_t character = (swap ? of_bswap16(string_[i]) : string_[i]); size_t characterLen; | | | 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | string = [self allocMemoryWithSize: (length * 4) + 1]; for (i = 0; i < length_; i++) { of_unichar_t character = (swap ? of_bswap16(string_[i]) : string_[i]); size_t characterLen; /* Missing high surrogate */ if ((character & 0xFC00) == 0xDC00) @throw [OFInvalidEncodingException newWithClass: isa]; if ((character & 0xFC00) == 0xD800) { uint16_t nextCharacter; |
︙ | ︙ | |||
1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 | encoding = OF_STRING_ENCODING_UTF_8; self = [[c alloc] initWithCString: (char*)[[result data] cArray] encoding: encoding length: [[result data] count]]; [pool release]; return self; } - (const char*)cString { return string; } | > > > > > > > > > > > > > > > > > > > > > > > | 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 | encoding = OF_STRING_ENCODING_UTF_8; self = [[c alloc] initWithCString: (char*)[[result data] cArray] encoding: encoding length: [[result data] count]]; [pool release]; return self; } - initWithSerialization: (OFXMLElement*)element { @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; if (![[element name] isEqual: @"object"] || ![[element namespace] isEqual: OF_SERIALIZATION_NS] || ![[[element attributeForName: @"class"] stringValue] isEqual: [isa className]]) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; self = [self initWithString: [element stringValue]]; [pool release]; } @catch (id e) { [self release]; @throw e; } return self; } - (const char*)cString { return string; } |
︙ | ︙ |
Modified src/OFURL.m from [8362d51987] to [35c5ed8137].
︙ | ︙ | |||
283 284 285 286 287 288 289 290 291 292 293 294 295 296 | } } @catch (id e) { [self release]; @throw e; } @finally { free(cString2); } return self; } - (void)dealloc { [scheme release]; | > > > > > > > > > > > > > > > > > > > > > > > | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | } } @catch (id e) { [self release]; @throw e; } @finally { free(cString2); } return self; } - initWithSerialization: (OFXMLElement*)element { @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; if (![[element name] isEqual: @"object"] || ![[element namespace] isEqual: OF_SERIALIZATION_NS] || ![[[element attributeForName: @"class"] stringValue] isEqual: [isa className]]) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; self = [self initWithString: [element stringValue]]; [pool release]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [scheme release]; |
︙ | ︙ |
Modified src/OFXMLAttribute.m from [be193dc061] to [583d33a3b1].
︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #import "OFXMLAttribute.h" #import "OFString.h" #import "OFDictionary.h" #import "OFXMLElement.h" #import "OFAutoreleasePool.h" @implementation OFXMLAttribute + attributeWithName: (OFString*)name namespace: (OFString*)ns stringValue: (OFString*)value { return [[[self alloc] initWithName: name namespace: ns stringValue: value] autorelease]; } - initWithName: (OFString*)name_ namespace: (OFString*)ns_ stringValue: (OFString*)value { self = [super init]; @try { name = [name_ copy]; ns = [ns_ copy]; stringValue = [value copy]; } @catch (id e) { [self release]; @throw e; } return self; } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | #import "OFXMLAttribute.h" #import "OFString.h" #import "OFDictionary.h" #import "OFXMLElement.h" #import "OFAutoreleasePool.h" #import "OFInvalidArgumentException.h" @implementation OFXMLAttribute + attributeWithName: (OFString*)name namespace: (OFString*)ns stringValue: (OFString*)value { return [[[self alloc] initWithName: name namespace: ns stringValue: value] autorelease]; } - initWithName: (OFString*)name_ namespace: (OFString*)ns_ stringValue: (OFString*)value { self = [super init]; @try { name = [name_ copy]; ns = [ns_ copy]; stringValue = [value copy]; } @catch (id e) { [self release]; @throw e; } return self; } - initWithSerialization: (OFXMLElement*)element { self = [super init]; @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; if (![[element name] isEqual: @"object"] || ![[element namespace] isEqual: OF_SERIALIZATION_NS] || ![[[element attributeForName: @"class"] stringValue] isEqual: [isa className]]) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; name = [[[element elementForName: @"name" namespace: OF_SERIALIZATION_NS] stringValue] retain]; ns = [[[element elementForName: @"namespace" namespace: OF_SERIALIZATION_NS] stringValue] retain]; stringValue = [[[element elementForName: @"stringValue" namespace: OF_SERIALIZATION_NS] stringValue] retain]; [pool release]; } @catch (id e) { [self release]; @throw e; } return self; } |
︙ | ︙ |
Modified src/OFXMLElement.m from [476d990507] to [fa5a63b34f].
︙ | ︙ | |||
153 154 155 156 157 158 159 | { self = [super init]; @try { name = [name_ copy]; ns = [ns_ copy]; | < < < < < < < < < > > > | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | { self = [super init]; @try { name = [name_ copy]; ns = [ns_ copy]; namespaces = [[OFMutableDictionary alloc] initWithKeysAndObjects: @"http://www.w3.org/XML/1998/namespace", @"xml", @"http://www.w3.org/2000/xmlns/", @"xmlns", nil]; if (stringValue != nil) [self setStringValue: stringValue]; } @catch (id e) { [self release]; @throw e; } return self; } |
︙ | ︙ | |||
268 269 270 271 272 273 274 275 276 277 278 279 280 281 | if (![parser finishedParsing]) @throw [OFMalformedXMLException newWithClass: c parser: parser]; self = [delegate->element retain]; @try { [pool release]; } @catch (id e) { [self release]; @throw e; } return self; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | if (![parser finishedParsing]) @throw [OFMalformedXMLException newWithClass: c parser: parser]; self = [delegate->element retain]; @try { [pool release]; } @catch (id e) { [self release]; @throw e; } return self; } - initWithSerialization: (OFXMLElement*)element { self = [super init]; @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFXMLElement *attributesElement, *namespacesElement; OFXMLElement *childrenElement; if (![[element name] isEqual: @"object"] || ![[element namespace] isEqual: OF_SERIALIZATION_NS] || ![[[element attributeForName: @"class"] stringValue] isEqual: [isa className]]) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; name = [[[element elementForName: @"name" namespace: OF_SERIALIZATION_NS] stringValue] copy]; ns = [[[element elementForName: @"namespace" namespace: OF_SERIALIZATION_NS] stringValue] copy]; defaultNamespace = [[[element elementForName: @"defaultNamespace" namespace: OF_SERIALIZATION_NS] stringValue] copy]; characters = [[[element elementForName: @"characters" namespace: OF_SERIALIZATION_NS] stringValue] copy]; CDATA = [[[element elementForName: @"CDATA" namespace: OF_SERIALIZATION_NS] stringValue] copy]; comment = [[[element elementForName: @"comment" namespace: OF_SERIALIZATION_NS] stringValue] copy]; attributesElement = [element elementForName: @"attributes" namespace: OF_SERIALIZATION_NS]; namespacesElement = [element elementForName: @"namespaces" namespace: OF_SERIALIZATION_NS]; childrenElement = [element elementForName: @"children" namespace: OF_SERIALIZATION_NS]; attributes = [[OFSerialization objectByDeserializingXMLElement: [attributesElement elementForName: @"object" namespace: OF_SERIALIZATION_NS]] retain]; namespaces = [[OFSerialization objectByDeserializingXMLElement: [namespacesElement elementForName: @"object" namespace: OF_SERIALIZATION_NS]] retain]; children = [[OFSerialization objectByDeserializingXMLElement: [childrenElement elementForName: @"object" namespace: OF_SERIALIZATION_NS]] retain]; if (!((name != nil || ns != nil || defaultNamespace != nil || [attributes count] > 0 || [namespaces count] > 0 || [children count] > 0) ^ (characters != nil) ^ (CDATA != nil) ^ (comment != nil))) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; [pool release]; } @catch (id e) { [self release]; @throw e; } return self; |
︙ | ︙ |