/*
5 * Authors: see git history
7 * Copyright (C) 2018 Authors
8 * Released under GNU GPL v2+, read the file
'COPYING' for more information.
28#include <glibmm/ustring.h>
60 Glib::ustring element = repr.
name();
63 if( element.substr(0,4) ==
"svg:" ) {
76static bool cmp(std::pair< Glib::ustring, Glib::ustring >
const &a,
77 std::pair< Glib::ustring, Glib::ustring >
const &b) {
99 std::vector<std::pair< Glib::ustring, Glib::ustring > > my_list;
102 Glib::ustring attribute = g_quark_to_string(iter.key);
103 Glib::ustring value = (
const char*)iter.value;
106 my_list.emplace_back(attribute,value);
108 std::sort(my_list.begin(), my_list.end(),
cmp);
110 for (
const auto& it : my_list) {
112 if (it.first !=
"inkscape:label") {
117 for (
const auto& it : my_list) {
118 if (it.first !=
"inkscape:label") {
152 std::vector<std::pair< Glib::ustring, Glib::ustring > > my_list;
153 for (
const auto & iter :
css.attributeList()) {
155 Glib::ustring
property = g_quark_to_string(iter.key);
156 Glib::ustring value = (
const char*)iter.value;
159 my_list.emplace_back(property,value);
161 std::sort(my_list.begin(), my_list.end(),
cmp);
163 for (
const auto& it : my_list) {
167 for (
const auto& it : my_list) {
TODO: insert short description here.
static bool cmp(std::pair< Glib::ustring, Glib::ustring > const &a, std::pair< Glib::ustring, Glib::ustring > const &b)
Compare function.
static void sp_attribute_sort_style(Node &repr)
Sort CSS style on an element.
static void sp_attribute_sort_recursive(Node &repr)
Sort recursively over all elements.
void sp_attribute_sort_tree(Node &repr)
Sort attributes by name.
static void sp_attribute_sort_element(Node &repr)
Sort attributes on an element.
TODO: insert short description here.
SPAttr sp_attribute_lookup(gchar const *key)
Get attribute id by name.
Lookup dictionary for attributes/properties.
@ INVALID
Must have value 0.
Key-value pair representing an attribute.
Interface for refcounted XML nodes.
virtual char const * name() const =0
Get the name of the element node.
virtual const AttributeVector & attributeList() const =0
Get a list of the node's attributes.
void setAttributeOrRemoveIfEmpty(Inkscape::Util::const_char_ptr key, Inkscape::Util::const_char_ptr value)
Change an attribute of this node.
void setAttribute(Util::const_char_ptr key, Util::const_char_ptr value)
Change an attribute of this node.
virtual Node * firstChild()=0
Get the first child of this node.
void removeAttribute(Inkscape::Util::const_char_ptr key)
Remove an attribute of this node.
virtual NodeType type() const =0
Get the type of the node.
std::shared_ptr< Css const > css
@ ELEMENT_NODE
Regular element node, e.g. <group />.
void sp_repr_css_write_string(SPCSSAttr *css, Glib::ustring &str)
Write a style attribute string from a list of properties stored in an SPCSAttr object.
void sp_repr_css_attr_unref(SPCSSAttr *css)
Unreferences an SPCSSAttr (will be garbage collected if no references remain).
SPCSSAttr * sp_repr_css_attr(Node const *repr, gchar const *attr)
Creates a new SPCSSAttr with one attribute (i.e.
void sp_repr_css_set_property(SPCSSAttr *css, gchar const *name, gchar const *value)
Set a style property to a new value (e.g.
C facade to Inkscape::XML::Node.
SPCSSAttr - interface for CSS Attributes.