Artifact ccf852396a1cd48fb34a7d1f720d6d4a3081492e52f57d7f239190e41a8144de:
- File
src/OFXMLElement+Serialization.m
— part of check-in
[9ddd33a258]
at
2013-01-12 17:29:24
on branch trunk
— Rename *UsingEncoding: to *WithEncoding:.
This reverts 5362941.
Even though *UsingEncoding: is what Foundation uses, *WithEncoding: is
more natural and is more consistent with the rest. Also, this means this
restores it to the API of 0.7. (user: js, size: 1408) [annotate] [blame] [check-ins using]
/* * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 * 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" #import "OFXMLElement.h" #import "OFXMLElement+Serialization.h" #import "OFSerialization.h" #import "OFString.h" #import "OFInvalidArgumentException.h" #import "autorelease.h" #import "macros.h" int _OFXMLElement_Serialization_reference; @implementation OFXMLElement (Serialization) - (id)objectByDeserializing { void *pool = objc_autoreleasePoolPush(); Class class; id object; if ((class = objc_getClass([name cStringWithEncoding: OF_STRING_ENCODING_ASCII])) == Nil) @throw [OFInvalidArgumentException exceptionWithClass: [self class]]; if (![class conformsToProtocol: @protocol(OFSerialization)]) @throw [OFInvalidArgumentException exceptionWithClass: [self class]]; object = [[class alloc] initWithSerialization: self]; objc_autoreleasePoolPop(pool); return [object autorelease]; } @end