ObjFW  Check-in [a698b98203]

Overview
Comment:Add -[hash] to OFXMLElement and OFXMLAttribute.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a698b9820324ff5a6b9f14c2a159c684c7286cb3ec517188a5331dabd5169c38
User & Date: js on 2011-06-04 16:07:34
Other Links: manifest | tags
Context
2011-06-04
16:30
Also escape \r in -[stringByXMLEscaping]. check-in: f5f074e27e user: js tags: trunk
16:07
Add -[hash] to OFXMLElement and OFXMLAttribute. check-in: a698b98203 user: js tags: trunk
16:02
Add OF_HASH_ADD_INT{16,32,64}. check-in: 871fcf6e0b user: js tags: trunk
Changes

Modified src/OFXMLAttribute.m from [a89f552160] to [cce5966614].

19
20
21
22
23
24
25


26
27
28
29
30
31
32
#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







>
>







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#import "OFXMLAttribute.h"
#import "OFString.h"
#import "OFDictionary.h"
#import "OFXMLElement.h"
#import "OFAutoreleasePool.h"

#import "OFInvalidArgumentException.h"

#import "macros.h"

@implementation OFXMLAttribute
+ attributeWithName: (OFString*)name
	  namespace: (OFString*)ns
	stringValue: (OFString*)value
{
	return [[[self alloc] initWithName: name
123
124
125
126
127
128
129















130
131
132
133
134
135
136
	if (otherAttribute->ns != ns && ![otherAttribute->ns isEqual: ns])
		return NO;
	if (![otherAttribute->stringValue isEqual: stringValue])
		return NO;

	return YES;
}
















- (OFXMLElement*)XMLElementBySerializing
{
	OFAutoreleasePool *pool;
	OFXMLElement *element;

	element = [OFXMLElement elementWithName: @"object"







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







125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
	if (otherAttribute->ns != ns && ![otherAttribute->ns isEqual: ns])
		return NO;
	if (![otherAttribute->stringValue isEqual: stringValue])
		return NO;

	return YES;
}

- (uint32_t)hash
{
	uint32_t hash;

	OF_HASH_INIT(hash);

	OF_HASH_ADD_INT32(hash, [name hash]);
	OF_HASH_ADD_INT32(hash, [ns hash]);
	OF_HASH_ADD_INT32(hash, [stringValue hash]);

	OF_HASH_FINALIZE(hash);

	return hash;
}

- (OFXMLElement*)XMLElementBySerializing
{
	OFAutoreleasePool *pool;
	OFXMLElement *element;

	element = [OFXMLElement elementWithName: @"object"

Modified src/OFXMLElement.m from [df26740729] to [803113958d].

28
29
30
31
32
33
34


35
36
37
38
39
40
41
#import "OFXMLElementBuilder.h"
#import "OFAutoreleasePool.h"

#import "OFInvalidArgumentException.h"
#import "OFMalformedXMLException.h"
#import "OFNotImplementedException.h"
#import "OFUnboundNamespaceException.h"



@interface OFXMLElement_OFXMLElementBuilderDelegate: OFObject
{
@public
	OFXMLElement *element;
}
@end







>
>







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#import "OFXMLElementBuilder.h"
#import "OFAutoreleasePool.h"

#import "OFInvalidArgumentException.h"
#import "OFMalformedXMLException.h"
#import "OFNotImplementedException.h"
#import "OFUnboundNamespaceException.h"

#import "macros.h"

@interface OFXMLElement_OFXMLElementBuilderDelegate: OFObject
{
@public
	OFXMLElement *element;
}
@end
972
973
974
975
976
977
978





















979
980
981
982
983
984
985
		return NO;
	if (otherElement->comment != comment &&
	    ![otherElement->comment isEqual: comment])
		return NO;

	return YES;
}






















- (void)dealloc
{
	[name release];
	[ns release];
	[defaultNamespace release];
	[attributes release];







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







974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
		return NO;
	if (otherElement->comment != comment &&
	    ![otherElement->comment isEqual: comment])
		return NO;

	return YES;
}

- (uint32_t)hash
{
	uint32_t hash;

	OF_HASH_INIT(hash);

	OF_HASH_ADD_INT32(hash, [name hash]);
	OF_HASH_ADD_INT32(hash, [ns hash]);
	OF_HASH_ADD_INT32(hash, [defaultNamespace hash]);
	OF_HASH_ADD_INT32(hash, [attributes hash]);
	OF_HASH_ADD_INT32(hash, [namespaces hash]);
	OF_HASH_ADD_INT32(hash, [children hash]);
	OF_HASH_ADD_INT32(hash, [characters hash]);
	OF_HASH_ADD_INT32(hash, [CDATA hash]);
	OF_HASH_ADD_INT32(hash, [comment hash]);

	OF_HASH_FINALIZE(hash);

	return hash;
}

- (void)dealloc
{
	[name release];
	[ns release];
	[defaultNamespace release];
	[attributes release];