Vuo  2.3.2
VuoCompilerComment.cc
Go to the documentation of this file.
1 
10 #include <sstream>
11 
12 #include "VuoCompilerComment.hh"
13 #include "VuoComment.hh"
14 #include "VuoStringUtilities.hh"
15 
20  : VuoBaseDetail<VuoComment>("VuoComment", baseComment)
21 {
22  getBase()->setCompiler(this);
23  this->graphvizIdentifier = getGraphvizIdentifierPrefix();
24 }
25 
30 {
31  return "Comment";
32 }
33 
38 {
39  return graphvizIdentifier;
40 }
41 
45 void VuoCompilerComment::setGraphvizIdentifier(string graphvizIdentifier)
46 {
47  this->graphvizIdentifier = graphvizIdentifier;
48 }
49 
54 string VuoCompilerComment::getGraphvizDeclaration(double xPositionOffset, double yPositionOffset)
55 {
56  ostringstream declaration;
57 
58  // name
59  declaration << getGraphvizIdentifier();
60 
61  // type
62  declaration << " [type=\"" << VuoComment::commentTypeName << "\"";
63 
64  // label
65  declaration << " label=\"" << VuoStringUtilities::transcodeToGraphvizIdentifier(getBase()->getContent()) << "\"";
66 
67  // position
68  declaration << " pos=\"" << getBase()->getX()+xPositionOffset << "," << getBase()->getY()+yPositionOffset << "\"";
69 
70  // width
71  declaration << " width=\"" << getBase()->getWidth() << "\"";
72 
73  // height
74  declaration << " height=\"" << getBase()->getHeight() << "\"";
75 
76  // tint color
77  if (getBase()->getTintColor() != VuoNode::TintNone)
78  declaration << " fillcolor=\"" << getBase()->getTintColorGraphvizName() << "\"";
79 
80  declaration << "];";
81 
82  return declaration.str();
83 }