diff options
Diffstat (limited to 'src/xml')
| -rw-r--r-- | src/xml/repr-util.cpp | 16 | ||||
| -rw-r--r-- | src/xml/repr.h | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp index 97676bebe..193c1125c 100644 --- a/src/xml/repr-util.cpp +++ b/src/xml/repr-util.cpp @@ -446,6 +446,22 @@ sp_repr_lookup_name( Inkscape::XML::Node *repr, gchar const *name, gint maxdepth } /** + * Determine if the node is a 'title', 'desc' or 'metadata' element. + */ +bool +sp_repr_is_meta_element(const Inkscape::XML::Node *node) +{ + if (node == NULL) return false; + if (node->type() != Inkscape::XML::ELEMENT_NODE) return false; + gchar const *name = node->name(); + if (name == NULL) return false; + if (!std::strcmp(name, "svg:title")) return true; + if (!std::strcmp(name, "svg:desc")) return true; + if (!std::strcmp(name, "svg:metadata")) return true; + return false; +} + +/** * Parses the boolean value of an attribute "key" in repr and sets val accordingly, or to FALSE if * the attr is not set. * diff --git a/src/xml/repr.h b/src/xml/repr.h index 162451a0f..f0a1dbeb6 100644 --- a/src/xml/repr.h +++ b/src/xml/repr.h @@ -211,6 +211,8 @@ inline void sp_repr_unparent(Inkscape::XML::Node *repr) { } } +bool sp_repr_is_meta_element(const Inkscape::XML::Node *node); + /* Convenience */ unsigned sp_repr_get_boolean(Inkscape::XML::Node *repr, gchar const *key, unsigned *val); unsigned sp_repr_get_int(Inkscape::XML::Node *repr, gchar const *key, int *val); |
