|
/************************************************************************
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 "xhtml_formatter.h"
#include <string>
#include <sstream>
namespace Xport
{
template<typename T, typename U> class xhtml_pcdata;
template<typename T, typename U> class xhtml_element;
}
template<typename DT, typename CT>
class Xport::xhtml_pcdata : public xhtml_markup<DT, CT>
{
public:
// construction/destruction
explicit xhtml_pcdata(const std::basic_string<CT>& _data) : xhtml_markup<DT, CT>(), data(_data) {}
virtual ~xhtml_pcdata() {}
private:
xhtml_pcdata();
public:
// public interface
virtual void write(const xhtml_formatter<DT, CT>& fmtr) const { fmtr.get_pcdata_xhtml(this, data); }
virtual xhtml_markup_type markup_type() const { return mt_pcdata; }
virtual xhtml_markup<DT, CT>& operator << (const std::basic_string<CT>& pcdat) { data += pcdat; return *this; }
private:
// implementation
virtual xhtml_markup<DT, CT>* clone() const { return new xhtml_pcdata<DT, CT>(*this); }
virtual xhtml_nesting_type nesting_type() const { return pc_data; }
virtual void remove_trailing_whitespace() { right_trim(data); }
virtual bool validate_nesting(const xhtml_markup<DT, CT>& markup) const { return false; }
// data
std::basic_string<CT> data;
// friends
#if defined(_MSC_VER) && _MSC_VER < 1300
friend class xhtml_element<DT, CT>;
#else
template<typename T, typename U> friend class xhtml_element;
#endif
};
|
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.