Xport Interface: stylesheet_item::clear
When called from a derived stylesheet_rule
removes all declarations in the stylesheet rule.
void stylesheet_item::clear();
Parameters
none
Returns
Nothing
Remarks
When called from a derived stylesheet_rule
, this operation clears the declarations within the rule. When called on a derived stylesheet_import
or stylesheet_comment
, this operation performs no action.
Complexity
Logarithmic
Example
#include "xhtml_doc.h"
#include <iostream>
int main(int argc, char* argv[])
{
using namespace Xport;
stylesheet ss;
stylesheet::iterator it = ss.insert(stylesheet_rule("html"));
it->insert(declaration(css::margin, "5px"));
it->insert(declaration(css::padding, "5px"));
it->insert(declaration(font_family, "Tahoma"));
it = ss.insert(stylesheet_rule("#sidebar"));
it->insert(declaration(css::position, "absolute"));
it->insert(declaration(css::right, "5px"));
it->insert(declaration(css::top, "10px"));
it->insert(declaration(css::width, "100px"));
it = ss.begin();
std::cout << "The html rule has " << it->size() << " declarations.\n";
++it;
std::cout << "The #sidebar rule has " << it->size() << " declarations.\n\n";
std::cout << "Clearing the declarations from both rules.\n\n";
it->clear();
--it;
it->clear();
std::cout << "The html rule now has " << it->size() << " declarations.\n";
++it;
std::cout << "The #sidebar rule now has " << it->size() << " declarations.\n\n";
}