/*!
@header ECXMLControl
@abstract Module of Encore
@availability OS X, GNUstep
@copyright 2004, 2005, 2006 Oliver Langer
Author: Oliver Langer
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-------------------------------------------------------------------------
Modification history
27.11.05 ola initial version
04.08.06 ola -ruleSelector added
22.08.06 ola license changed
-------------------------------------------------------------------------
*/
#if !defined(__ECXMLControl_H)
#define __ECXMLControl_H
#include
#include
@class ECXMLControlState;
@class ECXMLControlRuleSelector;
/*!
* @class ECXMLControl
* @abstract Constructs a graph of objects based on an XML stream.
*/
@interface ECXMLControl : ECObject {
@private
NSXMLParser *parser;
ECXMLControlState *state;
ECXMLControlRuleSelector *ruleSelector;
BOOL defaultRulesAdded;
BOOL defaultRulesEnabled;
id errorHandler;
SEL errorHandlerMethod;
}
/*!
* @method initWithContentsOfURL
* @abstract initializes using a specified file
* @param anURL URL to read the XML data from
* @result self
*/
- initWithContentsOfURL: (NSURL *) anURL;
/*!
* @method initWithData
* @abstract Initializes using the specified data
* @param data data to be intepreted as XML
* @result self
*/
- initWithData: (NSData *) data;
- (void) dealloc;
/*!
* @method addDefaultRules
* @abstract Method used to add the default rules to this controller.
* These rules are ECXMLControlDefaultAllocatorRule,
* ECXMLControlReferenceRule, ECXMLControlSetAttributeRule,
* ECXMLControlLinkObjectRule
* @discussion This method is automatically been called by the implementation
* before the parsing process if not one before.
* @result self
*/
- addDefaultRules;
/*!
* @method enableDefaultRules
* @abstract By default the default rules are enabled. Using this method they
* may be disabled.
* @param enable if NO then default rules are disabled.
* @result self
*/
- enableDefaultRules: (BOOL) enable;
/*!
* @method userObjects
* @result returns all allocated user objects in the order of their
* allocation.an empty array may be returned if no object has been allocated.
*/
- (NSArray *) userObjects;
/*!
* @method parseXML
* @abstract starts parsing the given XML
* @result resulting root object
*/
- parseXML;
/*!
* @method rootUserObject
* @result returns the first allocated user object, which normally represents
* the root object. nil may be returned if no object has been allocated.
*/
- (id) rootUserObject;
/*!
* @method ruleSelector
* @abstract returns the underlying rule selector. this instance may be used to
* install own rules
* @discussion Note: Modifying the rule selector during the parsing process is
* undefined.
* @result underlying rule selector
*/
- (ECXMLControlRuleSelector *) ruleSelector;
/*!
* @method delegateErrorsTo
* @abstract Specifies the method used to call in case of an parsing error
* @discussion This method has to conform to
- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError
* @param anErrorHandler error handling getting the underlying NSXMLParser
* instance and an error code
* @result self
*/
- delegateErrorsTo: (id) receiver usingMethod: (SEL) anErrorHandler;
@end
#endif