Index: src/Makefile ================================================================== --- src/Makefile +++ src/Makefile @@ -65,11 +65,11 @@ of_strptime.m \ unicode.m INCLUDES := ${SRCS:.m=.h} \ OFCollection.h \ - OFJSON.h \ + OFJSONEncoding.h \ OFSerialization.h \ ObjFW.h \ asprintf.h \ ${ATOMIC_H} \ macros.h \ Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -18,11 +18,11 @@ #import "OFObject.h" #import "OFCollection.h" #import "OFEnumerator.h" #import "OFSerialization.h" -#import "OFJSON.h" +#import "OFJSONEncoding.h" @class OFString; #ifdef OF_HAVE_BLOCKS typedef void (^of_array_enumeration_block_t)(id object, size_t index, Index: src/OFDictionary.h ================================================================== --- src/OFDictionary.h +++ src/OFDictionary.h @@ -18,11 +18,11 @@ #import "OFObject.h" #import "OFCollection.h" #import "OFEnumerator.h" #import "OFSerialization.h" -#import "OFJSON.h" +#import "OFJSONEncoding.h" @class OFArray; #ifdef OF_HAVE_BLOCKS typedef void (^of_dictionary_enumeration_block_t)(id key, id object, DELETED src/OFJSON.h Index: src/OFJSON.h ================================================================== --- src/OFJSON.h +++ src/OFJSON.h @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011 - * Jonathan Schleifer - * - * 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. - */ - -@class OFString; - -/** - * \brief A category implemented by classes that support a JSON representation. - */ -@protocol OFJSON -/** - * \brief Returns the JSON representation of the object as a string. - * - * \return The JSON representation of the object as a string. - */ -- (OFString*)JSONRepresentation; -@end ADDED src/OFJSONEncoding.h Index: src/OFJSONEncoding.h ================================================================== --- src/OFJSONEncoding.h +++ src/OFJSONEncoding.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011 + * Jonathan Schleifer + * + * 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. + */ + +@class OFString; + +/** + * \brief A category implemented by classes that support encoding to a JSON + * representation. + * + * \warning Although this method can be called directly on classes other than + * OFArray and OFDictionary, this will generate invalid JSON, as JSON + * requires all data to be encapsulated in an array or a dictionary! + */ +@protocol OFJSON +/** + * \brief Returns the JSON representation of the object as a string. + * + * \return The JSON representation of the object as a string. + */ +- (OFString*)JSONRepresentation; +@end Index: src/OFNull.h ================================================================== --- src/OFNull.h +++ src/OFNull.h @@ -14,11 +14,11 @@ * file. */ #import "OFObject.h" #import "OFSerialization.h" -#import "OFJSON.h" +#import "OFJSONEncoding.h" /** * \brief A class for representing null values in collections. */ @interface OFNull: OFObject Index: src/OFNumber.h ================================================================== --- src/OFNumber.h +++ src/OFNumber.h @@ -16,11 +16,11 @@ #include #import "OFObject.h" #import "OFSerialization.h" -#import "OFJSON.h" +#import "OFJSONEncoding.h" /** * \brief The type of a number. */ typedef enum of_number_type_t { Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -18,11 +18,11 @@ #include #include #import "OFObject.h" #import "OFSerialization.h" -#import "OFJSON.h" +#import "OFJSONEncoding.h" #import "macros.h" @class OFConstantString;