/*

cls_2: Curl Like Syntax
Yauheni A. Akhotnikau (C) 2001-2003
eao197@yahoo.com
-------------------------------------------------

Permission is granted to anyone to use this software for any purpose on any
computer system, and to redistribute it freely, subject to the following
restrictions:

1. This software 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.

2. The origin of this software must not be misrepresented, either by
   explicit claim or by omission.

3. Altered versions must be plainly marked as such, and must not be
   misrepresented as being the original software.

-------------------------------------------------

*/

/*!
	\file
	\brief Класс тега, который не имеет собственного значения.
*/

#if !defined( _CLS_2__TAG_NO_VALUE_HPP_ )
#define _CLS_2__TAG_NO_VALUE_HPP_

#include <cls_2/h/cls.hpp>

namespace cls_2 {

//
// tag_no_value_t
//

/*!
	\brief Tag which do not accept token "NONSPACE" or "STRING".

	May be used as container for child tags.
*/
class	tag_no_value_t :
	public tag_t {
	public :
		//! Стандатный конструктор.
		tag_no_value_t(
			const char * name,
			bool is_mandatory,
			bool is_one_copy_only );
		//! Конструктор для случая, когда тег является
		//! подчиненным тегом.
		/*! \since v.2.6.2 */
		tag_no_value_t(
			//! Владелец, к которому мы будем автоматически добавлены.
			tag_t & owner,
			const char * name,
			bool is_mandatory,
			bool is_one_copy_only );
		virtual ~tag_no_value_t();

		// Returns c_semantic_error if tag is already defined and
		// only one copy of tag is allowed
		virtual int
		on_start(
			parser_context_t & context );

		// Returns c_ok.
		virtual int
		on_finish(
			parser_context_t & context );

		// Returns c_semantic_error
		virtual int
		on_tok_nonspace(
			parser_context_t & context,
			const char * tok_value );

		// Returns c_semantic_error
		virtual int
		on_tok_string(
			parser_context_t & context,
			const char * tok_value );

		virtual bool
		is_mandatory() const;

		virtual bool
		is_defined() const;

		// Clears is_defined flag
		virtual void
		reset();

		void
		make_defined();

	protected :
		bool	m_is_mandatory;
		bool	m_is_defined;
		bool	m_is_one_copy_only;
};

} /* namespace cls_2 */

#endif
