|
/************************************************************************
Xport: XHTML Parsing & Objective Reporting Toolkit
Copyright (C) 2007 Mitchel Haas
This file is part of Xport.
Xport 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, either version 3 of the License, or
(at your option) any later version.
Xport 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 Xport. If not, see <http://www.gnu.org/licenses/>.
For complete documentation on this library and alternative
licensing options, visit http://www.xportpro.com
Email questions, comments or suggestions to mitchel.haas@xportpro.com
************************************************************************/
#pragma once
// temp includes
#include "xhtml_transitional.h"
#include "xhtml_frameset.h"
#include "xhtml_strict.h"
#include "tag_trait.h"
#include "tag_traits.h"
#include "common.h"
#include <map>
#include <set>
#include <sstream>
#include <stdexcept>
namespace Xport
{
template<typename T, typename U> class tag;
template<typename T, typename U> class xhtml_element;
template<typename T, typename U> class xhtml_end_tag;
template<typename T, typename U> class tag_trait;
template<typename T, typename U> class xhtml_doc;
template<typename T, typename U> class xhtml_formatter;
template<typename T, typename U> class xhtml_parser;
}
template <typename DT, typename CT>
class Xport::tag
{
private:
tag();
explicit tag(xhtml_tag_enum t) { pTag_trait = Tag_traits.get_tag_trait(t);}
~tag();
typedef std::set<xhtml_tag_enum> doc_type_set;
// private interface
bool allow_pcdata() const;
xhtml_nesting_type allowed_nested_type() const { return pTag_trait->allowed_nested_type(); }
bool check_attribute(const attribute::xhtml_attribute attrib) const { return pTag_trait->check_attribute(attrib); }
bool empty_tag() const { return pTag_trait->empty_tag(); }
std::basic_string<CT> end_tag() const;
xhtml_nesting_type nesting_type() const;
xhtml_tag_enum tag_enumeration() const {return pTag_trait->tag_enumeration(); }
std::basic_string<CT> tag_name() const;
bool validate_nesting(const tag* pChild_tag) const;
private:
// data
const tag_trait<DT, CT>* pTag_trait;
static tag_traits<DT, CT> Tag_traits;
// friends
friend class tag_traits<DT, CT>;
friend class xhtml_element<DT, CT>;
friend class xhtml_end_tag<DT, CT>;
};
#include "tag.inl"
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.