Xport Interface: stylesheet::iterator::operator ->
Pointer operator for stylesheet::iterator and stylesheet::const_iterator.
stylesheet_item* stylesheet::iterator::operator ->() const; iterator
const stylesheet_item* stylesheet::const_iterator::operator *() const; const_iterator
Parameters
None
Returns
Returns a pointer (or const pointer for const_iterator) to the underlying stylesheet item.
Remarks
Returns a pointer to the underlying stylesheet item (for iterator), and a const pointer to the stylesheet item (for const_iterator). This can be very
handy, especially for the non-const stylesheet iterator, as it
allows you to insert declarations into an underlying stylesheet rule, as shown in the example below.
Complexity
Constant
Example
#include "xhtml_doc.h"
#include <iostream>
int main(int argc, char* argv[])
{
using namespace Xport;
stylesheet ss;
ss.insert(stylesheet_comment("Sample stylesheet"));
stylesheet::iterator it = ss.insert(stylesheet_rule("h1"));
it->insert(declaration(text_align, "center"));
it->insert(declaration(css::color, "red"));
it = ss.insert(stylesheet_rule("p"));
it->insert(declaration(margin_left, "10px"));
it->insert(declaration(font_size, "10pt"));
stylesheet_formatter fmtr(std::cout);
ss.write(fmtr);
std::cout << "\n\nWrite the individual items in the spreadsheet.\n\n";
it = ss.begin();
for (; it != ss.end(); ++it) {
it->write(fmtr);
std::cout << "\n\n";
}
}