Xport Interface: stylesheet_item::iterator::iterator
Constructor for stylesheet_item::iterator and stylesheet_item::const_iterator.
stylesheet_item::iterator::iterator(); iterator
stylesheet_item::const_iterator::const_iterator(); const_iterator
Parameters
None
Remarks
Constructs a styleshet item iterator or const_iterator. A
stylesheet item iterator is usually initialized upon creation, normally by calling stylesheet_item::begin() or from a return value from one of
stylesheet_item's operations.
Complexity
Constant
Example
#include "xhtml_doc.h"
#include <iostream>
int main(int argc, char* argv[])
{
using namespace Xport;
stylesheet ss;
ss << stylesheet_comment("Sample stylesheet\n-----------------------------")
<< (stylesheet_rule("h1") << declaration(css::color, "red") << declaration(text_align, "center"))
<< (stylesheet_rule("p") << declaration(padding_left, "5px") << declaration(margin_top, "10px"))
<< (stylesheet_rule("#footer") << declaration(css::height, "50px") << declaration(css::border, "thin solid green"));
stylesheet_formatter fmtr(std::cout);
fmtr << ss;
std::cout << "\n\nList the stylesheet items individually.\n\n";
stylesheet::iterator it = ss.begin();
++it;
assert(it->selector() == "h1");
stylesheet_item::iterator sit = it->begin();
for (; sit != it->end(); ++sit) {
std::cout << sit->property_name() << ": " << sit->value() << "\n";
}
std::cout << "\n\n";
}