diff options
| author | Liam P. White <inkscapebrony@gmail.com> | 2014-09-06 15:25:51 +0000 |
|---|---|---|
| committer | Liam P. White <inkscapebrony@gmail.com> | 2014-09-06 15:25:51 +0000 |
| commit | 990c48b80c39b942dac8bb87f16189f52ffb0d8e (patch) | |
| tree | 8281fbe19ea8b1c6cf71c75dc08b338a230d29e3 /src/xml | |
| parent | lpe interpolate points: small code style fix-up. should be done for all LPEs (diff) | |
| download | inkscape-990c48b80c39b942dac8bb87f16189f52ffb0d8e.tar.gz inkscape-990c48b80c39b942dac8bb87f16189f52ffb0d8e.zip | |
More header cleanup
(bzr r13341.1.198)
Diffstat (limited to 'src/xml')
| -rw-r--r-- | src/xml/event.h | 2 | ||||
| -rw-r--r-- | src/xml/helper-observer.h | 12 | ||||
| -rw-r--r-- | src/xml/node-event-vector.h | 46 | ||||
| -rw-r--r-- | src/xml/node-observer.h | 6 | ||||
| -rw-r--r-- | src/xml/node.h | 15 | ||||
| -rw-r--r-- | src/xml/pi-node.h | 1 | ||||
| -rw-r--r-- | src/xml/quote.h | 2 | ||||
| -rw-r--r-- | src/xml/rebase-hrefs.h | 9 | ||||
| -rw-r--r-- | src/xml/repr.h | 85 | ||||
| -rw-r--r-- | src/xml/simple-node.h | 18 |
10 files changed, 101 insertions, 95 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.h b/src/xml/helper-observer.h index 2f70ba792..c076b3e2c 100644 --- a/src/xml/helper-observer.h +++ b/src/xml/helper-observer.h @@ -1,12 +1,12 @@ -#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 { diff --git a/src/xml/node-event-vector.h b/src/xml/node-event-vector.h index e6396877d..416640b86 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,45 @@ 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); +} +#ifdef __GNUC__ +__attribute__((deprecated)) +#endif +; + +} +} + #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.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) { |
