Graphviz 13.0.0~dev.20250121.0651
|
reference-counted strings More...
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 *, bool is_html) |
char * | agstrcanon (char *, char *) |
char * | agcanonStr (char *str) |
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.
char * agcanonStr | ( | char * | str | ) |
canonicalize a string for printing. must agree with strings in scan.l Shared static buffer - unsafe.
Definition at line 249 of file write.c.
References agstrcanon(), getoutputbuffer(), NULL, and str.
Referenced by _write_canonstr(), canon(), canon(), write_plain(), and writenodeandport().
int aghtmlstr | ( | const char * | s | ) |
query if a string is an ordinary string or an HTML-like string
Definition at line 401 of file refstr.c.
References refstr_t::is_html, and NULL.
Referenced by addattr(), agcopyattr(), agcopydict(), agmakeattrs(), agstrcanon(), agxset_(), applyattrs(), applyattrs(), attrstmt(), attrstmt(), cloneAttrs(), cloneDfltAttrs(), cloneGraph(), common_init_edge(), common_init_node(), copyAttr(), copyAttr(), delete_items(), delete_items(), do_graph_label(), freeattr(), freesym(), getval(), myagxget(), setattr(), unviewsubgraphsattr(), write_port(), and writeNondefaultAttr().
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 337 of file refstr.c.
References refdict(), and refstrbind().
Referenced by aginternalmaplookup(), idmap(), and myiddisc_map().
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 219 of file write.c.
References _agstrcanon(), agcanonhtmlstr(), and aghtmlstr().
Referenced by agcanonStr().
char * agstrdup | ( | Agraph_t * | g, |
const char * | s | ||
) |
Definition at line 370 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().
char * agstrdup_html | ( | Agraph_t * | g, |
const char * | s | ||
) |
create an HTML-like string
Definition at line 374 of file refstr.c.
References agstrdup_internal().
Referenced by addattr(), agmakeattrs(), agnewsym(), agxset_(), cloneAttrs(), copyAttr(), endstr_html(), endstr_html(), myagxset(), myagxset(), setattr(), and toHtml().
int agstrfree | ( | Agraph_t * | g, |
const char * | s, | ||
bool | is_html | ||
) |
is_html | Is the string being freed an HTML-like string? |
Definition at line 378 of file refstr.c.
References FAILURE, NULL, refstr_t::refcnt, refdict(), refstr_t::s, strdict_find(), strdict_remove(), and SUCCESS.
Referenced by agdelrec(), aginternalmapdelete(), agrecclose(), agxset_(), appendnode(), appendnode(), bindattrs(), bindattrs(), canon(), cloneAttrs(), concat(), concat(), concatPort(), concatPort(), copyAttr(), delete_items(), delete_items(), freeattr(), freesym(), freeUsershape(), idfree(), myiddisc_free(), opensubg(), opensubg(), setattr(), startgraph(), startgraph(), and write_canonstr().