Click here to Skip to main content
15,881,882 members
Articles / Desktop Programming / Win32

Xport: XHTML Parsing and Objective Reporting Toolkit

Rate me:
Please Sign up or sign in to vote.
4.73/5 (10 votes)
4 May 2008GPL313 min read 60K   682   32  
Open source C++ class template library for generating and parsing xhtml documents.
/************************************************************************
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
#include "xhtml_markup.h"
#include "common.h"
#include <string>


namespace Xport
{
  template<typename T, typename U> class xhtml_doctype_declaration;
  template<typename T, typename U> class xhtml_element;
}

template<typename DT, typename CT = char>
class Xport::xhtml_doctype_declaration : public xhtml_markup<DT, CT>
{
private:
  // construction/destruction
  xhtml_doctype_declaration() {}
  xhtml_doctype_declaration(const xhtml_doctype_declaration& src) : xhtml_markup<DT, CT>(src), data(src.data) {}
  virtual ~xhtml_doctype_declaration() {}

public:
  // public interface
  virtual void write(const xhtml_formatter<DT, CT>& _formatter) const { _formatter.get_doctype_decl_xhtml(this); }
  virtual xhtml_markup_type markup_type() const { return mt_doctype_declaration; }
  virtual xhtml_markup<DT, CT>& operator << (const std::basic_string<CT>& _pc_data) { data += _pc_data; return *this; }

private:
  // implementation
  virtual xhtml_markup<DT, CT>* clone() const { return new xhtml_doctype_declaration(*this); }
  virtual xhtml_nesting_type nesting_type() const { return block; }
  virtual bool validate_nesting(const xhtml_markup<DT, CT>& _xhtml_markup) const { return false; }

  // data
  std::basic_string<CT> data;

  // friends
  friend class xhtml_doc<DT, CT>;
  friend class xhtml_parser<DT, CT>;
};


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.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)



Comments and Discussions