ObjFW  Diff

Differences From Artifact [f0a48e322d]:

To Artifact [a01f4b45ec]:

  • File src/OFXMLElement.h — part of check-in [48980f2297] at 2015-11-29 11:43:05 on branch trunk — Make properties a requirement and clean up code

    This increases the required GCC version from 4.0 to 4.6 (exception:
    Apple GCC, which already supports this with >= 4.0 starting with OS X
    10.5). Since even GCC 4.6 is really old by now, there is no point in
    still supporting something even older and making the code ugly because
    of that. While some hardware and OS support was dropped from GCC 4.6
    compared to GCC 4.0, there is nothing in there that would be an
    interesting target with the exception of BeOS maybe - but a port to BeOS
    can also be achieved using the Haiku support. The other dropped OSes are
    mostly old versions of OSes while newer ones are still being supported
    (and those newer versions of those OSes still support the same
    hardware). (user: js, size: 12647) [annotate] [blame] [check-ins using]


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
{
	OFString *_name, *_namespace, *_defaultNamespace;
	OFMutableArray OF_GENERIC(OFXMLAttribute*) *_attributes;
	OFMutableDictionary OF_GENERIC(OFString*, OFString*) *_namespaces;
	OFMutableArray OF_GENERIC(OFXMLNode*) *_children;
}

#ifdef OF_HAVE_PROPERTIES



@property (copy) OFString *name;
# ifdef __cplusplus
@property OF_NULLABLE_PROPERTY (copy, getter=namespace, setter=setNamespace:)

    OFString *namespace_;
# else

@property OF_NULLABLE_PROPERTY (copy) OFString *namespace;
# endif

@property OF_NULLABLE_PROPERTY (copy) OFString *defaultNamespace;

@property OF_NULLABLE_PROPERTY (copy, readonly)
    OFArray OF_GENERIC(OFXMLAttribute*) *attributes;
@property OF_NULLABLE_PROPERTY (copy) OFArray OF_GENERIC(OFXMLNode*) *children;
#endif

/*!
 * @brief Creates a new XML element with the specified name.
 *
 * @param name The name for the element
 * @return A new autoreleased OFXMLElement with the specified element name
 */







<
>
>
>

|
<
>
|
<
>

|
>
|
>
|
<
<
<







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
{
	OFString *_name, *_namespace, *_defaultNamespace;
	OFMutableArray OF_GENERIC(OFXMLAttribute*) *_attributes;
	OFMutableDictionary OF_GENERIC(OFString*, OFString*) *_namespaces;
	OFMutableArray OF_GENERIC(OFXMLNode*) *_children;
}


/*!
 * The name of the element.
 */
@property (copy) OFString *name;


/*!
 * The namespace of the element.

 */
@property OF_NULLABLE_PROPERTY (copy) OFString *namespace;

/*!
 * The default namespace for the element to be used if there is no parent.
 */
@property OF_NULLABLE_PROPERTY (copy) OFString *defaultNamespace;




/*!
 * @brief Creates a new XML element with the specified name.
 *
 * @param name The name for the element
 * @return A new autoreleased OFXMLElement with the specified element name
 */
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
 *
 * @param path The path to the file
 * @return An initialized OFXMLElement with the contents of the specified file
 */
- initWithFile: (OFString*)path;
#endif

/*!
 * @brief Sets the name of the element.
 *
 * @param name The new name
 */
- (void)setName: (OFString*)name;

/*!
 * @brief Returns the name of the element.
 *
 * @return The name of the element
 */
- (OFString*)name;

/*!
 * @brief Sets the namespace of the element.
 *
 * @param namespace_ The new namespace
 */
- (void)setNamespace: (nullable OFString*)namespace_;

/*!
 * @brief Returns the namespace of the element.
 *
 * @return The namespace of the element
 */
- (nullable OFString*)namespace;

/*!
 * @brief Sets a prefix for a namespace.
 *
 * @param prefix The prefix for the namespace
 * @param namespace_ The namespace for which the prefix is set
 */
- (void)setPrefix: (OFString*)prefix
     forNamespace: (OFString*)namespace_;

/*!
 * @brief Binds a prefix for a namespace.
 *
 * @param prefix The prefix for the namespace
 * @param namespace_ The namespace for which the prefix is bound
 */
- (void)bindPrefix: (OFString*)prefix
      forNamespace: (OFString*)namespace_;

/*!
 * @brief Sets the default namespace for the element to be used if there is no
 *	  parent.
 *
 * @param defaultNamespace The default namespace for the element
 */
- (void)setDefaultNamespace: (nullable OFString*)defaultNamespace;

/*!
 * @brief Returns the default namespace for the element to be used if there is
 *	  no parent.
 *
 * @return The default namespace for the element to be used if there is no
 *	   parent.
 */
- (nullable OFString*)defaultNamespace;

/*!
 * @brief Returns an OFArray with the attributes of the element.
 *
 * @return An OFArray with the attributes of the element
 */
- (nullable OFArray OF_GENERIC(OFXMLAttribute*)*)attributes;








<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







199
200
201
202
203
204
205




























206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223

















224
225
226
227
228
229
230
 *
 * @param path The path to the file
 * @return An initialized OFXMLElement with the contents of the specified file
 */
- initWithFile: (OFString*)path;
#endif





























/*!
 * @brief Sets a prefix for a namespace.
 *
 * @param prefix The prefix for the namespace
 * @param namespace_ The namespace for which the prefix is set
 */
- (void)setPrefix: (OFString*)prefix
     forNamespace: (OFString*)namespace_;

/*!
 * @brief Binds a prefix for a namespace.
 *
 * @param prefix The prefix for the namespace
 * @param namespace_ The namespace for which the prefix is bound
 */
- (void)bindPrefix: (OFString*)prefix
      forNamespace: (OFString*)namespace_;


















/*!
 * @brief Returns an OFArray with the attributes of the element.
 *
 * @return An OFArray with the attributes of the element
 */
- (nullable OFArray OF_GENERIC(OFXMLAttribute*)*)attributes;