Graphviz 12.0.1~dev.20240715.2254
|
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 *) |
char * | agcanon (char *str, int 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 * agcanon | ( | char * | str, |
int | html | ||
) |
canonicalize a string for printing. If html is true, use HTML canonicalization. Shared static buffer - unsafe.
Definition at line 250 of file write.c.
References _agstrcanon(), agcanonhtmlstr(), getoutputbuffer(), NULL, and str.
char * agcanonStr | ( | char * | str | ) |
canonicalize a string for printing. must agree with strings in scan.l Shared static buffer - unsafe.
Definition at line 237 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 163 of file refstr.c.
References refstr_t::is_html, key, 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().
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 95 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 207 of file write.c.
References _agstrcanon(), agcanonhtmlstr(), and aghtmlstr().
Referenced by agcanonStr().
char * agstrdup | ( | Agraph_t * | g, |
const char * | s | ||
) |
Definition at line 130 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 134 of file refstr.c.
References agstrdup_internal().
Referenced by cloneAttrs(), cloneDfltAttrs(), copyAttr(), endstr_html(), endstr_html(), myagxset(), myagxset(), and toHtml().
int agstrfree | ( | Agraph_t * | g, |
const char * | s | ||
) |
Definition at line 138 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().