Artifact 306536eaaf291c059e7318f2dcdad19a89d1f6f8c49fe75e09e736b5d07e7747:
- File
src/OFXMLElement+Serialization.m
— part of check-in
[2a27cf3000]
at
2016-01-03 00:41:26
on branch trunk
— Update copyright
While at it, also update the mail address. (user: js, size: 1323) [annotate] [blame] [check-ins using] [more...]
/* * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 * Jonathan Schleifer <js@heap.zone> * * 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" 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 exception]; if (![class conformsToProtocol: @protocol(OFSerialization)]) @throw [OFInvalidArgumentException exception]; object = [[class alloc] initWithSerialization: self]; objc_autoreleasePoolPop(pool); return [object autorelease]; } @end