ObjFW  Check-in [fd4f24cc22]

Overview
Comment:Add +[attributeWithName:stringValue:].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: fd4f24cc2265730d13246d6515bd38c08b7b9f69f971a23aefa1f1a7986c74e6
User & Date: js on 2012-11-12 11:55:54
Other Links: manifest | tags
Context
2012-11-14
08:00
Fix objc_get_type_encoding(). check-in: 28f58d5a6e user: js tags: trunk
2012-11-12
11:55
Add +[attributeWithName:stringValue:]. check-in: fd4f24cc22 user: js tags: trunk
11:30
Update ChangeLog for 0.7.1. check-in: f2e5c1b668 user: js tags: trunk
Changes

Modified src/OFXMLAttribute.h from [c19bf55bb6] to [a1c5c13489].

33
34
35
36
37
38
39










40
41
42
43
44
45
46
47
48










49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
@property (readonly, copy) OFString *name;
@property (readonly, copy, getter=namespace) OFString *ns;
@property (readonly, copy) OFString *stringValue;
#endif

/*!
 * @brief Creates a new XML attribute.










 *
 * @param name The name of the attribute
 * @param ns The namespace of the attribute
 * @param value The string value of the attribute
 * @return A new autoreleased OFXMLAttribute with the specified parameters
 */
+ (instancetype)attributeWithName: (OFString*)name
			namespace: (OFString*)ns
		      stringValue: (OFString*)value;











/*!
 * @brief Initializes an already allocated OFXMLAttribute.
 *
 * @param name The name of the attribute
 * @param ns The namespace of the attribute
 * @param value The string value of the attribute
 * @return An initialized OFXMLAttribute with the specified parameters
 */
- initWithName: (OFString*)name
     namespace: (OFString*)ns
   stringValue: (OFString*)value;

/*!
 * @brief Returns the name of the attribute as an autoreleased OFString.
 *
 * @return The name of the attribute as an autoreleased OFString
 */
- (OFString*)name;







>
>
>
>
>
>
>
>
>
>



|




|
>
>
>
>
>
>
>
>
>
>






|




|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
@property (readonly, copy) OFString *name;
@property (readonly, copy, getter=namespace) OFString *ns;
@property (readonly, copy) OFString *stringValue;
#endif

/*!
 * @brief Creates a new XML attribute.
 *
 * @param name The name of the attribute
 * @param stringValue The string value of the attribute
 * @return A new autoreleased OFXMLAttribute with the specified parameters
 */
+ (instancetype)attributeWithName: (OFString*)name
		      stringValue: (OFString*)stringValue;

/*!
 * @brief Creates a new XML attribute.
 *
 * @param name The name of the attribute
 * @param ns The namespace of the attribute
 * @param stringValue The string value of the attribute
 * @return A new autoreleased OFXMLAttribute with the specified parameters
 */
+ (instancetype)attributeWithName: (OFString*)name
			namespace: (OFString*)ns
		      stringValue: (OFString*)stringValue;

/*!
 * @brief Initializes an already allocated OFXMLAttribute.
 *
 * @param name The name of the attribute
 * @param stringValue The string value of the attribute
 * @return An initialized OFXMLAttribute with the specified parameters
 */
- initWithName: (OFString*)name
   stringValue: (OFString*)stringValue;

/*!
 * @brief Initializes an already allocated OFXMLAttribute.
 *
 * @param name The name of the attribute
 * @param ns The namespace of the attribute
 * @param stringValue The string value of the attribute
 * @return An initialized OFXMLAttribute with the specified parameters
 */
- initWithName: (OFString*)name
     namespace: (OFString*)ns
   stringValue: (OFString*)stringValue;

/*!
 * @brief Returns the name of the attribute as an autoreleased OFString.
 *
 * @return The name of the attribute as an autoreleased OFString
 */
- (OFString*)name;

Modified src/OFXMLAttribute.m from [cc7877f544] to [a8302232a0].

25
26
27
28
29
30
31
32
33
34
35















36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

#import "autorelease.h"
#import "macros.h"

@implementation OFXMLAttribute
+ (instancetype)attributeWithName: (OFString*)name
			namespace: (OFString*)ns
		      stringValue: (OFString*)value
{
	return [[[self alloc] initWithName: name
				 namespace: ns















			       stringValue: value] autorelease];
}

- initWithName: (OFString*)name_
     namespace: (OFString*)ns_
   stringValue: (OFString*)value
{
	self = [super init];

	@try {
		name = [name_ copy];
		ns = [ns_ copy];
		stringValue = [value copy];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}







|



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|




|






|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

#import "autorelease.h"
#import "macros.h"

@implementation OFXMLAttribute
+ (instancetype)attributeWithName: (OFString*)name
			namespace: (OFString*)ns
		      stringValue: (OFString*)stringValue
{
	return [[[self alloc] initWithName: name
				 namespace: ns
			       stringValue: stringValue] autorelease];
}

+ (instancetype)attributeWithName: (OFString*)name
		      stringValue: (OFString*)stringValue
{
	return [[[self alloc] initWithName: name
			       stringValue: stringValue] autorelease];
}

- initWithName: (OFString*)name_
   stringValue: (OFString*)stringValue_
{
	return [self initWithName: name_
			namespace: nil
		      stringValue: stringValue_];
}

- initWithName: (OFString*)name_
     namespace: (OFString*)ns_
   stringValue: (OFString*)stringValue_
{
	self = [super init];

	@try {
		name = [name_ copy];
		ns = [ns_ copy];
		stringValue = [stringValue_ copy];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}