A formatter_boolean_option enumerator which specifies the boolean option to set or retrieve.
int_opt
An formatter_integer_option enumerator which specifies the integer option to set or retrieve.
string_opt
A formatter_string_option enumerator which specifies the string option to set or retrieve.
bool_value
A boolean value which will set the specified boolean option.
int_opt
An integer value which will set the specified boolean option.
string_value
A string value which will set the specified boolean option.
Returns
In the first setting variety, returns a boolean value disclosing the state of the specified option.
In the second setting variety, returns an integer disclosing the integer value of the specified option.
In the third setting variety, returns a string disclosing the string value of the specified option.
Remarks
This operation is used to set and retrieve various formatting options of the called formatter object. The various options are described
below. Many more options will be added to the list below, allowing more control of the formatted xhtml output.
All options in formatter are distinguished, set, and retrieved, by enumerations. The table below lists the various options now available
in formatter, and their default values. As more options are added, they will be added to the list.
Option enumerator
Option type
Default
Description
newline_after_selector
boolean
false
Determines if a newline is written after the selector, but before the first brace.
selector_indent
integer
0
Determines the number of spaces the selector and braces are indented.
declaration_indent
integer
3
Determines the number of spaces the declarations are indented.
rule_heading
string
""
Determines the rule heading format for all rules.
Complexity
Constant
Examples
selector_indent example
#include "xhtml_doc.h"
#include "xport_brochure.h"
#include <iostream>
int main(int argc, char* argv[])
{
using namespace Xport;
stylesheet ss;
// insert a couple rules
ss << (stylesheet_rule("h1") << declaration(text_align, "center") << declaration(css::color, "red"));
ss << (stylesheet_rule("p") << declaration(margin_top, "10px") << declaration(padding_left, "5px"));
std::cout << "stylesheet with default formatter.\n";
stylesheet_formatter fmtr(std::cout);
fmtr << ss;
std::cout << "\n\n";
std::cout << "Setting selector indent to 2 on formatter, and listing stylesheet again.\n";
fmtr.option(selector_indent, 2);
fmtr << ss;
std::cout << "\n\n";
}
declaration_indent example
#include "xhtml_doc.h"
#include <iostream>
int main(int argc, char* argv[])
{
using namespace Xport;
stylesheet ss;
// insert a couple rules
ss << (stylesheet_rule("h1") << declaration(text_align, "center") << declaration(css::color, "red"));
ss << (stylesheet_rule("p") << declaration(margin_top, "10px") << declaration(padding_left, "5px"));
std::cout << "stylesheet with default formatter.\n";
stylesheet_formatter fmtr(std::cout);
fmtr << ss;
std::cout << "\n\n";
std::cout << "Setting declaration indent to 1 on formatter, and listing stylesheet again.\n";
fmtr.option(declaration_indent, 1);
fmtr << ss;
std::cout << "\n\n";
}
newline_after_selector example
#include "xhtml_doc.h"
#include <iostream>
int main(int argc, char* argv[])
{
using namespace Xport;
stylesheet ss;
// insert a couple rules
ss << (stylesheet_rule("h1") << declaration(text_align, "center") << declaration(css::color, "red"));
ss << (stylesheet_rule("p") << declaration(margin_top, "10px") << declaration(padding_left, "5px"));
std::cout << "Xport brochure stylesheet with default formatter.\n";
stylesheet_formatter fmtr(std::cout);
fmtr << ss;
std::cout << "\n\n";
std::cout << "Setting newline after selector, and listing stylesheet again.\n";
fmtr.option(newline_after_selector, true);
fmtr << ss;
std::cout << "\n\n";
}
Datasoft Solutions is proud to present their landmark product, Work Time Studio. Utilizing the tree container library, Work Time Studio provides
unparalleled features in personal time, project and task management
software. If you're looking for a way to increase your productivity,
visit Work Time Studio's product website, and start being more productive
today.