summaryrefslogtreecommitdiffstats
path: root/src/xml
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-11-23 23:36:49 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-11-23 23:36:49 +0000
commit0969085ddf607a7a98cf7fd6d9b10da5fbebe62d (patch)
tree59b2bc9ed3412ab2de4c703ef30342dfe2401704 /src/xml
parentrefactor from lastApplied (diff)
parentFixed a bug pointed by suv running from comand line, also removed another des... (diff)
downloadinkscape-0969085ddf607a7a98cf7fd6d9b10da5fbebe62d.tar.gz
inkscape-0969085ddf607a7a98cf7fd6d9b10da5fbebe62d.zip
fixing to trunk
(bzr r12588.1.34)
Diffstat (limited to 'src/xml')
-rw-r--r--src/xml/event.h2
-rw-r--r--src/xml/helper-observer.cpp13
-rw-r--r--src/xml/helper-observer.h69
-rw-r--r--src/xml/node-event-vector.h42
-rw-r--r--src/xml/node-observer.h6
-rw-r--r--src/xml/node.h15
-rw-r--r--src/xml/pi-node.h1
-rw-r--r--src/xml/quote.h2
-rw-r--r--src/xml/rebase-hrefs.h9
-rw-r--r--src/xml/repr-css.cpp43
-rw-r--r--src/xml/repr-io.cpp1
-rw-r--r--src/xml/repr.h85
-rw-r--r--src/xml/simple-node.h18
13 files changed, 167 insertions, 139 deletions
diff --git a/src/xml/event.h b/src/xml/event.h
index 55e2add88..d25ea0e07 100644
--- a/src/xml/event.h
+++ b/src/xml/event.h
@@ -18,7 +18,7 @@
#ifndef SEEN_INKSCAPE_XML_SP_REPR_ACTION_H
#define SEEN_INKSCAPE_XML_SP_REPR_ACTION_H
-#include <glib.h>
+typedef unsigned int GQuark;
#include <glibmm/ustring.h>
#include <iterator>
diff --git a/src/xml/helper-observer.cpp b/src/xml/helper-observer.cpp
index c54dd8e74..957f3df0a 100644
--- a/src/xml/helper-observer.cpp
+++ b/src/xml/helper-observer.cpp
@@ -5,25 +5,34 @@ namespace XML {
// Very simple observer that just emits a signal if anything happens to a node
SignalObserver::SignalObserver()
- : _oldsel(0)
+ : _oldsel(NULL)
{}
+SignalObserver::~SignalObserver()
+{
+ set(NULL); // if _oldsel!=nullptr, remove observer and decrease refcount
+}
+
// Add this observer to the SPObject and remove it from any previous object
void SignalObserver::set(SPObject* o)
{
// XML Tree being used direcly in this function in the following code
// while it shouldn't be
+ // Pointer to object is stored, so refcounting should be increased/decreased
if(_oldsel) {
if (_oldsel->getRepr()) {
_oldsel->getRepr()->removeObserver(*this);
}
+ sp_object_unref(_oldsel);
+ _oldsel = NULL;
}
if(o) {
if (o->getRepr()) {
o->getRepr()->addObserver(*this);
+ sp_object_ref(o);
+ _oldsel = o;
}
}
- _oldsel = o;
}
void SignalObserver::notifyChildAdded(XML::Node&, XML::Node&, XML::Node*)
diff --git a/src/xml/helper-observer.h b/src/xml/helper-observer.h
index e7881cd4d..b4c0aba41 100644
--- a/src/xml/helper-observer.h
+++ b/src/xml/helper-observer.h
@@ -1,36 +1,49 @@
-#ifndef __XML_HELPER_OBSERVER__
-#define __XML_HELPER_OBSERVER__
+#ifndef SEEN_XML_HELPER_OBSERVER
+#define SEEN_XML_HELPER_OBSERVER
+
+#include <cstddef>
+#include <sigc++/sigc++.h>
#include "node-observer.h"
#include "node.h"
-#include "../sp-object.h"
-//#include "../sp-object-repr.h"
-#include <stddef.h>
-#include <sigc++/sigc++.h>
+#include "sp-object.h"
namespace Inkscape {
- namespace XML {
- class Node;
-
- // Very simple observer that just emits a signal if anything happens to a node
- class SignalObserver : public NodeObserver
- {
- public:
- SignalObserver();
-
- // Add this observer to the SPObject and remove it from any previous object
- void set(SPObject* o);
- void notifyChildAdded(Node&, Node&, Node*);
- void notifyChildRemoved(Node&, Node&, Node*);
- void notifyChildOrderChanged(Node&, Node&, Node*, Node*);
- void notifyContentChanged(Node&, Util::ptr_shared<char>, Util::ptr_shared<char>);
- void notifyAttributeChanged(Node&, GQuark, Util::ptr_shared<char>, Util::ptr_shared<char>);
- sigc::signal<void>& signal_changed();
- private:
- sigc::signal<void> _signal_changed;
- SPObject* _oldsel;
- };
- }
+namespace XML {
+
+class Node;
+
+// Very simple observer that just emits a signal if anything happens to a node
+class SignalObserver : public NodeObserver {
+public:
+ SignalObserver();
+ ~SignalObserver();
+
+ // Add this observer to the SPObject and remove it from any previous object
+ void set(SPObject* o);
+ void notifyChildAdded(Node&, Node&, Node*);
+ void notifyChildRemoved(Node&, Node&, Node*);
+ void notifyChildOrderChanged(Node&, Node&, Node*, Node*);
+ void notifyContentChanged(Node&, Util::ptr_shared<char>, Util::ptr_shared<char>);
+ void notifyAttributeChanged(Node&, GQuark, Util::ptr_shared<char>, Util::ptr_shared<char>);
+ sigc::signal<void>& signal_changed();
+private:
+ sigc::signal<void> _signal_changed;
+ SPObject* _oldsel;
+};
+
+}
}
#endif //#ifndef __XML_HELPER_OBSERVER__
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 :
diff --git a/src/xml/node-event-vector.h b/src/xml/node-event-vector.h
index e6396877d..16add2960 100644
--- a/src/xml/node-event-vector.h
+++ b/src/xml/node-event-vector.h
@@ -14,26 +14,11 @@
#ifndef SEEN_INKSCAPE_XML_SP_REPR_EVENT_VECTOR
#define SEEN_INKSCAPE_XML_SP_REPR_EVENT_VECTOR
-#include <glib.h>
-
#include "xml/node.h"
namespace Inkscape {
namespace XML {
-
-/**
- * @brief Structure holding callbacks for node state changes
- * @deprecated Derive an observer object from the NodeObserver class instead
- */
-struct NodeEventVector {
- /* Immediate signals */
- void (* child_added) (Node *repr, Node *child, Node *ref, void * data);
- void (* child_removed) (Node *repr, Node *child, Node *ref, void * data);
- void (* attr_changed) (Node *repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive, void * data);
- void (* content_changed) (Node *repr, const gchar *oldcontent, const gchar *newcontent, void * data);
- void (* order_changed) (Node *repr, Node *child, Node *oldref, Node *newref, void * data);
-};
-
+struct NodeEventVector;
}
}
@@ -41,22 +26,41 @@ struct NodeEventVector {
* @brief Generate events corresponding to the node's state
* @deprecated Use Node::synthesizeEvents(NodeObserver &) instead
*/
-inline void sp_repr_synthesize_events (Inkscape::XML::Node *repr, const Inkscape::XML::NodeEventVector *vector, void * data) {
+inline void sp_repr_synthesize_events (Inkscape::XML::Node *repr, const Inkscape::XML::NodeEventVector *vector, void* data) {
repr->synthesizeEvents(vector, data);
}
/**
* @brief Add a set of callbacks for node state changes and its associated data
* @deprecated Use Node::addObserver() instead
*/
-inline void sp_repr_add_listener (Inkscape::XML::Node *repr, const Inkscape::XML::NodeEventVector *vector, void * data) {
+inline void sp_repr_add_listener (Inkscape::XML::Node *repr, const Inkscape::XML::NodeEventVector *vector, void* data) {
repr->addListener(vector, data);
}
/**
* @brief Remove a set of callbacks based on associated data
* @deprecated Use Node::removeObserver() instead
*/
-inline void sp_repr_remove_listener_by_data (Inkscape::XML::Node *repr, void * data) {
+inline void sp_repr_remove_listener_by_data (Inkscape::XML::Node *repr, void* data) {
repr->removeListenerByData(data);
}
+namespace Inkscape {
+namespace XML {
+
+/**
+ * @brief Structure holding callbacks for node state changes
+ * @deprecated Derive an observer object from the NodeObserver class instead
+ */
+struct NodeEventVector {
+ /* Immediate signals */
+ void (* child_added) (Node *repr, Node *child, Node *ref, void* data);
+ void (* child_removed) (Node *repr, Node *child, Node *ref, void* data);
+ void (* attr_changed) (Node *repr, char const *key, char const *oldval, char const *newval, bool is_interactive, void* data);
+ void (* content_changed) (Node *repr, char const *oldcontent, char const *newcontent, void * data);
+ void (* order_changed) (Node *repr, Node *child, Node *oldref, Node *newref, void* data);
+};
+
+}
+}
+
#endif
diff --git a/src/xml/node-observer.h b/src/xml/node-observer.h
index d0c85d1dd..9c7e096e5 100644
--- a/src/xml/node-observer.h
+++ b/src/xml/node-observer.h
@@ -18,8 +18,8 @@
#ifndef SEEN_INKSCAPE_XML_NODE_OBSERVER_H
#define SEEN_INKSCAPE_XML_NODE_OBSERVER_H
-#include <glib.h>
#include "util/share.h"
+typedef unsigned int GQuark;
#ifndef INK_UNUSED
#define INK_UNUSED(x) ((void)(x))
@@ -56,7 +56,9 @@ protected:
NodeObserver() {}
public:
virtual ~NodeObserver() {}
-
+
+ // FIXME: somebody needs to learn what "pure virtual" means
+
/**
* @brief Child addition callback
*
diff --git a/src/xml/node.h b/src/xml/node.h
index c1977b0a8..8bb70acc0 100644
--- a/src/xml/node.h
+++ b/src/xml/node.h
@@ -18,7 +18,6 @@
#ifndef SEEN_INKSCAPE_XML_NODE_H
#define SEEN_INKSCAPE_XML_NODE_H
-#include <glibmm/value.h>
#include <glibmm/ustring.h>
#include "gc-anchored.h"
#include "util/list.h"
@@ -100,7 +99,7 @@ public:
*
* @return Name for element nodes, NULL for others
*/
- virtual gchar const *name() const=0;
+ virtual char const *name() const=0;
/**
* @brief Get the integer code corresponding to the node's name
* @return GQuark code corresponding to the name
@@ -131,7 +130,7 @@ public:
*
* @return The node's content
*/
- virtual gchar const *content() const=0;
+ virtual char const *content() const=0;
/**
* @brief Get the string representation of a node's attribute
@@ -144,7 +143,7 @@ public:
*
* @param key The name of the node's attribute
*/
- virtual gchar const *attribute(gchar const *key) const=0;
+ virtual char const *attribute(char const *key) const=0;
/**
* @brief Get a list of the node's attributes
@@ -168,7 +167,7 @@ public:
* @param partial_name The string to match against all attributes
* @return true if there is such an attribute, false otherwise
*/
- virtual bool matchAttributeName(gchar const *partial_name) const=0;
+ virtual bool matchAttributeName(char const *partial_name) const=0;
/*@}*/
@@ -193,7 +192,7 @@ public:
*
* @param value The node's new content
*/
- virtual void setContent(gchar const *value)=0;
+ virtual void setContent(char const *value)=0;
//@{
/**
@@ -205,7 +204,7 @@ public:
* @param value The new value of the attribute
* @param is_interactive Ignored
*/
- virtual void setAttribute(gchar const *key, gchar const *value, bool is_interactive=false)=0;
+ virtual void setAttribute(char const *key, char const *value, bool is_interactive=false)=0;
void setAttribute(char const *key, Glib::ustring const &value, bool is_interactive=false)
{
@@ -399,7 +398,7 @@ public:
* @param src The node to merge into this node
* @param key The attribute to use as the identity attribute
*/
- virtual void mergeFrom(Node const *src, gchar const *key)=0;
+ virtual void mergeFrom(Node const *src, char const *key)=0;
/*@}*/
diff --git a/src/xml/pi-node.h b/src/xml/pi-node.h
index 1f892f97a..76a3dc741 100644
--- a/src/xml/pi-node.h
+++ b/src/xml/pi-node.h
@@ -14,7 +14,6 @@
#ifndef SEEN_INKSCAPE_XML_PI_NODE_H
#define SEEN_INKSCAPE_XML_PI_NODE_H
-#include <glib.h>
#include "xml/simple-node.h"
namespace Inkscape {
diff --git a/src/xml/quote.h b/src/xml/quote.h
index 8e3bca0eb..393bdf46e 100644
--- a/src/xml/quote.h
+++ b/src/xml/quote.h
@@ -1,7 +1,7 @@
#ifndef SEEN_XML_QUOTE_H
#define SEEN_XML_QUOTE_H
-#include <stddef.h>
+#include <cstddef>
size_t xml_quoted_strlen(char const *val);
char *xml_quote_strdup(char const *src);
diff --git a/src/xml/rebase-hrefs.h b/src/xml/rebase-hrefs.h
index 5baf96516..34afe6076 100644
--- a/src/xml/rebase-hrefs.h
+++ b/src/xml/rebase-hrefs.h
@@ -1,7 +1,6 @@
#ifndef REBASE_HREFS_H_SEEN
#define REBASE_HREFS_H_SEEN
-#include <glib.h>
#include "util/list.h"
#include "xml/attribute-record.h"
class SPDocument;
@@ -9,7 +8,7 @@ class SPDocument;
namespace Inkscape {
namespace XML {
-std::string calc_abs_doc_base(gchar const *doc_base);
+std::string calc_abs_doc_base(char const *doc_base);
/**
* Change relative hrefs in doc to be relative to \a new_base instead of doc.base.
@@ -18,7 +17,7 @@ std::string calc_abs_doc_base(gchar const *doc_base);
*
* @param spns True if doc should contain sodipodi:absref attributes.
*/
-void rebase_hrefs(SPDocument *doc, gchar const *new_base, bool spns);
+void rebase_hrefs(SPDocument *doc, char const *new_base, bool spns);
/**
* Change relative xlink:href attributes to be relative to \a new_abs_base instead of old_abs_base.
@@ -26,8 +25,8 @@ void rebase_hrefs(SPDocument *doc, gchar const *new_base, bool spns);
* Note that old_abs_base and new_abs_base must each be non-NULL, absolute directory paths.
*/
Inkscape::Util::List<AttributeRecord const> rebase_href_attrs(
- gchar const *old_abs_base,
- gchar const *new_abs_base,
+ char const *old_abs_base,
+ char const *new_abs_base,
Inkscape::Util::List<AttributeRecord const> attributes);
diff --git a/src/xml/repr-css.cpp b/src/xml/repr-css.cpp
index 24e2db9e1..c043904a7 100644
--- a/src/xml/repr-css.cpp
+++ b/src/xml/repr-css.cpp
@@ -12,7 +12,7 @@
* changing an item in the List. Utility functions are provided to go back and forth between the
* two ways of representing properties (by a string or by a list).
*
- * Use sp_repr_write_string to go from a property list to a style string.
+ * Use sp_repr_css_write_string to go from a property list to a style string.
*
*/
@@ -283,14 +283,7 @@ void sp_repr_css_write_string(SPCSSAttr *css, Glib::ustring &str)
str.append(g_quark_to_string(iter->key));
str.push_back(':');
- if (!strcmp(g_quark_to_string(iter->key), "font-family")
- || !strcmp(g_quark_to_string(iter->key), "-inkscape-font-specification")) {
- // we only quote font-family/font-specification, as SPStyle does
- Glib::ustring val_quoted = css2_escape_quote (iter->value);
- str.append(val_quoted);
- } else {
- str.append(iter->value); // unquoted
- }
+ str.append(iter->value); // Any necessary quoting to be done by calling routine.
if (rest(iter)) {
str.push_back(';');
@@ -346,13 +339,24 @@ void sp_repr_css_merge(SPCSSAttr *dst, SPCSSAttr *src)
/**
* Merges style properties as parsed by libcroco into an existing SPCSSAttr.
+ * libcroco converts all single quotes to double quotes, which needs to be
+ * undone as we always use single quotes inside our 'style' strings since
+ * double quotes are used outside: e.g.:
+ * style="font-family:'DejaVu Sans'"
*/
static void sp_repr_css_merge_from_decl(SPCSSAttr *css, CRDeclaration const *const decl)
{
guchar *const str_value_unsigned = cr_term_to_string(decl->value);
- gchar *const str_value = reinterpret_cast<gchar *>(str_value_unsigned);
- gchar *value_unquoted = attribute_unquote (str_value); // libcroco returns strings quoted in ""
- Glib::ustring value_unquoted2 = value_unquoted ? value_unquoted : Glib::ustring();
+
+ Glib::ustring value( reinterpret_cast<gchar *>(str_value_unsigned ) );
+ g_free(str_value_unsigned);
+
+ Glib::ustring::size_type pos = 0;
+ while( (pos=value.find("\"",pos)) != Glib::ustring::npos) {
+ value.replace(pos,1,"'");
+ ++pos;
+ }
+
Glib::ustring units;
/*
@@ -362,11 +366,11 @@ static void sp_repr_css_merge_from_decl(SPCSSAttr *css, CRDeclaration const *con
*
* HACK for now is to strip off em and ex units and add them back at the end
*/
- int le = value_unquoted2.length();
+ int le = value.length();
if (le > 2) {
- units = value_unquoted2.substr(le-2, 2);
+ units = value.substr(le-2, 2);
if ((units == "em") || (units == "ex")) {
- value_unquoted2 = value_unquoted2.substr(0, le-2);
+ value = value.substr(0, le-2);
}
else {
units.clear();
@@ -377,12 +381,15 @@ static void sp_repr_css_merge_from_decl(SPCSSAttr *css, CRDeclaration const *con
// CSSOStringStream is used here to write valid CSS (as in sp_style_write_string). This has
// the additional benefit of respecting the numerical precission set in the SVG Output
// preferences. We assume any numerical part comes first (if not, the whole string is copied).
- std::stringstream ss( value_unquoted2 );
+ std::stringstream ss( value );
double number = 0;
std::string characters;
std::string temp;
bool number_valid = !(ss >> number).fail();
- if( !number_valid ) ss.clear();
+ if (!number_valid) {
+ ss.clear();
+ ss.seekg(0); // work-around for a bug in libc++ (see lp:1300271)
+ }
while( !(ss >> temp).eof() ) {
characters += temp;
characters += " ";
@@ -396,8 +403,6 @@ static void sp_repr_css_merge_from_decl(SPCSSAttr *css, CRDeclaration const *con
//g_message("sp_repr_css_merge_from_decl looks like em or ex units %s --> %s", str_value, os.str().c_str());
}
((Node *) css)->setAttribute(decl->property->stryng->str, os.str().c_str(), false);
- g_free(value_unquoted);
- g_free(str_value);
}
/**
diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp
index 0319bb5e3..a4146f215 100644
--- a/src/xml/repr-io.cpp
+++ b/src/xml/repr-io.cpp
@@ -623,7 +623,6 @@ static Node *sp_repr_svg_read_node (Document *xml_doc, xmlNodePtr node, const gc
repr->setContent(reinterpret_cast<gchar*>(node->content));
}
- child = node->xmlChildrenNode;
for (child = node->xmlChildrenNode; child != NULL; child = child->next) {
Node *crepr = sp_repr_svg_read_node (xml_doc, child, default_ns, prefix_map);
if (crepr) {
diff --git a/src/xml/repr.h b/src/xml/repr.h
index e691eaa7f..e1d7fdfd6 100644
--- a/src/xml/repr.h
+++ b/src/xml/repr.h
@@ -14,7 +14,6 @@
#ifndef SEEN_SP_REPR_H
#define SEEN_SP_REPR_H
-#include <glib.h>
#include <glibmm/quark.h>
#include "xml/node.h"
@@ -43,55 +42,55 @@ class Point;
}
/* SPXMLNs */
-char const *sp_xml_ns_uri_prefix(gchar const *uri, gchar const *suggested);
-char const *sp_xml_ns_prefix_uri(gchar const *prefix);
+char const *sp_xml_ns_uri_prefix(char const *uri, char const *suggested);
+char const *sp_xml_ns_prefix_uri(char const *prefix);
-Inkscape::XML::Document *sp_repr_document_new(gchar const *rootname);
+Inkscape::XML::Document *sp_repr_document_new(char const *rootname);
/* IO */
-Inkscape::XML::Document *sp_repr_read_file(gchar const *filename, gchar const *default_ns);
-Inkscape::XML::Document *sp_repr_read_mem(gchar const *buffer, int length, gchar const *default_ns);
+Inkscape::XML::Document *sp_repr_read_file(char const *filename, char const *default_ns);
+Inkscape::XML::Document *sp_repr_read_mem(char const *buffer, int length, char const *default_ns);
void sp_repr_write_stream(Inkscape::XML::Node *repr, Inkscape::IO::Writer &out,
- gint indent_level, bool add_whitespace, Glib::QueryQuark elide_prefix,
+ int indent_level, bool add_whitespace, Glib::QueryQuark elide_prefix,
int inlineattrs, int indent,
- gchar const *old_href_base = NULL,
- gchar const *new_href_base = NULL);
-Inkscape::XML::Document *sp_repr_read_buf (const Glib::ustring &buf, const gchar *default_ns);
+ char const *old_href_base = NULL,
+ char const *new_href_base = NULL);
+Inkscape::XML::Document *sp_repr_read_buf (const Glib::ustring &buf, const char *default_ns);
Glib::ustring sp_repr_save_buf(Inkscape::XML::Document *doc);
// TODO convert to std::string
void sp_repr_save_stream(Inkscape::XML::Document *doc, FILE *to_file,
- gchar const *default_ns = NULL, bool compress = false,
- gchar const *old_href_base = NULL,
- gchar const *new_href_base = NULL);
+ char const *default_ns = NULL, bool compress = false,
+ char const *old_href_base = NULL,
+ char const *new_href_base = NULL);
-bool sp_repr_save_file(Inkscape::XML::Document *doc, gchar const *filename, gchar const *default_ns=NULL);
-bool sp_repr_save_rebased_file(Inkscape::XML::Document *doc, gchar const *filename_utf8,
- gchar const *default_ns,
- gchar const *old_base, gchar const *new_base_filename);
+bool sp_repr_save_file(Inkscape::XML::Document *doc, char const *filename, char const *default_ns=NULL);
+bool sp_repr_save_rebased_file(Inkscape::XML::Document *doc, char const *filename_utf8,
+ char const *default_ns,
+ char const *old_base, char const *new_base_filename);
/* CSS stuff */
SPCSSAttr *sp_repr_css_attr_new(void);
void sp_repr_css_attr_unref(SPCSSAttr *css);
-SPCSSAttr *sp_repr_css_attr(Inkscape::XML::Node *repr, gchar const *attr);
+SPCSSAttr *sp_repr_css_attr(Inkscape::XML::Node *repr, char const *attr);
SPCSSAttr *sp_repr_css_attr_parse_color_to_fill(const Glib::ustring &text);
-SPCSSAttr *sp_repr_css_attr_inherited(Inkscape::XML::Node *repr, gchar const *attr);
+SPCSSAttr *sp_repr_css_attr_inherited(Inkscape::XML::Node *repr, char const *attr);
-gchar const *sp_repr_css_property(SPCSSAttr *css, gchar const *name, gchar const *defval);
-void sp_repr_css_set_property(SPCSSAttr *css, gchar const *name, gchar const *value);
-void sp_repr_css_unset_property(SPCSSAttr *css, gchar const *name);
-bool sp_repr_css_property_is_unset(SPCSSAttr *css, gchar const *name);
-double sp_repr_css_double_property(SPCSSAttr *css, gchar const *name, double defval);
+char const *sp_repr_css_property(SPCSSAttr *css, char const *name, char const *defval);
+void sp_repr_css_set_property(SPCSSAttr *css, char const *name, char const *value);
+void sp_repr_css_unset_property(SPCSSAttr *css, char const *name);
+bool sp_repr_css_property_is_unset(SPCSSAttr *css, char const *name);
+double sp_repr_css_double_property(SPCSSAttr *css, char const *name, double defval);
void sp_repr_css_write_string(SPCSSAttr *css, Glib::ustring &str);
-void sp_repr_css_set(Inkscape::XML::Node *repr, SPCSSAttr *css, gchar const *key);
+void sp_repr_css_set(Inkscape::XML::Node *repr, SPCSSAttr *css, char const *key);
void sp_repr_css_merge(SPCSSAttr *dst, SPCSSAttr *src);
-void sp_repr_css_attr_add_from_string(SPCSSAttr *css, const gchar *data);
-void sp_repr_css_change(Inkscape::XML::Node *repr, SPCSSAttr *css, gchar const *key);
-void sp_repr_css_change_recursive(Inkscape::XML::Node *repr, SPCSSAttr *css, gchar const *key);
+void sp_repr_css_attr_add_from_string(SPCSSAttr *css, const char *data);
+void sp_repr_css_change(Inkscape::XML::Node *repr, SPCSSAttr *css, char const *key);
+void sp_repr_css_change_recursive(Inkscape::XML::Node *repr, SPCSSAttr *css, char const *key);
void sp_repr_css_print(SPCSSAttr *css);
@@ -109,15 +108,15 @@ 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);
-unsigned sp_repr_get_double(Inkscape::XML::Node *repr, gchar const *key, double *val);
-unsigned sp_repr_set_boolean(Inkscape::XML::Node *repr, gchar const *key, unsigned val);
-unsigned sp_repr_set_int(Inkscape::XML::Node *repr, gchar const *key, int val);
-unsigned sp_repr_set_css_double(Inkscape::XML::Node *repr, gchar const *key, double val);
-unsigned sp_repr_set_svg_double(Inkscape::XML::Node *repr, gchar const *key, double val);
-unsigned sp_repr_set_point(Inkscape::XML::Node *repr, gchar const *key, Geom::Point const & val);
-unsigned sp_repr_get_point(Inkscape::XML::Node *repr, gchar const *key, Geom::Point *val);
+unsigned sp_repr_get_boolean(Inkscape::XML::Node *repr, char const *key, unsigned *val);
+unsigned sp_repr_get_int(Inkscape::XML::Node *repr, char const *key, int *val);
+unsigned sp_repr_get_double(Inkscape::XML::Node *repr, char const *key, double *val);
+unsigned sp_repr_set_boolean(Inkscape::XML::Node *repr, char const *key, unsigned val);
+unsigned sp_repr_set_int(Inkscape::XML::Node *repr, char const *key, int val);
+unsigned sp_repr_set_css_double(Inkscape::XML::Node *repr, char const *key, double val);
+unsigned sp_repr_set_svg_double(Inkscape::XML::Node *repr, char const *key, double val);
+unsigned sp_repr_set_point(Inkscape::XML::Node *repr, char const *key, Geom::Point const & val);
+unsigned sp_repr_get_point(Inkscape::XML::Node *repr, char const *key, Geom::Point *val);
int sp_repr_compare_position(Inkscape::XML::Node const *first, Inkscape::XML::Node const *second);
@@ -135,16 +134,16 @@ int sp_repr_compare_position(Inkscape::XML::Node const *first, Inkscape::XML::No
* @relatesalso Inkscape::XML::Node
*/
Inkscape::XML::Node *sp_repr_lookup_name(Inkscape::XML::Node *repr,
- gchar const *name,
- gint maxdepth = -1);
+ char const *name,
+ int maxdepth = -1);
Inkscape::XML::Node const *sp_repr_lookup_name(Inkscape::XML::Node const *repr,
- gchar const *name,
- gint maxdepth = -1);
+ char const *name,
+ int maxdepth = -1);
Inkscape::XML::Node *sp_repr_lookup_child(Inkscape::XML::Node *repr,
- gchar const *key,
- gchar const *value);
+ char const *key,
+ char const *value);
inline Inkscape::XML::Node *sp_repr_document_first_child(Inkscape::XML::Document const *doc) {
diff --git a/src/xml/simple-node.h b/src/xml/simple-node.h
index 7c5eb8fbd..1fcb9193b 100644
--- a/src/xml/simple-node.h
+++ b/src/xml/simple-node.h
@@ -18,7 +18,7 @@
#ifndef SEEN_INKSCAPE_XML_SIMPLE_NODE_H
#define SEEN_INKSCAPE_XML_SIMPLE_NODE_H
-#include <glib.h> // g_assert()
+#include <cassert>
#include "xml/node.h"
#include "xml/attribute-record.h"
@@ -38,7 +38,7 @@ class SimpleNode
: virtual public Node, public Inkscape::GC::Managed<>
{
public:
- gchar const *name() const;
+ char const *name() const;
int code() const { return _name; }
void setCodeUnsafe(int code) {
_name = code;
@@ -83,14 +83,14 @@ public:
unsigned position() const;
void setPosition(int pos);
- gchar const *attribute(gchar const *key) const;
- void setAttribute(gchar const *key, gchar const *value, bool is_interactive=false);
- bool matchAttributeName(gchar const *partial_name) const;
+ char const *attribute(char const *key) const;
+ void setAttribute(char const *key, char const *value, bool is_interactive=false);
+ bool matchAttributeName(char const *partial_name) const;
- gchar const *content() const;
- void setContent(gchar const *value);
+ char const *content() const;
+ void setContent(char const *value);
- void mergeFrom(Node const *src, gchar const *key);
+ void mergeFrom(Node const *src, char const *key);
Inkscape::Util::List<AttributeRecord const> attributeList() const {
return _attributes;
@@ -100,7 +100,7 @@ public:
void synthesizeEvents(NodeObserver &observer);
void addListener(NodeEventVector const *vector, void *data) {
- g_assert(vector != NULL);
+ assert(vector != NULL);
_observers.addListener(*vector, data);
}
void addObserver(NodeObserver &observer) {