cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: kupcevic@sourceware.org <kupcevic@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/ricci common/XML.cpp include/XML.h modul ...
Date: 26 Sep 2006 00:54:27 -0000	[thread overview]
Message-ID: <20060926005427.15669.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	kupcevic at sourceware.org	2006-09-26 00:54:26

Modified files:
	ricci/common   : XML.cpp 
	ricci/include  : XML.h 
	ricci/modules/cluster: ClusterConf.cpp 

Log message:
	xml file parsing - code aggregation

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/XML.cpp.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/include/XML.h.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterConf.cpp.diff?cvsroot=cluster&r1=1.5&r2=1.6

--- conga/ricci/common/XML.cpp	2006/08/14 23:55:48	1.4
+++ conga/ricci/common/XML.cpp	2006/09/26 00:54:26	1.5
@@ -29,7 +29,7 @@
 #include <libxml/tree.h>
 
 #include <algorithm>
-
+#include <fstream>
 
 //#include <iostream>
 using namespace std;
@@ -226,6 +226,28 @@
   return xml;
 }
 
+XMLObject 
+readXML(const String& filename)
+{
+  char* buff = 0;
+  try {
+    ifstream is(filename.c_str());
+    is.seekg(0, ios::end);
+    unsigned int length = is.tellg();
+    is.seekg(0, ios::beg);
+    buff = new char[length];
+    is.read(buff, length);
+    String xml_data(buff, length);
+    
+    XMLObject xml(parseXML(xml_data));
+    delete [] buff; buff = 0;
+    return xml;
+  } catch ( ... ) {
+    delete [] buff;
+    throw;
+  }
+}
+
 
 
 
--- conga/ricci/include/XML.h	2006/08/10 22:53:07	1.3
+++ conga/ricci/include/XML.h	2006/09/26 00:54:26	1.4
@@ -64,6 +64,7 @@
 };
 
 
+XMLObject readXML(const String& filename);
 XMLObject parseXML(const String& xml);
 String generateXML(const XMLObject& obj);
 
--- conga/ricci/modules/cluster/ClusterConf.cpp	2006/08/15 00:16:30	1.5
+++ conga/ricci/modules/cluster/ClusterConf.cpp	2006/09/26 00:54:26	1.6
@@ -49,24 +49,7 @@
 XMLObject
 ClusterConf::get()
 {
-  char* buff = 0;
-  try {
-    ifstream is(CLUSTER_CONF_PATH.c_str());
-    is.seekg(0, ios::end);
-    unsigned int length = is.tellg();
-    is.seekg(0, ios::beg);
-    buff = new char[length];
-    is.read(buff, length);
-    String cluster_conf(buff, length);
-    
-    XMLObject xml(parseXML(cluster_conf));
-    delete [] buff;
-    buff = 0;
-    return xml;
-  } catch ( ... ) {
-    delete [] buff;
-    throw;
-  }
+  return readXML(CLUSTER_CONF_PATH);
 }
 
 void



                 reply	other threads:[~2006-09-26  0:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060926005427.15669.qmail@sourceware.org \
    --to=kupcevic@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).