17 std::string Indent(
int numSpaces)
20 for (
int i = 0; i < numSpaces; i++)
27 std::string Escape(std::string s)
44 GetStream() <<
" POINT-SIZE=" <<
"\"" << fontSize <<
"\"";
47 if (color && std::strlen(color) != 0)
49 GetStream() <<
" COLOR=\"" << color <<
"\" ";
52 if (face && std::strlen(face) != 0)
54 GetStream() <<
" FACE=\"" << face <<
"\" ";
62 :
HtmlFont(stream, -1, nullptr, nullptr)
80 for (
auto&& attrib : m_Attributes)
97 ss << name <<
"=" << value.str();
98 m_Attributes.push_back(ss.str());
104 std::stringstream ss;
105 ss << name <<
"=" << value;
106 m_Attributes.push_back(ss.str());
112 std::stringstream ss;
113 ss << name <<
"=\"" << value <<
"\"";
114 m_Attributes.push_back(ss.str());
121 std::stringstream ss;
122 ss << Indent(4) << fromNodeId <<
" -> " << toNodeId <<
" ";
125 m_Attributes = std::make_unique<DotAttributeSet>(stream);
130 m_Attributes.reset(
nullptr);
148 m_Contents.push_back(content);
154 std::stringstream ss;
155 ss <<
"label=\"{" << m_Name;
156 if (!m_Contents.empty())
160 for (
auto & content : m_Contents)
162 ss << Escape(content);
173 catch (
const std::exception&) { }
181 std::stringstream ss;
182 ss << Indent(4) << nodeId;
186 m_Contents = std::make_unique<NodeContent>(stream);
187 m_Attributes = std::make_unique<DotAttributeSet>(stream);
189 if (std::strlen(label) != 0)
191 m_Contents->SetName(label);
195 m_Contents->SetName(
"<noname>");
201 m_Contents.reset(
nullptr);
202 m_Attributes.reset(
nullptr);
210 std::stringstream ss;
211 ss << Indent(4) << type;
214 m_Attributes = std::make_unique<DotAttributeSet>(stream);
219 m_Attributes.reset(
nullptr);
226 GetStream() <<
"digraph " << name <<
" {" << std::endl;
DotGraph(std::ostream &stream, const char *name)
NodeContent & AddContent(const std::string &content)
Copyright (c) 2021 ARM Limited and Contributors.
DotDefaults(std::ostream &stream, const char *type)
DotAttributeSet & AddAttribute(const std::string &name, const std::stringstream &value)
DotNode(std::ostream &stream, LayerGuid nodeId, const char *label)
HtmlFont(std::ostream &stream, int fontSize, const char *color, const char *face)
std::ostream & GetStream()
NodeContent(std::ostream &stream)
void StringReplaceAll(std::string &str, const std::string &oldStr, const std::string &newStr)
Iterates over a given str and replaces all instance of substring oldStr with newStr.
DotEdge(std::ostream &stream, LayerGuid fromNodeId, LayerGuid toNodeId)
NodeContent & SetName(const std::string &name)
DotAttributeSet(std::ostream &stream)