/**
 * File: contextxmlhandler.cpp
 * Created by: <Joern Reimerdes>
 * Created on: 2004/10/13 18:00 
 * @file
 * $Id$
 * $Revision$
 * $Author$
 * $Date$
 *
 * This file is a part of The iWear Framework.
 * In particular is this file a part of the Framework context Library
 *
 * The iWear Framework is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by the
 * Free Software Foundation as in version 2 of the License.

 * 
 * The iWear Framework 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 General Public License for
 * more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * The iWear Framework; if not, write to the Free Software Foundation, Inc., 59
 * Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <iwear-context/contextxmlhandler.h>

namespace iwear {
namespace context {


    ContextXMLHandler::ContextXMLHandler(XMLHandler* xml_handler){
	this->xml_handler = xml_handler;
	this->init_constants();
    }

    ContextXMLHandler::~ContextXMLHandler(){
    }

    /** Initialises the node name and attribute name constants if they
     * were net initialised before.
     */
    void ContextXMLHandler::init_constants(void){
	if (NODE_CONTEXTS == NULL){
	    /* XML nodes names */
	    NODE_CONTEXTS = XMLString::transcode("contexts");
	    NODE_CONTEXT = XMLString::transcode("context");

	    NODE_ATOMIC = XMLString::transcode("atomic");
	    NODE_SENSOR = XMLString::transcode("sensor");
	    NODE_COMPOSITE = XMLString::transcode("composite");
	    NODE_LOGIC = XMLString::transcode("logic");
	    NODE_CONTEXT_REF = XMLString::transcode("contextref");
    
	    NODE_DEFINITIONS = XMLString::transcode("definitions");
	    NODE_COMPARISON = XMLString::transcode("comparison");
	    NODE_LOGIC_RELATION = XMLString::transcode("logicrelation");
	    NODE_VALUE_TYPE = XMLString::transcode("valuetype");

	    /* XML attribute names */

	    ATTRIBUTE_NAME = XMLString::transcode("name");
	    ATTRIBUTE_TYPE = XMLString::transcode("type");
	    ATTRIBUTE_COMPARE_VALUE = XMLString::transcode("comparevalue");
	    ATTRIBUTE_COMPARISON = XMLString::transcode("comparison");
	    ATTRIBUTE_UNIT = XMLString::transcode("unit");
	    ATTRIBUTE_ACCURACY = XMLString::transcode("accuracy");
	    ATTRIBUTE_VALUE_TYPE = XMLString::transcode("valuetype");
	    ATTRIBUTE_LOGIC_RELATION = XMLString::transcode("logicrelation");
	    ATTRIBUTE_OPERATOR = XMLString::transcode("operator");

	    /* values */
	    VALUE_AND = XMLString::transcode("and");
	    VALUE_OR = XMLString::transcode("or");

	    VALUE_EQUALS = XMLString::transcode("equals");
	    VALUE_NOT_EQUALS = XMLString::transcode("not equals");
	    VALUE_GREATER = XMLString::transcode("greater");
	    VALUE_LOWER = XMLString::transcode("lower");
	    VALUE_GREATER_EQUALS = XMLString::transcode("greater equals");
	    VALUE_LOWER_EQUALS = XMLString::transcode("lower equals");

	    VALUE_BOOLEAN = XMLString::transcode("boolean");
	    VALUE_DATE = XMLString::transcode("date");
	    VALUE_NOMINAL = XMLString::transcode("nominal");
	    VALUE_ORDINAL = XMLString::transcode("ordinal");
	    VALUE_DISCRETE = XMLString::transcode("discrete");
	    VALUE_CONTINOUS = XMLString::transcode("continous");
	    VALUE_ACCURACY = XMLString::transcode("accuracy");
	}
    }

} // context
} // iwear

