Jlm
Namespaces | Classes | Enumerations | Functions | Variables
jlm::util::graph Namespace Reference

Namespaces

 Colors
 

Classes

class  GraphElement
 
class  Port
 
class  Node
 
class  InputPort
 
class  OutputPort
 
class  InOutNode
 
class  ArgumentNode
 
class  ResultNode
 
class  Edge
 
class  Graph
 
class  Writer
 

Enumerations

enum class  OutputFormat { Dot , ASCII }
 
enum class  AttributeOutputFormat { SpaceSeparatedList , HTMLAttributes }
 

Functions

static bool LooksLikeIdentifier (std::string_view string)
 
static void PrintIdentifierSafe (std::ostream &out, std::string_view string)
 
static void PrintStringAsHtmlText (std::ostream &out, std::string_view string, bool replaceNewlines)
 
static void PrintStringAsHtmlAttributeName (std::ostream &out, std::string_view string)
 
static const char * Indent (size_t indent)
 

Variables

static const char *const TOOLTIP_ATTRIBUTE = "tooltip"
 
static const char *const EDGE_ID_ATTRIBUTE = "id"
 

Enumeration Type Documentation

◆ AttributeOutputFormat

Enumerator
SpaceSeparatedList 
HTMLAttributes 

Definition at line 27 of file GraphWriter.hpp.

◆ OutputFormat

Enumerator
Dot 
ASCII 

Definition at line 21 of file GraphWriter.hpp.

Function Documentation

◆ Indent()

static const char* jlm::util::graph::Indent ( size_t  indent)
static

Returns a C string with the given amount of indentation. The string is valid until this function is called again.

Parameters
indentthe number of indentation levels
Returns
a string of spaces corresponding to the indentation level.

Definition at line 133 of file GraphWriter.cpp.

◆ LooksLikeIdentifier()

static bool jlm::util::graph::LooksLikeIdentifier ( std::string_view  string)
static

Checks if the provided string looks like a regular C identifier. The string may only contain alphanumeric characters and underscore, and not start with a digit.

Returns
true if the passed string passes as a C identifier.

Definition at line 23 of file GraphWriter.cpp.

◆ PrintIdentifierSafe()

static void jlm::util::graph::PrintIdentifierSafe ( std::ostream &  out,
std::string_view  string 
)
static

Prints the given string to out, while escaping special characters. Unless the string looks like a regular C / Dot identifier, it is surrounded in quotes.

Definition at line 54 of file GraphWriter.cpp.

◆ PrintStringAsHtmlAttributeName()

static void jlm::util::graph::PrintStringAsHtmlAttributeName ( std::ostream &  out,
std::string_view  string 
)
static

Prints the given string to out, replacing chars that are not allowed in html attribute names by '-'

Definition at line 114 of file GraphWriter.cpp.

◆ PrintStringAsHtmlText()

static void jlm::util::graph::PrintStringAsHtmlText ( std::ostream &  out,
std::string_view  string,
bool  replaceNewlines 
)
static

Prints the given string to out with HTML special chars escaped. If replaceNewlines is true, newlines are replaced by
, otherwise they are kept as is. Newlines are allowed inside HTML attributes, but are ignored in HTML text.

Definition at line 90 of file GraphWriter.cpp.

Variable Documentation

◆ EDGE_ID_ATTRIBUTE

const char* const jlm::util::graph::EDGE_ID_ATTRIBUTE = "id"
static

Definition at line 15 of file GraphWriter.cpp.

◆ TOOLTIP_ATTRIBUTE

const char* const jlm::util::graph::TOOLTIP_ATTRIBUTE = "tooltip"
static

Definition at line 13 of file GraphWriter.cpp.