Graphviz 13.0.0~dev.20250424.1043
|
Modules | |
records | |
These records are attached by client programs dynamically at runtime. | |
Files | |
file | attr.c |
implementation of dynamic attributes | |
Data Structures | |
struct | Agattr_s |
string attribute container More... | |
struct | Agsym_s |
string attribute descriptor symbol in Agattr_s.dict More... | |
struct | Agdatadict_s |
Functions | |
Agdatadict_t * | agdatadict (Agraph_t *g, bool cflag) |
Agattr_t * | agattrrec (void *obj) |
void | agraphattr_init (Agraph_t *g) |
int | agraphattr_delete (Agraph_t *g) |
void | agnodeattr_init (Agraph_t *g, Agnode_t *n) |
void | agnodeattr_delete (Agnode_t *n) |
void | agedgeattr_init (Agraph_t *g, Agedge_t *e) |
void | agedgeattr_delete (Agedge_t *e) |
Agsym_t * | agattr_text (Agraph_t *g, int kind, char *name, const char *value) |
creates or looks up text attributes of a graph | |
Agsym_t * | agattr_html (Agraph_t *g, int kind, char *name, const char *value) |
agattr_text , but creates HTML-like values | |
Agsym_t * | agattr (Agraph_t *g, int kind, char *name, const char *value) |
creates or looks up an attribute, without specifying desired form | |
Agsym_t * | agattrsym (void *obj, char *name) |
looks up a string attribute for a graph object given as an argument | |
Agsym_t * | agnxtattr (Agraph_t *g, int kind, Agsym_t *attr) |
permits traversing the list of attributes of a given type | |
int | agcopyattr (void *oldobj, void *newobj) |
copies all of the attributes from one object to another | |
char * | agget (void *obj, char *name) |
char * | agxget (void *obj, Agsym_t *sym) |
int | agset (void *obj, char *name, const char *value) |
int | agset_text (void *obj, char *name, const char *value) |
int | agset_html (void *obj, char *name, const char *value) |
int | agxset (void *obj, Agsym_t *sym, const char *value) |
int | agxset_text (void *obj, Agsym_t *sym, const char *value) |
int | agxset_html (void *obj, Agsym_t *sym, const char *value) |
int | agsafeset_text (void *obj, char *name, const char *value, const char *def) |
set an attribute’s value and default, ensuring it is declared before setting it locally | |
int | agsafeset_html (void *obj, char *name, const char *value, const char *def) |
set an attribute’s value and default, ensuring it is declared before setting it locally | |
int | agsafeset (void *obj, char *name, const char *value, const char *def) |
set an attribute’s value and default, ensuring it is declared before setting it locally | |
Programmer-defined values may be dynamically attached to graphs, subgraphs, nodes, and edges. Such values are either character string data (see agattr_text, agattr_html, and agattr) (for I/O) or uninterpreted binary records (for implementing algorithms efficiently).
String attributes are handled automatically in reading and writing graph files. A string attribute is identified by name and by an internal symbol table entry (Agsym_t) created by Libcgraph. Attributes of nodes, edges, and graphs (with their subgraphs) have separate namespaces. The contents of an Agsym_t have a char* name for the attribute's name, a char* defval field for the attribute's default value, and an int id field containing the index of the attribute's specific value for an object in the object's array of attribute values.
Use of this function should be avoided where possible. It is not possible to explicitly indicate whether the caller is trying to create/lookup a regular text attribute or an HTML-like attribute. It is better to be explicit with your intent and instead call either agattr_text or agattr_html.
This function has the following behavior:
value
passed was obtained from agstrdup_html
, an HTML-like attribute value is created/looked up. That is, the behavior is equivalent to a call to agattr_html.g | graph. When is NULL, the default is set for all graphs created subsequently. |
kind | may be AGRAPH, AGNODE, or AGEDGE. |
value | default value. When is NULL, the request is to search for for an existing attribute of the given kind and name. |
Definition at line 365 of file attr.c.
References agattr_html(), agattr_text(), aghtmlstr(), agopen(), agstrbind_html(), NULL, ProtoDesc, and ProtoGraph.
Regular text attributes cannot be created or looked up with this function. See agattr_text for that.
g | Graph. When g is NULL , the default is set for all graphs created subsequently. |
kind | May be AGRAPH, AGNODE, or AGEDGE. |
value | Default value. When value is NULL , the request is to search for an existing attribute of the given kind and name. |
If the attribute already exists, its default for creating new objects is set to the given value
; if it does not exist, a new attribute is created with the given default value
, and the default is applied to all pre-existing objects of the given kind
.
Definition at line 361 of file attr.c.
References agattr_().
Referenced by agattr(), agsafeset(), agsafeset_html(), attrstmt(), attrstmt(), cloneDfltAttrs(), cloneGraph(), and copyAttr().
HTML-like attributes cannot be created or looked up with this function. See agattr_html for that.
g | graph. When is NULL, the default is set for all graphs created subsequently. |
kind | may be AGRAPH, AGNODE, or AGEDGE. |
value | default value. When is (char*)0, the request is to search for an existing attribute of the given kind and name. |
If the attribute already exists, its default for creating new objects is set to the given value; if it does not exist, a new attribute is created with the given default value, and the default is applied to all pre-existing objects of the given kind
Definition at line 357 of file attr.c.
References agattr_().
Referenced by addRevEdge(), agattr(), agedgeattr(), agnodeattr(), agraphattr(), agsafeset(), agsafeset_text(), attach_edge_colors(), attached_clustering(), attrstmt(), attrstmt(), bindattrs(), bindattrs(), bindedgeattr(), cloneDfltAttrs(), cloneGraph(), cloneGraph(), clust_in_layer(), color(), constrainY(), copy_attr(), copyAttr(), copyAttr(), deselect_all(), doApply(), dot_sameports(), Dot_SetClusterColor(), dotneato_args_initialize(), emit_graph(), export_dot(), fdp_init_graph(), fdp_init_node_edge(), fdp_initParams(), get_checkbox_widget_to_attribute(), get_color_button_widget_to_attribute(), get_combobox_widget_to_attribute(), get_scalebtn_widget_to_attribute(), get_spinbtn_widget_to_attribute(), get_text_widget_to_attribute(), getAttrBool(), getAttrFloat(), getAttrInt(), getAttrStr(), getDfltAttr(), getv(), getv(), getval(), global_def(), graph_init(), graphRecord(), gvContext(), gvContextPlugins(), gvplugin_graph(), Import_coord_clusters_from_dot(), Import_dot_splines(), init_info(), init_nop(), initGraphAttrs(), initialPositions(), layout(), loadGraph(), lookup(), makeDotGraph(), makeGraphData(), mkport(), mkport(), neatoModel(), nxtAttr(), on_attrAddBtn_clicked(), patchwork_init_graph(), plot_dot_map(), posOf(), post(), pre(), safe_dcl(), scan_graph_mode(), select_edge(), select_node(), set_visibility(), setattr(), setAttr(), setDfltAttr(), setedgeattributes(), setgraphattributes(), setnodeattributes(), setState(), setv(), setv(), SparseMatrix_import_dot(), twopi_layout(), update_graph_params(), updateRecord(), write_hdr(), and writeHdr().
Agattr_t * agattrrec | ( | void * | obj | ) |
Definition at line 227 of file attr.c.
References AgDataRecName, and aggetrec().
Referenced by addattr(), agattrsym(), agedgeattr_delete(), agedgeattr_init(), agget(), agnodeattr_delete(), agnodeattr_init(), agraphattr_delete(), agxget(), agxset_(), irrelevant_subgraph(), not_default_attrs(), write_nondefault_attrs(), and writeNondefaultAttr().
Agsym_t * agattrsym | ( | void * | obj, |
char * | name | ||
) |
Definition at line 154 of file attr.c.
References agattrrec(), agdictsym(), and NULL.
Referenced by agcopyattr(), agget(), agset_(), copyAttr(), getval(), lookup(), post(), and setattr().
int agcopyattr | ( | void * | oldobj, |
void * | newobj | ||
) |
Definition at line 659 of file attr.c.
References agattrsym(), aghtmlstr(), agnxtattr(), agraphof(), AGTYPE, agxget(), agxset(), agxset_html(), and Agsym_s::name.
Referenced by addRevEdge(), cloneEdge(), cloneEdge(), cloneNode(), and projectG().
Agdatadict_t * agdatadict | ( | Agraph_t * | g, |
bool | cflag | ||
) |
Definition at line 49 of file attr.c.
References aggetrec(), DataDictName, and init_all_attrs().
Referenced by agdictof(), agmakedatadict(), agraphattr_delete(), agxset_(), irrelevant_subgraph(), setattr(), unviewsubgraphsattr(), write_body(), write_dicts(), writeBody(), and writeDicts().
void agedgeattr_delete | ( | Agedge_t * | e | ) |
Definition at line 462 of file attr.c.
References agattrrec(), AgDataRecName, agdelrec(), Agedge_s::base, and freeattr().
Referenced by agdeledge().
Definition at line 453 of file attr.c.
References agattrrec(), and agmakeattrs().
Referenced by init_all_attrs(), and newedge().
char * agget | ( | void * | obj, |
char * | name | ||
) |
Definition at line 472 of file attr.c.
References agattrrec(), agattrsym(), Agsym_s::id, and NULL.
Referenced by adjustNodes(), agwrite(), angleSet(), attach_attrs_and_arrows(), bind_shape(), changetopfishfocus(), checkClusterStyle(), chkBoundBox(), chkOrder(), circularLayout(), color(), common_init_edge(), compile_samerank(), copy_attr(), do_graph_label(), dot2_rank(), dot_mincross(), dot_rank(), dotLayout(), edgeAttrs(), emit_background(), emit_begin_edge(), emit_begin_node(), emit_cluster_colors(), emit_clusters(), emit_colors(), emit_edge_graphics(), emit_html_label(), emit_page(), epsf_init(), esepFactor(), fdp_xLayout(), gdgen_begin_page(), genRound(), get_attribute_value(), getdouble(), getdoubles2ptf(), getEdgeHead(), getEdgeTail(), getObjId(), getPack(), getPackModeInfo(), getPenColor(), graph_init(), graphAdjustMode(), graphAttrs(), gvLayoutJobs(), Import_coord_clusters_from_dot(), init_gvc(), init_job_viewport(), init_layering(), init_nop(), init_xdot(), initGraphAttrs(), initObjMapData(), is_a_cluster(), is_a_strong_cluster(), iterateBody(), iterateHdr(), labelOf(), load_settings_from_graph(), majorization(), makeCompoundEdge(), makeGraphData(), mincross_options(), neato_layout(), neatoLayout(), neatoMode(), neatoModel(), nsiter2(), object_color(), orthoEdges(), parse_layers(), parseXdotwithattrs(), poly_gencode(), poly_init(), populate_data(), prepare_topological_fisheye(), printHref(), putGraphs(), rank(), rank1(), rank_set_class(), rankset_kind(), scan_graph_mode(), sepFactor(), set_checkbox_widget(), set_color_button_widget(), set_combobox_widget(), set_label(), set_scalebtn_widget_to_attribute(), set_spinbtn_widget(), set_text_widget(), setAspect(), setEdgeType(), setRatio(), setSeed(), setup_tree(), simpleScale(), size_reclbl(), svg_begin_job(), svg_print_id_class(), TB_balance(), tuneControl(), twopi_layout(), update_graph_from_settings(), write_plain(), writeEdge(), writePort(), and xdot_begin_graph().
void agnodeattr_delete | ( | Agnode_t * | n | ) |
Definition at line 443 of file attr.c.
References agattrrec(), AgDataRecName, agdelrec(), Agnode_s::base, and freeattr().
Referenced by agdelnode().
Definition at line 434 of file attr.c.
References agattrrec(), and agmakeattrs().
Referenced by init_all_attrs(), and initnode().
attr | if NULL the function returns the first attribute |
NULL
at the end of the list. Definition at line 386 of file attr.c.
References agdictof(), dtfirst, and dtnext.
Referenced by agcopyattr(), cloneAttrs(), cloneDfltAttrs(), cloneGraph(), copyAttr(), emitEdgeAttrs(), emitGraphAttrs(), emitNodeAttrs(), fillDict(), firstattr(), firstattr(), firstattr(), listEdgeAttrs(), listGraphAttrs(), listNodeAttrs(), load_attr_list(), load_settings_from_graph(), mapN(), nextattr(), nextattr(), nextattr(), nxtAttr(), update_graph_from_settings(), and write_attrs().
int agraphattr_delete | ( | Agraph_t * | g | ) |
Definition at line 414 of file attr.c.
References Ag_G_global, agattrrec(), agdatadict(), agdelrec(), agdtclose(), Agraph_s::base, Agdatadict_s::dict, Agdatadict_s::e, freeattr(), Agdatadict_s::g, Agattr_s::h, Agdatadict_s::h, Agdatadict_s::n, and Agrec_s::name.
Referenced by agclose().
void agraphattr_init | ( | Agraph_t * | g | ) |
Definition at line 403 of file attr.c.
References agmakeattrs(), agmakedatadict(), agparent(), Agraph_s::desc, and Agdesc_s::has_attrs.
Referenced by agopen1(), and agraphattr_init_wrapper().
int agsafeset | ( | void * | obj, |
char * | name, | ||
const char * | value, | ||
const char * | def | ||
) |
Use of this function should be avoided where possible. It is not possible to explicitly indicate whether the caller is trying to create/lookup a regular text attribute or an HTML-like attribute. It is better to be explicit with your intent and instead call either agsafeset_text or agsafeset_html.
This function has the following behavior:
def
was obtained from agstrdup_html
, an HTML-like default attribute value is created.def
was not obtained from agstrdup_html
, a regular text default attribute value is created. … then …value
passed was obtained from agstrdup_html
, an HTML-like attribute value is created/looked up. That is, the behavior is equivalent to a call to agsafeset_html.obj | Object on which to set the attribute |
name | Name of the attribute to set |
value | Value of the attribute to set |
def | Optional default to declare for the attribute |
Definition at line 586 of file attr.c.
References agattr_html(), agattr_text(), aghtmlstr(), agraphof(), agstrbind_html(), AGTYPE, agxset(), agxset_html(), graph(), and NULL.
Referenced by addEdgeGraphics(), addEdgeGraphics(), addEdgeLabelGraphics(), addEdgeLabelGraphics(), addEdgePos(), addEdgePos(), addNodeGraphics(), addNodeGraphics(), addNodeLabelGraphics(), addNodeLabelGraphics(), addRevEdge(), gvLayout(), main(), main(), unknown(), unknown(), and xdot_end_graph().
int agsafeset_html | ( | void * | obj, |
char * | name, | ||
const char * | value, | ||
const char * | def | ||
) |
The attribue set by this function is an HTML-like attribute. See agsafeset_text for the equivalent for a regular text attribute.
obj | Object on which to set the attribute |
name | Name of the attribute to set |
value | Value of the attribute to set |
def | Optional default to declare for the attribute |
Definition at line 578 of file attr.c.
References agattr_html(), agraphof(), AGTYPE, agxset_html(), and NULL.
int agsafeset_text | ( | void * | obj, |
char * | name, | ||
const char * | value, | ||
const char * | def | ||
) |
The attribue set by this function is a regular text attribute. See agsafeset_html for the equivalent for an HTML-like attribute.
obj | Object on which to set the attribute |
name | Name of the attribute to set |
value | Value of the attribute to set |
def | Optional default to declare for the attribute |
Definition at line 569 of file attr.c.
References agattr_text(), agraphof(), AGTYPE, agxset(), and NULL.
int agset | ( | void * | obj, |
char * | name, | ||
const char * | value | ||
) |
Definition at line 499 of file attr.c.
References aghtmlstr(), agraphof(), agset_html(), agset_text(), agstrbind_html(), and NULL.
Referenced by attach_attrs_and_arrows(), cloneAttrs(), cloneNode(), color(), doApply(), make_flat_adj_edges(), patchwork_init_node(), setSeed(), and twopi_layout().
int agset_html | ( | void * | obj, |
char * | name, | ||
const char * | value | ||
) |
int agset_text | ( | void * | obj, |
char * | name, | ||
const char * | value | ||
) |
char * agxget | ( | void * | obj, |
Agsym_t * | sym | ||
) |
Definition at line 482 of file attr.c.
References agattrrec(), Agsym_s::id, and topdictsize().
Referenced by addRevEdge(), agcopyattr(), arrow_flags(), attached_clustering(), chkBB(), chkPos(), cloneAttrs(), common_init_edge(), common_init_node(), copyAttr(), copyAttr(), dot_sameports(), edge_seg(), edge_spline(), edgecmd_internal(), emit_begin_edge(), emitEdgeAttrs(), emitGraphAttrs(), emitNodeAttrs(), findRootNode(), finishNode(), getlength(), getval(), graphcmd_internal(), graphviz_unflatten(), gv_edge_state(), gv_graph_state(), gv_node_state(), gvevent_enter_obj(), Import_coord_clusters_from_dot(), Import_dot_splines(), initialPositions(), is_nonconstraint(), l_float(), labelOf(), late_bool(), late_quadtree_scheme(), late_smooth(), late_string(), lenattr(), lookup(), makeMatrix(), mapN(), myagxget(), noClip(), nodecmd_internal(), nonconstraint_edge(), nop_init_graphs(), posOf(), post(), renderEdgeLabels(), renderNodeLabels(), renderNodes(), renderSelectedNodes(), set_boundaries(), SparseMatrix_import_dot(), stylenode(), taperfun(), unviewsubgraphsattr(), user_pos(), user_spline(), visible(), write_attrs(), write_plain(), and write_port().
int agxset | ( | void * | obj, |
Agsym_t * | sym, | ||
const char * | value | ||
) |
Definition at line 546 of file attr.c.
References aghtmlstr(), agraphof(), agstrbind_html(), agxset_html(), agxset_text(), and NULL.
Referenced by addZ(), adjustlen(), agcopyattr(), agsafeset(), agsafeset_text(), applyattrs(), applyattrs(), attach_attrs_and_arrows(), attach_edge_colors(), attach_phase_attrs(), attached_clustering(), cloneGraph(), cloneSubg(), constrainY(), copyAttr(), copyAttr(), deselect_all(), doApply(), Dot_SetClusterColor(), export_dot(), finishNode(), graphviz_unflatten(), gvplugin_graph(), Import_coord_clusters_from_dot(), make_flat_adj_edges(), makeDotGraph(), mapN(), mkport(), mkport(), myagxset(), myagxset(), post(), put_escaping_backslashes(), rec_attach_bb(), select_edge(), select_node(), set_visibility(), setattr(), setAttr(), twopi_layout(), xdot_end_cluster(), xdot_end_edge(), xdot_end_graph(), and xdot_end_node().
int agxset_html | ( | void * | obj, |
Agsym_t * | sym, | ||
const char * | value | ||
) |
Definition at line 565 of file attr.c.
References agxset_().
Referenced by agcopyattr(), agsafeset(), agsafeset_html(), agset_(), agxset(), applyattrs(), and applyattrs().