Inkscape
Vector Graphics Editor
|
Utility functions related to parsing and validation of XML attributes. More...
Go to the source code of this file.
Enumerations | |
enum | SPAttrClean { SP_ATTRCLEAN_ATTR_WARN = 1 , SP_ATTRCLEAN_ATTR_REMOVE = 2 , SP_ATTRCLEAN_STYLE_WARN = 4 , SP_ATTRCLEAN_STYLE_REMOVE = 8 , SP_ATTRCLEAN_DEFAULT_WARN = 16 , SP_ATTRCLEAN_DEFAULT_REMOVE = 32 } |
Utility functions for cleaning XML tree. More... | |
Functions | |
unsigned int | sp_attribute_clean_get_prefs () |
Get preferences. | |
void | sp_attribute_clean_tree (Node *repr) |
Remove or warn about inappropriate attributes and useless style properties. | |
void | sp_attribute_clean_recursive (Node *repr, unsigned int flags) |
Recursively clean. | |
void | sp_attribute_clean_element (Node *repr, unsigned int flags) |
Clean one element (attributes and style properties). | |
void | sp_attribute_clean_style (Node *repr, unsigned int flags) |
Clean style properties for one element. | |
Glib::ustring | sp_attribute_clean_style (Node *repr, gchar const *string, unsigned int flags) |
Clean style properties for one style string. | |
void | sp_attribute_clean_style (Node *repr, SPCSSAttr *css, unsigned int flags) |
Clean style properties for one CSS. | |
void | sp_attribute_purge_default_style (SPCSSAttr *css, unsigned int flags) |
Remove CSS style properties with default values. | |
bool | sp_attribute_check_attribute (Glib::ustring const &element, Glib::ustring const &id, Glib::ustring const &attribute, bool warn) |
Check one attribute on an element. | |
bool | sp_is_valid_svg_path_d (Glib::ustring const &d) |
Check whether the 'd' attribute on a <path> element parses correctly. | |
Utility functions related to parsing and validation of XML attributes.
Definition in file attribute-rel-util.h.
enum SPAttrClean |
Utility functions for cleaning XML tree.
Enum for preferences
Enumerator | |
---|---|
SP_ATTRCLEAN_ATTR_WARN | |
SP_ATTRCLEAN_ATTR_REMOVE | |
SP_ATTRCLEAN_STYLE_WARN | |
SP_ATTRCLEAN_STYLE_REMOVE | |
SP_ATTRCLEAN_DEFAULT_WARN | |
SP_ATTRCLEAN_DEFAULT_REMOVE |
Definition at line 28 of file attribute-rel-util.h.
bool sp_attribute_check_attribute | ( | Glib::ustring const & | element, |
Glib::ustring const & | id, | ||
Glib::ustring const & | attribute, | ||
bool | warn | ||
) |
Check one attribute on an element.
Definition at line 302 of file attribute-rel-util.cpp.
References SPAttributeRelCSS::findIfProperty(), SPAttributeRelSVG::findIfValid(), and SPAttributeRelCSS::findIfValid().
Referenced by Inkscape::XML::SimpleNode::setAttributeImpl(), and sp_attribute_clean_element().
void sp_attribute_clean_element | ( | Node * | repr, |
unsigned int | flags | ||
) |
Clean one element (attributes and style properties).
Clean one element (attributes and style properties).
Definition at line 108 of file attribute-rel-util.cpp.
References Inkscape::XML::Node::attribute(), Inkscape::XML::Node::attributeList(), Inkscape::XML::ELEMENT_NODE, Inkscape::XML::Node::name(), Inkscape::XML::Node::removeAttribute(), SP_ATTRCLEAN_ATTR_REMOVE, SP_ATTRCLEAN_ATTR_WARN, sp_attribute_check_attribute(), sp_attribute_clean_style(), and Inkscape::XML::Node::type().
Referenced by sp_attribute_clean_recursive().
unsigned int sp_attribute_clean_get_prefs | ( | ) |
Get preferences.
Definition at line 40 of file attribute-rel-util.cpp.
References Inkscape::Preferences::get(), Inkscape::Preferences::getBool(), SP_ATTRCLEAN_ATTR_REMOVE, SP_ATTRCLEAN_ATTR_WARN, SP_ATTRCLEAN_DEFAULT_REMOVE, SP_ATTRCLEAN_DEFAULT_WARN, SP_ATTRCLEAN_STYLE_REMOVE, and SP_ATTRCLEAN_STYLE_WARN.
Referenced by Inkscape::XML::SimpleNode::setAttributeImpl(), sp_attribute_clean_tree(), and SPObject::write().
void sp_attribute_clean_recursive | ( | Node * | repr, |
unsigned int | flags | ||
) |
Recursively clean.
repr: the root node in a document or any other node. pref_attr, pref_style, pref_defaults: ignore, delete, or warn.
Recursively clean.
Definition at line 81 of file attribute-rel-util.cpp.
References child, Inkscape::XML::ELEMENT_NODE, Inkscape::XML::Node::firstChild(), Inkscape::XML::Node::name(), SP_ATTRCLEAN_DEFAULT_REMOVE, SP_ATTRCLEAN_DEFAULT_WARN, sp_attribute_clean_element(), sp_attribute_clean_recursive(), and Inkscape::XML::Node::type().
Referenced by sp_attribute_clean_recursive(), and sp_attribute_clean_tree().
Glib::ustring sp_attribute_clean_style | ( | Node * | repr, |
gchar const * | string, | ||
unsigned int | flags | ||
) |
Clean style properties for one style string.
Clean style properties for one style string.
Definition at line 162 of file attribute-rel-util.cpp.
References css, Inkscape::XML::ELEMENT_NODE, sp_attribute_clean_style(), sp_repr_css_attr_add_from_string(), sp_repr_css_attr_new(), sp_repr_css_attr_unref(), sp_repr_css_write_string(), and Inkscape::XML::Node::type().
Clean style properties for one CSS.
Clean style properties for one CSS.
Definition at line 187 of file attribute-rel-util.cpp.
References Inkscape::XML::Node::attribute(), Inkscape::XML::Node::attributeList(), css, SPAttributeRelCSS::findIfDefault(), SPAttributeRelCSS::findIfInherit(), SPAttributeRelCSS::findIfValid(), Inkscape::XML::Node::name(), Inkscape::XML::Node::parent(), SP_ATTRCLEAN_DEFAULT_REMOVE, SP_ATTRCLEAN_DEFAULT_WARN, SP_ATTRCLEAN_STYLE_REMOVE, SP_ATTRCLEAN_STYLE_WARN, sp_repr_css_attr_inherited(), and sp_repr_css_set_property().
void sp_attribute_clean_style | ( | Node * | repr, |
unsigned int | flags | ||
) |
Clean style properties for one element.
Clean style properties for one element.
Definition at line 141 of file attribute-rel-util.cpp.
References css, Inkscape::XML::ELEMENT_NODE, Inkscape::XML::Node::setAttributeOrRemoveIfEmpty(), sp_attribute_clean_style(), sp_repr_css_attr(), sp_repr_css_attr_unref(), sp_repr_css_write_string(), and Inkscape::XML::Node::type().
Referenced by Inkscape::XML::SimpleNode::setAttributeImpl(), sp_attribute_clean_element(), sp_attribute_clean_style(), sp_attribute_clean_style(), and SPObject::write().
void sp_attribute_clean_tree | ( | Node * | repr | ) |
Remove or warn about inappropriate attributes and useless style properties.
repr: the root node in a document or any other node.
Remove or warn about inappropriate attributes and useless style properties.
repr: the root node in a document or any other node.
Definition at line 67 of file attribute-rel-util.cpp.
References sp_attribute_clean_get_prefs(), and sp_attribute_clean_recursive().
Referenced by sp_repr_do_read(), and sp_repr_write_stream_root_element().
void sp_attribute_purge_default_style | ( | SPCSSAttr * | css, |
unsigned int | flags | ||
) |
Remove CSS style properties with default values.
Definition at line 269 of file attribute-rel-util.cpp.
References css, SPAttributeRelCSS::findIfDefault(), SP_ATTRCLEAN_DEFAULT_REMOVE, SP_ATTRCLEAN_DEFAULT_WARN, and sp_repr_css_set_property().
Referenced by Inkscape::Preferences::mergeStyle().
bool sp_is_valid_svg_path_d | ( | Glib::ustring const & | d | ) |
Check whether the 'd' attribute on a <path> element parses correctly.
d | The value of the 'd' attribute. |
A PathSink going straight to /dev/null
Definition at line 336 of file attribute-rel-util.cpp.
References Geom::PathSink::feed().