/*! @header ECXMLControlDefaultRule @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
  22.08.06 ola     license changed
  -------------------------------------------------------------------------
  
*/ #if !defined(__ECXMLControlDefaultRule_H) #define __ECXMLControlDefaultRule_H #include #include #include #include @class ECXMLControlSetterLookupUtil; /*! * @class ECXMLControlSetAttributeRule * @abstract Used to call the appropriate method in order to hand-off an * the attribute's value */ @interface ECXMLControlSetAttributeRule : ECObject { @private ECXMLControlSetterLookupUtil *setterLookupUtil; } - init; - (void) dealloc; /*! * @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; @end /* ---------------------------------- */ /*! * @class ECXMLControlLinkObjectRule * @abstract This rule is being executed when closing an xml element. * It links the underlying object to it's super object by calling one * of the setter methods, if available. Also it pops the current top user * object from the stack. It ignores the first one. */ @interface ECXMLControlLinkObjectRule : ECObject { @private ECXMLControlSetterLookupUtil *setterLookupUtil; } - init; - (void) dealloc; /*! * @method actOn * @param aContext current context to evaluate * @result YES if no more rules should be evaluated */ - (BOOL) actOn: (ECXMLControlContext *) aContext; /*! * @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; @end // ---------------------------------- ECXMLControlSetterLookupUtil /*! * @class ECXMLControlSetterLookupUtil * @abstract This class is used to lookup an appropriate method for a given * attribute name and a given object * @discussion See {@link addMethodNameSchema} for the syntax of the method * naming scheme. By default, the schemes set%@%@ and add%@%@ are added. */ @interface ECXMLControlSetterLookupUtil : ECObject { @private NSMutableArray *namesForSetterMethods; } - init; - (void) dealloc; /*! * @method addMethodNameSchema * @abstract Used to add a new pattern for a method name. * @discussion The pattern must contain two substitution strings for * objc strings (%@). The first one will be replaced by the first character * of an attribute name. The second will be replaced by all remaining * characters of the attribute name. Through this mechanism we can use * various combinations using an uppercase first letter and a lowercase * first letter for the method name.

* E.g.: pattern is set%@%@ * attribute name is "money" * This will result in an attempt to look for one of the following method * names: setMoney, setmoney */ - addMethodNameSchema: (NSString *) aMethodNameSchema; /*! * @method lookupMethodForAttributeName * @abstract Looks for a particular method which can be used as a setter * @discussion The method name schemes will be tried in the order they are * added to this object. * method wrt. to the given method name schemes * (see {@link addMethodNameSchema}). * @param anAttributeName name of the attribute to set * @param aTargetObject underlying object to evaluate * @result selector or NULL, if it could not be found */ - (SEL) lookupMethodForAttributeName: (NSString *) anAttributeName ofObject: (id) aTargetObject; @end #endif