ekiga r6514 - in trunk: . lib/engine/addressbook/ldap lib/engine/framework
- From: jpuydt svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r6514 - in trunk: . lib/engine/addressbook/ldap lib/engine/framework
- Date: Fri, 25 Jul 2008 21:25:15 +0000 (UTC)
Author: jpuydt
Date: Fri Jul 25 21:25:15 2008
New Revision: 6514
URL: http://svn.gnome.org/viewvc/ekiga?rev=6514&view=rev
Log:
Factored the robust XML code out, so it can be reused if needed
Added:
trunk/lib/engine/framework/robust-xml.cpp
trunk/lib/engine/framework/robust-xml.h
Modified:
trunk/ChangeLog
trunk/lib/engine/addressbook/ldap/ldap-book.cpp
trunk/lib/engine/framework/Makefile.am
Modified: trunk/lib/engine/addressbook/ldap/ldap-book.cpp
==============================================================================
--- trunk/lib/engine/addressbook/ldap/ldap-book.cpp (original)
+++ trunk/lib/engine/addressbook/ldap/ldap-book.cpp Fri Jul 25 21:25:15 2008
@@ -48,7 +48,7 @@
#include "ldap-book.h"
#include "form-request-simple.h"
-
+#include "robust-xml.h"
/* little helper function... can probably be made more complete */
static const std::string
@@ -71,25 +71,6 @@
return result;
}
-/* another helper, which helps avoid crashes */
-static void
-robust_xmlNodeSetContent (xmlNodePtr parent,
- xmlNodePtr* child,
- const std::string& name,
- const std::string& value)
-{
- if (*child == NULL) {
-
- *child = xmlNewChild (parent, NULL,
- BAD_CAST name.c_str (),
- BAD_CAST value.c_str ());
- } else {
-
- xmlNodeSetContent (*child, xmlEncodeSpecialChars ((*child)->doc,
- BAD_CAST value.c_str ()));
- }
-}
-
/* parses a message to construct a nice contact */
static OPENLDAP::Contact *
parse_result (Ekiga::ServiceCore &core,
Modified: trunk/lib/engine/framework/Makefile.am
==============================================================================
--- trunk/lib/engine/framework/Makefile.am (original)
+++ trunk/lib/engine/framework/Makefile.am Fri Jul 25 21:25:15 2008
@@ -10,32 +10,34 @@
-I$(top_srcdir)/lib/engine/framework
libgmframework_la_SOURCES = \
- $(framework_dir)/services.h \
- $(framework_dir)/chain-of-responsibility.h \
- $(framework_dir)/form-builder.h \
- $(framework_dir)/form-dumper.h \
- $(framework_dir)/form.h \
- $(framework_dir)/form-request.h \
- $(framework_dir)/form-request-simple.h \
- $(framework_dir)/form-visitor.h \
- $(framework_dir)/gmconf-bridge.h \
- $(framework_dir)/gmconf-bridge.cpp \
- $(framework_dir)/map-key-reference-iterator.h \
- $(framework_dir)/map-key-const-reference-iterator.h \
- $(framework_dir)/runtime.h \
- $(framework_dir)/menu-builder.h \
- $(framework_dir)/menu-builder.cpp \
- $(framework_dir)/menu-builder-tools.h \
- $(framework_dir)/menu-builder-tools.cpp \
- $(framework_dir)/form-builder.cpp \
- $(framework_dir)/form-dumper.cpp \
- $(framework_dir)/form-request-simple.cpp \
- $(framework_dir)/runtime-glib.cpp \
- $(framework_dir)/services.cpp \
- $(framework_dir)/trigger.h \
- $(framework_dir)/menu-xml.h \
- $(framework_dir)/menu-xml.cpp \
- $(framework_dir)/personal-details.h \
- $(framework_dir)/personal-details.cpp
+ $(framework_dir)/services.h \
+ $(framework_dir)/chain-of-responsibility.h \
+ $(framework_dir)/form-builder.h \
+ $(framework_dir)/form-dumper.h \
+ $(framework_dir)/form.h \
+ $(framework_dir)/form-request.h \
+ $(framework_dir)/form-request-simple.h \
+ $(framework_dir)/robust-xml.h \
+ $(framework_dir)/robust-xml.cpp \
+ $(framework_dir)/form-visitor.h \
+ $(framework_dir)/gmconf-bridge.h \
+ $(framework_dir)/gmconf-bridge.cpp \
+ $(framework_dir)/map-key-reference-iterator.h \
+ $(framework_dir)/map-key-const-reference-iterator.h \
+ $(framework_dir)/runtime.h \
+ $(framework_dir)/menu-builder.h \
+ $(framework_dir)/menu-builder.cpp \
+ $(framework_dir)/menu-builder-tools.h \
+ $(framework_dir)/menu-builder-tools.cpp \
+ $(framework_dir)/form-builder.cpp \
+ $(framework_dir)/form-dumper.cpp \
+ $(framework_dir)/form-request-simple.cpp \
+ $(framework_dir)/runtime-glib.cpp \
+ $(framework_dir)/services.cpp \
+ $(framework_dir)/trigger.h \
+ $(framework_dir)/menu-xml.h \
+ $(framework_dir)/menu-xml.cpp \
+ $(framework_dir)/personal-details.h \
+ $(framework_dir)/personal-details.cpp
libgmframework_la_LDFLAGS = -export-dynamic -no-undefined $(SIGC_LIBS) $(GLIB_LIBS) $(XML_LIBS)
Added: trunk/lib/engine/framework/robust-xml.cpp
==============================================================================
--- (empty file)
+++ trunk/lib/engine/framework/robust-xml.cpp Fri Jul 25 21:25:15 2008
@@ -0,0 +1,54 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Ekiga is licensed under the GPL license and as a special exception, you
+ * have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
+ * programs, as long as you do follow the requirements of the GNU GPL for all
+ * the rest of the software thus combined.
+ */
+
+
+/*
+ * robust-xml.cpp - description
+ * ------------------------------------------
+ * begin : written in july 2008 by Julien Puydt
+ * copyright : (c) 2008 by Julien Puydt
+ * description : implementation of helpers to work with XML docs
+ *
+ */
+
+#include "robust-xml.h"
+
+void
+robust_xmlNodeSetContent (xmlNodePtr parent,
+ xmlNodePtr* child,
+ const std::string& name,
+ const std::string& value)
+{
+ if (*child == NULL) {
+
+ *child = xmlNewChild (parent, NULL,
+ BAD_CAST name.c_str (),
+ BAD_CAST value.c_str ());
+ } else {
+
+ xmlNodeSetContent (*child, xmlEncodeSpecialChars ((*child)->doc,
+ BAD_CAST value.c_str ()));
+ }
+}
Added: trunk/lib/engine/framework/robust-xml.h
==============================================================================
--- (empty file)
+++ trunk/lib/engine/framework/robust-xml.h Fri Jul 25 21:25:15 2008
@@ -0,0 +1,53 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Ekiga is licensed under the GPL license and as a special exception, you
+ * have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
+ * programs, as long as you do follow the requirements of the GNU GPL for all
+ * the rest of the software thus combined.
+ */
+
+
+/*
+ * robust-xml.h - description
+ * ------------------------------------------
+ * begin : written in july 2008 by Julien Puydt
+ * copyright : (c) 2008 by Julien Puydt
+ * description : declaration of helpers to work with XML docs
+ *
+ */
+
+#ifndef __ROBUST_XML_H__
+#define __ROBUST_XML_H__
+
+#include <string>
+#include <libxml/tree.h>
+
+/* Sets the content of a node to a given value, creating the node if needed.
+ * @param parent The parent node of the node whose value should be set
+ * @param child The node whose value should be set, or NULL if needs creating
+ * @param name The name of the node whose value should be set
+ * @param value The value which should be set
+ */
+void robust_xmlNodeSetContent (xmlNodePtr parent,
+ xmlNodePtr* child,
+ const std::string& name,
+ const std::string& value);
+
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]