|
/************************************************************************
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 "common.h"
namespace Xport
{
template<typename T> class stylesheet_declaration;
template<typename T> class xhtml_stylesheet_rule;
template<typename T> bool operator == (const stylesheet_declaration<T>& lhs, const stylesheet_declaration<T>& rhs) { return lhs.property() == rhs.property() && lhs.value() == rhs.value(); }
template<typename T>
struct property_comp
{
property_comp(css::css_property p) : prop(p) {}
bool operator() (const stylesheet_declaration<T>& decl) { return decl.property() == prop; }
css::css_property prop;
};
}
template<typename CT = char>
class Xport::stylesheet_declaration
{
public:
// construction/destruction
explicit stylesheet_declaration(css::css_property property, const std::basic_string<CT>& value) : decl_property(property), decl_value(value) {}
// interface
css::css_property property() const { return decl_property; }
std::basic_string<CT> property_name() const { std::basic_string<CT> name; get_css_property_name(decl_property, name); return name; }
std::basic_string<CT> value() const { return decl_value; }
void value(const std::basic_string<CT>& value) { decl_value = value; }
private:
stylesheet_declaration();
private:
// data
css::css_property decl_property;
std::basic_string<CT> decl_value;
// friends
#if defined(_MSC_VER) && _MSC_VER < 1300
friend class xhtml_stylesheet_rule<CT>;
#else
template<typename T> friend class xhtml_stylesheet_rule;
#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.