Xport Interface: stylesheet_item::empty
For a derived stylesheet_rule
, reveals if the rule is empty.
bool stylesheet_item::empty() const;
Parameters
None.
Returns
Returns true
if the called stylesheet_rule is empty, false
otherwise.
Remarks
When called on a derived stylesheet_rule
, reveals if the
stylesheet rule is empty. If called on a derived stylesheet_import
or stylesheet_comment
, always returns false.
Complexity
Constant
Examples
#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 " << (it->empty() ? "is" : "is not") << " empty.\n";
++it;
std::cout << "The #sidebar rule " << (it->empty() ? "is" : "is not") << " empty.\n\n";
std::cout << "Clearing the declarations from both rules.\n\n";
it->clear();
--it;
it->clear();
std::cout << "The html rule " << (it->empty() ? "is" : "is not") << " now empty.\n";
++it;
std::cout << "The #sidebar rule " << (it->empty() ? "is" : "is not") << " now empty.\n\n";
}