ObjFW  Check-in [cb3be92fe6]

Overview
Comment:Add serialization for OFURL and OFXMLElement.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cb3be92fe617d429562381dae6c636c33d9a817c026e77bca312889467500d45
User & Date: js on 2011-05-08 22:42:03
Other Links: manifest | tags
Context
2011-05-08
22:48
Add an initial description of the serialization format. check-in: 08fcd6d53e user: js tags: trunk
22:42
Add serialization for OFURL and OFXMLElement. check-in: cb3be92fe6 user: js tags: trunk
22:36
Change serialization format. check-in: 17d18368bb user: js tags: trunk
Changes

Modified src/OFURL.h from [75baa54cee] to [0d2f2e2772].

11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26
27
28
29
30
31
 * 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;

/**
 * \brief A class for parsing URLs and accessing parts of it.
 */
@interface OFURL: OFObject <OFCopying>
{
	OFString *scheme;
	OFString *host;
	uint16_t port;
	OFString *user;
	OFString *password;
	OFString *path;







>






|







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.
 */

#import "OFObject.h"
#import "OFSerialization.h"

@class OFString;

/**
 * \brief A class for parsing URLs and accessing parts of it.
 */
@interface OFURL: OFObject <OFCopying, OFSerialization>
{
	OFString *scheme;
	OFString *host;
	uint16_t port;
	OFString *user;
	OFString *password;
	OFString *path;

Modified src/OFURL.m from [01254b0236] to [e8aceda7df].

525
526
527
528
529
530
531
















532
	return ret;
}

- (OFString*)description
{
	return [self string];
}
















@end







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
	return ret;
}

- (OFString*)description
{
	return [self string];
}

- (OFString*)stringBySerializing
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFString *ret = [[OFString alloc]
	    initWithFormat: @"(class=OFURL)<%@>",
			    [[self string] stringBySerializing]];

	@try {
		[pool release];
	} @finally {
		[ret autorelease];
	}

	return ret;
}
@end

Modified src/OFXMLElement.h from [ccc3d2d9aa] to [416e9abf0e].

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
 * 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 OFArray;
@class OFMutableString;
@class OFMutableArray;
@class OFMutableDictionary;
@class OFXMLAttribute;

/**
 * \brief A class which stores an XML element.
 */
@interface OFXMLElement: OFObject
{
	OFString *name;
	OFString *ns;
	OFString *defaultNamespace;
	OFMutableArray *attributes;
	OFMutableDictionary *namespaces;
	OFMutableArray *children;







>











|







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
 * 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"
#import "OFSerialization.h"

@class OFString;
@class OFArray;
@class OFMutableString;
@class OFMutableArray;
@class OFMutableDictionary;
@class OFXMLAttribute;

/**
 * \brief A class which stores an XML element.
 */
@interface OFXMLElement: OFObject <OFSerialization>
{
	OFString *name;
	OFString *ns;
	OFString *defaultNamespace;
	OFMutableArray *attributes;
	OFMutableDictionary *namespaces;
	OFMutableArray *children;

Modified src/OFXMLElement.m from [f7cabbca27] to [7b911a3167].

564
565
566
567
568
569
570
















571
572
573
574
575
576
577
	return [self _XMLStringWithParent: nil];
}

- (OFString*)description
{
	return [self XMLString];
}

















- (void)addAttribute: (OFXMLAttribute*)attribute
{
	if (name == nil)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
	return [self _XMLStringWithParent: nil];
}

- (OFString*)description
{
	return [self XMLString];
}

- (OFString*)stringBySerializing
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFString *ret = [[OFString alloc]
	    initWithFormat: @"(class=OFXMLElement)<%@>",
			    [[self XMLString] stringBySerializing]];

	@try {
		[pool release];
	} @finally {
		[ret autorelease];
	}

	return ret;
}

- (void)addAttribute: (OFXMLAttribute*)attribute
{
	if (name == nil)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];