Xport Interface: stylesheet_item::iterator::operator *
Dereference operator for stylesheet_item::iterator and stylesheet_item::const_iterator.
declaration& stylesheet_item::iterator::operator *() const; iterator
const declaration& stylesheet_item::const_iterator::operator *() const; const_iterator
Parameters
None
Returns
Returns a reference (or const reference for const_iterator) to the underlying declaration.
Remarks
Dereferences the stylesheet iterator, returning a reference to
the underlying declaration (for iterator), and a const reference to the underlying declaration (for const_iterator).
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, "left")
<< declaration(padding_left, "5px")
<< declaration(margin_top, "10px"));
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::const_iterator sit = it->begin();
for (; sit != it->end(); ++sit) {
declaration decl = *sit;
std::cout << decl.property_name() << ": " << decl.value() << "\n";
}
std::cout << "\n\n";
}