xml_output.cpp

Go to the documentation of this file.
00001 
00011 #include <sstream>
00012 #include <iostream>
00013 
00014 #include "op_xml_out.h"
00015 #include "xml_output.h"
00016 
00017 using namespace std;
00018 
00019 #define MAX_XML_BUF 16384
00020 static char buf[MAX_XML_BUF];
00021 
00022 string tag_name(tag_t tag)
00023 {
00024     ostringstream out;
00025     out << xml_tag_name(tag);
00026     return out.str();
00027 }
00028 
00029 
00030 string open_element(tag_t tag, bool with_attrs)
00031 {
00032     ostringstream out;
00033 
00034     buf[0] = '\0';
00035     open_xml_element(tag, with_attrs, buf, MAX_XML_BUF);
00036     out << buf;
00037     return out.str();
00038 }
00039 
00040 
00041 string close_element(tag_t tag, bool has_nested)
00042 {
00043     ostringstream out;
00044 
00045     buf[0] = '\0';
00046     close_xml_element(tag, has_nested, buf, MAX_XML_BUF);
00047     out << buf;
00048     return out.str();
00049 }
00050 
00051 
00052 string init_attr(tag_t attr, size_t value)
00053 {
00054     ostringstream out;
00055 
00056     buf[0] = '\0';
00057     init_xml_int_attr(attr, value, buf, MAX_XML_BUF);
00058     out << buf;
00059     return out.str();
00060 }
00061 
00062 
00063 string init_attr(tag_t attr, double value)
00064 {
00065     ostringstream out;
00066 
00067     buf[0] = '\0';
00068     init_xml_dbl_attr(attr, value, buf, MAX_XML_BUF);
00069     out << buf;
00070     return out.str();
00071 }
00072 
00073 
00074 string init_attr(tag_t attr, string const & str)
00075 {
00076     ostringstream out;
00077 
00078     buf[0] = '\0';
00079     init_xml_str_attr(attr, str.c_str(), buf, MAX_XML_BUF);
00080     out << buf;
00081     return out.str();
00082 }

Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1