Beispiel #1
0
	void write_argument_value(tstring const& data)
	{
		// http://www.w3.org/TR/REC-xml/#NT-AttValue
		// says that in att value, we escape " ' < and &
		static const tstring patterns = "\"'<&";
		static const tstring replacements[] = {
			"&quot;", "&apos;", "&lt;", "&amp;"
		};
		xml_content_encoder encoder(data, patterns, replacements);
		while( encoder.has_next() ) {
			tinfra::tstring chunk = encoder.next();
			out_->write(chunk.data(), chunk.size());
		}
	}
Beispiel #2
0
	void write_content_bytes(tstring const& data)
	{
		// http://www.w3.org/TR/REC-xml/#dt-chardata
		// says that only < and & are escaped 
		// in normal text
		static const tstring patterns = "<&";
		static const tstring replacements[] = {
			"&lt;", "&amp;"
		};
		xml_content_encoder encoder(data, patterns, replacements); 
		while( encoder.has_next() ) {
			tinfra::tstring chunk = encoder.next();
			out_->write(chunk.data(), chunk.size());
		}
	}
Beispiel #3
0
//static 
void public_tracer::print_tracer_usage(tinfra::output_stream& out, tstring const&)
{
    std::ostringstream tmp;
    tmp << "Trace system arguments:\n"
           "    --tracer-help        print tracers list and usage\n"
           "    --tracer-enable=name enable specific tracer\n"
           "\n"
           "Available tracers:\n";;
    std::vector<public_tracer*> const r = get_global_tracers();
    for(std::vector<public_tracer*>::const_iterator i = r.begin(); i != r.end(); ++i ) {
        tracer* t = *i;
        const char* name = t->get_name();
        if( !name ) // protect against misconstructed tracers 
            continue;
        tmp << "    " << t->get_name() << std::endl;
    }
    out.write(tmp.str());
}
Beispiel #4
0
	void write_character(char c)
	{
		out_->write(&c, 1);
	}
Beispiel #5
0
	void write_bytes(tstring const& data)
	{
		out_->write(data.data(), data.size());
	}