Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches

reference-counted strings More...

Collaboration diagram for string utilities:

Functions

char * agstrdup (Agraph_t *, const char *)
 returns a pointer to a reference-counted copy of the argument string, creating one if necessary
 
char * agstrdup_html (Agraph_t *, const char *)
 
int aghtmlstr (const char *)
 
char * agstrbind (Agraph_t *g, const char *)
 
int agstrfree (Agraph_t *, const char *)
 
char * agcanon (char *str, int html)
 
char * agstrcanon (char *, char *)
 
char * agcanonStr (char *str)
 

Detailed Description

Storage management of strings as reference-counted strings. The caller does not need to dynamically allocate storage.

All uses of cgraph strings need to be freed using agstrfree in order to correctly maintain the reference count.

agcanonStr returns a pointer to a version of the input string canonicalized for output for later re-parsing. This includes quoting special characters and keywords. It uses its own internal buffer, so the value will be lost on the next call to agcanonStr. agcanon is identical with agcanonStr except it can be used with any character string. The second argument indicates whether or not the string should be canonicalized as an HTML-like string.

Function Documentation

◆ agcanon()

char * agcanon ( char *  str,
int  html 
)

canonicalize a string for printing. If html is true, use HTML canonicalization. Shared static buffer - unsafe.

Definition at line 252 of file write.c.

References _agstrcanon(), agcanonhtmlstr(), getoutputbuffer(), NULL, and str.

Here is the call graph for this function:

◆ agcanonStr()

char * agcanonStr ( char *  str)

canonicalize a string for printing. must agree with strings in scan.l Shared static buffer - unsafe.

Definition at line 239 of file write.c.

References agstrcanon(), getoutputbuffer(), NULL, and str.

Referenced by _write_canonstr(), canon(), canon(), write_plain(), and writenodeandport().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ aghtmlstr()

int aghtmlstr ( const char *  s)

query if a string is an ordinary string or an HTML-like string

Definition at line 164 of file refstr.c.

References refstr_t::is_html, NULL, and store().

Referenced by agcopyattr(), agstrcanon(), cloneAttrs(), cloneDfltAttrs(), common_init_edge(), common_init_node(), copyAttr(), do_graph_label(), getval(), myagxget(), write_port(), and writeNondefaultAttr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agstrbind()

char * agstrbind ( Agraph_t g,
const char *  s 
)

returns a pointer to a reference-counted string if it exists, or NULL if not

Definition at line 96 of file refstr.c.

References refdict(), and refstrbind().

Referenced by aginternalmaplookup(), idmap(), and myiddisc_map().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agstrcanon()

char * agstrcanon ( char *  arg,
char *  buf 
)

canonicalize a string for printing. must agree with strings in scan.l Unsafe if buffer is not large enough.

Definition at line 209 of file write.c.

References _agstrcanon(), agcanonhtmlstr(), and aghtmlstr().

Referenced by agcanonStr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agstrdup()

char * agstrdup ( Agraph_t g,
const char *  s 
)

Definition at line 131 of file refstr.c.

References agstrdup_internal().

Referenced by addattr(), agbindrec(), aginternalmapinsert(), agmakeattrs(), agnewsym(), agxset(), canon(), concat(), concat(), concatPort(), concatPort(), endstr(), endstr(), gvusershape_open(), idmap(), myiddisc_map(), setattr(), and write_canonstr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agstrdup_html()

char * agstrdup_html ( Agraph_t g,
const char *  s 
)

create an HTML-like string

Definition at line 135 of file refstr.c.

References agstrdup_internal().

Referenced by cloneAttrs(), cloneDfltAttrs(), copyAttr(), endstr_html(), endstr_html(), myagxset(), myagxset(), and toHtml().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agstrfree()

int agstrfree ( Agraph_t g,
const char *  s 
)

Definition at line 139 of file refstr.c.

References agdtdelete(), FAILURE, NULL, refstr_t::refcnt, refdict(), refsymbind(), refstr_t::s, and SUCCESS.

Referenced by agdelrec(), aginternalmapdelete(), agrecclose(), agxset(), appendnode(), appendnode(), bindattrs(), bindattrs(), canon(), cloneAttrs(), cloneDfltAttrs(), concat(), concat(), concatPort(), concatPort(), copyAttr(), delete_items(), delete_items(), freeattr(), freesym(), freeUsershape(), idfree(), myiddisc_free(), opensubg(), opensubg(), setattr(), startgraph(), startgraph(), and write_canonstr().

Here is the call graph for this function:
Here is the caller graph for this function: