9#include "abg-internal.h"
11ABG_BEGIN_EXPORT_DECLARATIONS
15ABG_END_EXPORT_DECLARATIONS
22using std::ostringstream;
26const style child_sty = { color::white, color::gray75,
"" };
29units_type node_base::_M_count_total;
36 std::string filename(_M_title +
".gv");
37 std::ofstream f(filename);
38 if (!f.is_open() || !f.good())
39 throw std::runtime_error(
"abigail::dot::write fail");
41 f << _M_sstream.str() << std::endl;
43 catch(std::exception& e)
54 _M_sstream <<
"digraph ";
56 _M_sstream <<
"{" << std::endl;
60 const std::string edge_default = R
"_delimiter_(edge [fontname="FreeSans",fontsize="9",labelfontname="FreeSans",labelfontsize="9"];)_delimiter_";
61 const std::string node_default = R
"_delimiter_(node [fontname="FreeSans",fontsize="9",shape=record];)_delimiter_";
63 _M_sstream << edge_default << std::endl;
64 _M_sstream << node_default << std::endl;
70 _M_sstream <<
"}" << std::endl;
77 _M_sstream <<
'"' << _M_title <<
'"' << std::endl;
83dot::add_node(
const node_base& __node)
85 _M_sstream <<
"Node" << __node._M_count <<
" ";
87 const std::string label(
"__label");
88 const std::string height(
"__height");
89 const std::string width(
"__width");
91 std::string strip = R
"_delimiter_([label="__label", height=__height, width=__width, color="black", fillcolor="white", style="filled"];)_delimiter_";
97 _M_sstream << strip << std::endl;
101dot::add_edge(
const node_base& __parent,
const node_base& __child)
104 std::string style = R
"_delimiter_([dir="forward",color="midnightblue",fontsize="9",style="solid",fontname="FreeSans"];)_delimiter_";
106 _M_sstream << "Node" << __parent._M_count <<
"->";
107 _M_sstream <<
"Node" << __child._M_count;
108 _M_sstream << style << std::endl;
112dot::add_parent(
const parent_node& __p)
118dot::add_child_to_node(
const child_node& __c,
const node_base& __p)
Toplevel namespace for libabigail.
void string_replace(std::string &target, const std::string &match, const std::string &replace)
Utility function, like regex_replace.
const style parent_sty
Useful constants.
Datum consolidating style preferences.