Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
repr-util.cpp File Reference

Miscellaneous helpers for reprs. More...

Go to the source code of this file.

Functions

static void sp_xml_ns_register_defaults ()
 
static char * sp_xml_ns_auto_prefix (char const *uri)
 
gchar const * sp_xml_ns_uri_prefix (gchar const *uri, gchar const *suggested)
 
gchar const * sp_xml_ns_prefix_uri (gchar const *prefix)
 
int sp_repr_compare_position (Inkscape::XML::Node const *first, Inkscape::XML::Node const *second)
 Works for different-parent objects, so long as they have a common ancestor.
 
bool sp_repr_compare_position_bool (Inkscape::XML::Node const *first, Inkscape::XML::Node const *second)
 
Inkscape::XML::Nodesp_repr_lookup_child (Inkscape::XML::Node *repr, gchar const *key, gchar const *value)
 Find an element node using an unique attribute.
 
Inkscape::XML::Node const * sp_repr_lookup_descendant (Inkscape::XML::Node const *repr, gchar const *key, gchar const *value)
 Recursive version of sp_repr_lookup_child().
 
Inkscape::XML::Nodesp_repr_lookup_descendant (Inkscape::XML::Node *repr, gchar const *key, gchar const *value)
 
Inkscape::XML::Node const * sp_repr_lookup_name (Inkscape::XML::Node const *repr, gchar const *name, gint maxdepth)
 
Glib::ustring sp_repr_lookup_content (Inkscape::XML::Node const *repr, gchar const *name, Glib::ustring otherwise)
 
Inkscape::XML::Nodesp_repr_lookup_name (Inkscape::XML::Node *repr, gchar const *name, gint maxdepth)
 
std::vector< Inkscape::XML::Node const * > sp_repr_lookup_name_many (Inkscape::XML::Node const *repr, gchar const *name, gint maxdepth)
 
std::vector< Inkscape::XML::Node * > sp_repr_lookup_property_many (Inkscape::XML::Node *repr, Glib::ustring const &property, Glib::ustring const &value, int maxdepth)
 
bool sp_repr_is_meta_element (const Inkscape::XML::Node *node)
 Determine if the node is a 'title', 'desc' or 'metadata' element.
 

Variables

static SPXMLNs * namespaces =nullptr
 SPXMLNs.
 

Detailed Description

Miscellaneous helpers for reprs.

Definition in file repr-util.cpp.

Function Documentation

◆ sp_repr_compare_position()

int sp_repr_compare_position ( Inkscape::XML::Node const *  first,
Inkscape::XML::Node const *  second 
)

Works for different-parent objects, so long as they have a common ancestor.

Return value: 0 positions are equivalent 1 first object's position is greater than the second -1 first object's position is less than the second

Todo:
Rewrite this function's description to be understandable

Definition at line 249 of file repr-util.cpp.

References find_containing_child(), lowest_common_ancestor(), Inkscape::XML::Node::parent(), and Inkscape::XML::Node::position().

Referenced by sp_item_repr_compare_position(), sp_item_repr_compare_position_bool(), sp_object_compare_position(), and sp_repr_compare_position_bool().

◆ sp_repr_compare_position_bool()

◆ sp_repr_is_meta_element()

bool sp_repr_is_meta_element ( const Inkscape::XML::Node node)

Determine if the node is a 'title', 'desc' or 'metadata' element.

Definition at line 459 of file repr-util.cpp.

References Inkscape::XML::ELEMENT_NODE, name, Inkscape::XML::Node::name(), node, and Inkscape::XML::Node::type().

Referenced by SPText::_buildLayoutInput(), SPFlowtext::_buildLayoutInput(), sp_item_group_ungroup(), and tidy_operator_inexplicable_spans().

◆ sp_repr_lookup_child()

Inkscape::XML::Node * sp_repr_lookup_child ( Inkscape::XML::Node repr,
gchar const *  key,
gchar const *  value 
)

Find an element node using an unique attribute.

This function returns the first child of the specified node that has the attribute key equal to value. Note that this function does not recurse.

Parameters
reprThe node to start from
keyThe name of the attribute to use for comparisons
valueThe value of the attribute to look for

Definition at line 315 of file repr-util.cpp.

Referenced by insert_hatch_polyfill(), insert_mesh_polyfill(), Inkscape::Extension::PathEffect::processPathEffects(), remove_marker_auto_start_reverse(), and remove_marker_context_paint().

◆ sp_repr_lookup_content()

Glib::ustring sp_repr_lookup_content ( Inkscape::XML::Node const *  repr,
gchar const *  name,
Glib::ustring  otherwise 
)

◆ sp_repr_lookup_descendant() [1/2]

Inkscape::XML::Node * sp_repr_lookup_descendant ( Inkscape::XML::Node repr,
gchar const *  key,
gchar const *  value 
)

Definition at line 353 of file repr-util.cpp.

References key, and sp_repr_lookup_descendant().

◆ sp_repr_lookup_descendant() [2/2]

Inkscape::XML::Node const * sp_repr_lookup_descendant ( Inkscape::XML::Node const *  repr,
gchar const *  key,
gchar const *  value 
)

◆ sp_repr_lookup_name() [1/2]

Inkscape::XML::Node * sp_repr_lookup_name ( Inkscape::XML::Node repr,
gchar const *  name,
gint  maxdepth 
)

Definition at line 394 of file repr-util.cpp.

References name, and sp_repr_lookup_name().

◆ sp_repr_lookup_name() [2/2]

◆ sp_repr_lookup_name_many()

std::vector< Inkscape::XML::Node const * > sp_repr_lookup_name_many ( Inkscape::XML::Node const *  repr,
gchar const *  name,
gint  maxdepth 
)

◆ sp_repr_lookup_property_many()

std::vector< Inkscape::XML::Node * > sp_repr_lookup_property_many ( Inkscape::XML::Node repr,
Glib::ustring const &  property,
Glib::ustring const &  value,
int  maxdepth 
)

◆ sp_xml_ns_auto_prefix()

char * sp_xml_ns_auto_prefix ( char const *  uri)
static

Definition at line 134 of file repr-util.cpp.

References counter, end, sp_xml_ns_prefix_uri(), and start.

Referenced by sp_xml_ns_uri_prefix().

◆ sp_xml_ns_prefix_uri()

gchar const * sp_xml_ns_prefix_uri ( gchar const *  prefix)

Definition at line 220 of file repr-util.cpp.

References key, namespaces, and sp_xml_ns_register_defaults().

Referenced by sp_xml_ns_auto_prefix().

◆ sp_xml_ns_register_defaults()

static void sp_xml_ns_register_defaults ( )
static

Definition at line 72 of file repr-util.cpp.

References namespaces.

Referenced by sp_xml_ns_prefix_uri(), and sp_xml_ns_uri_prefix().

◆ sp_xml_ns_uri_prefix()

gchar const * sp_xml_ns_uri_prefix ( gchar const *  uri,
gchar const *  suggested 
)

Variable Documentation

◆ namespaces

SPXMLNs* namespaces =nullptr
static

SPXMLNs.

Definition at line 66 of file repr-util.cpp.

Referenced by sp_xml_ns_prefix_uri(), sp_xml_ns_register_defaults(), and sp_xml_ns_uri_prefix().