/*!
@header ECXMLControlReferenceRule
@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
10.02.06 ola initial version
22.08.06 ola license changed
-------------------------------------------------------------------------
*/
#if !defined(__ECXMLControlReferenceRule_H)
#define __ECXMLControlReferenceRule_H
#include
#include
#include
/*!
@class ECXMLControlReferenceRule
@abstract This rule allows the definition of anchors and their
corresponding references.
@discussion Through this rule it is possible to set an anchor and by doing
so, to refer to the corresponding object later in the xml parsing step. The
reference results in a corresponding setter call. Example:
<house id="house-id"/>
<Contract price="128.231,75" object-idref="house-id"/>
In this example the object allocated by <Contracr> will be hand-off
the previously allocate instance related to <house> by calling the
related setter method setObject or addObject.
The underlying rules are as follows:
- id-attribute: This attribute specifies the name under which the
object, which is currently on top of the stack, has to be registered.
The identifier behind has to be unique wrt. the whole file.
- <attributename>-idref-attribute: Looks for an object
which has been registered with the value specified by this attribute.
The registration must habe been done before! If the registired object
is found then the underlying setting method is called using
<attributename> as the base name.
Regarding the lookup for the corresponding setting method please refer
to ECXMLControlSetterLookupUtil.
*/
@interface ECXMLControlReferenceRule : ECObject {
@private
ECXMLControlSetterLookupUtil *setterLookupUtil;
}
- init;
- (void) dealloc;
/*!
* @method addObject
* @abstract Internal method used to register an object which may be
* references.
* @param anObject related object
* @param aRefId underlying reference identifier
* @param aDictionary dictionary used to store the new identifier and the
* corresponding object
* @result self
*/
- addObject: (id) anObject withRefId: (NSString *) aRefId
usingDictionary: (NSMutableDictionary *) aDicitonary;
/*!
* @method respondsToContext
* @param aContext current context to evaluate
* @result YES if the receiver should be valuated according to the given
* context
*/
- (BOOL) mayActOn: (ECXMLControlContext *) aContext;
/*!
* @method actOn
* @param aContext current context to evaluate
* @result YES if no more rules should be evaluated
*/
- (BOOL) actOn: (ECXMLControlContext *) aContext;
/*!
* @method setReferenceToObject
* @abstract Hands-off a referenced object to the object currently being on top
* of the stack
* @param idName identifier string which references the object to hand-off
* @param anObject object to which the referenced object has to be hand-off
* @param methodName method to call
* @param aDicitonary global rule dictionary where the references are managed.
* @result self
*/
- setReferenceToObject: (id) anObject
objectIdReference: (NSString *) idName
usingMethod: (NSString *) methodName
usingDictionary: (NSMutableDictionary *) aDictionary;
@end
#endif