ObjFW  Diff

Differences From Artifact [98bb225fb1]:

To Artifact [2c5b933e84]:

  • File src/OFXMLParser.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: 7059) [annotate] [blame] [check-ins using]


173
174
175
176
177
178
179
180



181








182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
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
	bool _acceptProlog;
	size_t _lineNumber;
	bool _lastCarriageReturn, _finishedParsing;
	of_string_encoding_t _encoding;
	size_t _depthLimit;
}

#ifdef OF_HAVE_PROPERTIES



@property OF_NULLABLE_PROPERTY (assign) id <OFXMLParserDelegate> delegate;








@property size_t depthLimit;
#endif

/*!
 * @brief Creates a new XML parser.
 *
 * @return A new, autoreleased OFXMLParser
 */
+ (instancetype)parser;

/*!
 * @brief Sets the delegate the XML parser should use.
 *
 * @param delegate The delegate to use
 */
- (void)setDelegate: (nullable id <OFXMLParserDelegate>)delegate;

/*!
 * @brief Returns the delegate that is used by the XML parser.
 *
 * @return The delegate that is used by the XML parser
 */
- (nullable id <OFXMLParserDelegate>)delegate;

/*!
 * @brief Returns the depth limit for the XML parser.
 *
 * @return The depth limit for the XML parser
 */
- (size_t)depthLimit;

/*!
 * @brief Sets the depth limit for the XML parser.
 *
 * If the depth limit is exceeded, an OFMalformedXMLException is thrown.
 *
 * The default is 32. 0 means unlimited (insecure!).
 *
 * @param depthLimit The depth limit for the XML parser
 */
- (void)setDepthLimit: (size_t)depthLimit;

/*!
 * @brief Parses the specified buffer with the specified size.
 *
 * @param buffer The buffer to parse
 * @param length The length of the buffer
 */
- (void)parseBuffer: (const char*)buffer







<
>
>
>

>
>
>
>
>
>
>
>

<








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







173
174
175
176
177
178
179

180
181
182
183
184
185
186
187
188
189
190
191
192

193
194
195
196
197
198
199
200
































201
202
203
204
205
206
207
	bool _acceptProlog;
	size_t _lineNumber;
	bool _lastCarriageReturn, _finishedParsing;
	of_string_encoding_t _encoding;
	size_t _depthLimit;
}


/*!
 * The delegate that is used by the XML parser.
 */
@property OF_NULLABLE_PROPERTY (assign) id <OFXMLParserDelegate> delegate;

/*!
 * The depth limit for the XML parser.
 *
 * If the depth limit is exceeded, an OFMalformedXMLException is thrown.
 *
 * The default is 32. 0 means unlimited (insecure!).
 */
@property size_t depthLimit;


/*!
 * @brief Creates a new XML parser.
 *
 * @return A new, autoreleased OFXMLParser
 */
+ (instancetype)parser;

































/*!
 * @brief Parses the specified buffer with the specified size.
 *
 * @param buffer The buffer to parse
 * @param length The length of the buffer
 */
- (void)parseBuffer: (const char*)buffer
261
262
263
264
265
266
267
268
269
270
271
272
273
274
- (size_t)lineNumber;

/*!
 * @brief Returns whether the XML parser has finished parsing.
 *
 * @return Whether the XML parser has finished parsing
 */
- (bool)finishedParsing;
@end

@interface OFObject (OFXMLParserDelegate) <OFXMLParserDelegate>
@end

OF_ASSUME_NONNULL_END







|






238
239
240
241
242
243
244
245
246
247
248
249
250
251
- (size_t)lineNumber;

/*!
 * @brief Returns whether the XML parser has finished parsing.
 *
 * @return Whether the XML parser has finished parsing
 */
- (bool)hasFinishedParsing;
@end

@interface OFObject (OFXMLParserDelegate) <OFXMLParserDelegate>
@end

OF_ASSUME_NONNULL_END