Xport Interface: formatter::operator !
Evaluates the formatter object.
bool formatter::operator !();
Parameters
None
Returns
Returns true if it's specified output file/stream is valid and open, false otherwise.
Remarks
This operation is used to verify the state of formatter's internal output stream. The output stream/file is specified in formatter's
constructor. If a file or stream is specified which is not opened or in a bad state, this operation will return false. If the stream or file is open
and in a good state, the operation will return true.
This operation is handy for verifying the state of the formatter object before using it to format and output document's or markup
objects.
Complexity
Constant
Example
#include "xhtml_doc.h";
#include <iostream>
int main(int argc, char* argv[])
{
using namespace Xport;
std::ofstream badfile("c:/bad?file.htm");
formatter fmtr1(badfile);
std::ofstream goodfile("c:/goodfile.htm");
formatter fmtr2(goodfile);
std::ostringstream osstr;
formatter fmtr3(osstr);
formatter fmtr4(std::cout);
std::cout << "Formatter 1 is in a " << (!fmtr1 ? "bad" : "good") << " state.\n";
std::cout << "Formatter 2 is in a " << (!fmtr2 ? "bad" : "good") << " state.\n";
std::cout << "Formatter 3 is in a " << (!fmtr3 ? "bad" : "good") << " state.\n";
std::cout << "Formatter 4 is in a " << (!fmtr4 ? "bad" : "good") << " state.\n";
return 0;
}