#ifndef _TK_OPTIONDEF_H_
#define _TK_OPTIONDEF_H_

#include "../../../txmlobject.h"
#include <string>

using namespace std;

class TkOptionDef:public TXmlObject
{
	string name;
	const char* optionType;
	bool quote;
	bool simpleOption;
protected:
	void doSerialize(TiXmlElement& element) const;
	void doDeserialize(const TiXmlElement& element);
public:
	static TXmlObject* newObject()
	{
		return new TkOptionDef();
	}

	static const char* type;
	const char* getType() const;

	bool compareTo(TObject* object) const
	{
		return name<((TkOptionDef*)object)->name;
	}

	TkOptionDef();
	TkOptionDef(const string& name,const char* optionType);
	TkOptionDef(const string& name,const char* optionType,bool quote);
	TkOptionDef(const string& name,const char* optionType,bool quote,bool simpleOption);

	inline const string& getName() const
	{
		return name;
	}

	bool shouldQuote() const
	{
		return quote;
	}

	bool isSimple() const
	{
		return simpleOption;
	}

	virtual bool isValid(TObject* option)
	{
		return option->typeOf(optionType);
	}
};

#endif/*_TK_OPTIONDEF_H_*/
