Click here to Skip to main content
15,886,026 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 60.1K   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 <string>

namespace Xport
{
  template<typename T, typename U, typename V, typename W> class xhtml_comment;
  template<typename T, typename U, typename V, typename W> class xhtml_element;
  template<typename T, typename U, typename V, typename W> class xhtml_formatter;
}

template<typename DT, typename CT, typename MBT, typename SBT> 
class Xport::xhtml_comment : public MBT
{
public:
  // construction/destruction
  xhtml_comment() {}
  explicit xhtml_comment(const std::basic_string<CT>& pcdat);
  xhtml_comment(const xhtml_comment& src) : MBT(src), data(src.data) {}
  ~xhtml_comment() {}

  // interface
  virtual void write(const xhtml_formatter<DT, CT, MBT, SBT>& fmtr) const { fmtr.get_comment_xhtml(data); }
  virtual xhtml_markup_type markup_type() const { return mt_comment; }
  virtual MBT& operator << (const std::basic_string<CT>& pcdat) { data += pcdat; return *this; }

private:
  // implementation
  virtual MBT* clone() const { return new xhtml_comment(*this); }
  virtual const xhtml_comment* get_xhtml_comment() const { return this; }
  virtual xhtml_nesting_type nesting_type() const { return in_line; }
  virtual bool validate_nesting(const MBT& markup) const { return false; }

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

#include "xhtml_comment.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.

License

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



Comments and Discussions