/*!
  @header ECXMLControlState
  @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

  <pre>
  -------------------------------------------------------------------------
  Modification history

  27.11.05 ola     initial version
  10.02.05 ola     global rule data added
  22.08.06 ola     license changed
  -------------------------------------------------------------------------
  </pre>
*/

#if !defined(__ECXMLControlState_H)
#define __ECXMLControlState_H

#include <Foundation/Foundation.h>
#include <Encore/ECObject.h>
#include <Encore/ECStack.h>

/*!
 * @class ECXMLControlState
 * @abstract Stores the state of the XMLControl instance
 */
@interface ECXMLControlState : ECObject {
  @private 
    ECStack *userObjectStack;
    
    /**
     * Stores all objects that have been placed on the stack
     */
    NSMutableArray *allUserObjects;
    
    /**
     * a global dictionary which may be used by rules in order to manage
     * global settings/states/etc.
     */
    NSMutableDictionary *globalRuleData;
}

- init;
- (void) dealloc;


/*!
 * @method allUserObjects
 * @abstract returns all user objects which have been placed on the stack
 *   regardless of any subsequent stack operations
 * @result array of all user objects
 */
- (NSArray *) allUserObjects;


/*!
 * @method countStackObjects
 * @result returns the number of all user objects placed on the user object 
 * stack
 */
- (unsigned) countStackObjects;


/*!
 * @method globalRuleData
 * @result returns a dictionary which rules may use to store global
 *   values or state information etc. during the parsing process
 */
- (NSMutableDictionary *) globalRuleData;


/*!
 * @method popUserObject
 * @abstract removes the top element from the stack of user object
 * @discussion Note that all user objects are always available through
 *   {@link allUserObjects}, regardless of the stack operations 
 * @result the element which has been removed from the stack or nil, if stack
 *   has been empty.
 */
- popUserObject;


/*!
 * @method pushUserObject
 * @abstract puts a user object on top of the stack of user objects
 * @result self
 */
- pushUserObject: (id) aUserObject;


/*!
 * @method userObjectAtTopPosition
 * @result returns the user object at the top position of the stack of user 
 *   objects or nil, if not given
 */
- userObjectAtTopPosition;
@end
#endif
