[Lemon-commits] Alpar Juttner: Merge

Lemon HG hg at lemon.cs.elte.hu
Mon Oct 6 12:06:28 CEST 2008


details:   http://lemon.cs.elte.hu/hg/lemon/rev/92b193385702
changeset: 297:92b193385702
user:      Alpar Juttner <alpar [at] cs.elte.hu>
date:      Mon Oct 06 11:01:03 2008 +0100
description:
	Merge

diffstat:

2 files changed, 56 insertions(+), 14 deletions(-)
lemon/lgf_reader.h |   40 ++++++++++++++++++++++++++++++++--------
lemon/lgf_writer.h |   30 ++++++++++++++++++++++++------

diffs (174 lines):

diff -r 9768e60aa4e1 -r 92b193385702 lemon/lgf_reader.h
--- a/lemon/lgf_reader.h	Sun Oct 05 12:36:26 2008 +0200
+++ b/lemon/lgf_reader.h	Mon Oct 06 11:01:03 2008 +0100
@@ -517,7 +517,10 @@
         _filename(fn), _digraph(digraph),
         _use_nodes(false), _use_arcs(false),
         _skip_nodes(false), _skip_arcs(false) {
-      if (!(*_is)) throw IoError("Cannot open file", fn);
+      if (!(*_is)) {
+        delete _is;
+        throw IoError("Cannot open file", fn);
+      }
     }
 
     /// \brief Constructor
@@ -529,7 +532,10 @@
         _filename(fn), _digraph(digraph),
         _use_nodes(false), _use_arcs(false),
         _skip_nodes(false), _skip_arcs(false) {
-      if (!(*_is)) throw IoError("Cannot open file", fn);
+      if (!(*_is)) {
+        delete _is;
+        throw IoError("Cannot open file", fn);
+      }
     }
 
     /// \brief Destructor
@@ -1308,7 +1314,10 @@
         _filename(fn), _graph(graph),
         _use_nodes(false), _use_edges(false),
         _skip_nodes(false), _skip_edges(false) {
-      if (!(*_is)) throw IoError("Cannot open file", fn);
+      if (!(*_is)) {
+        delete _is;
+        throw IoError("Cannot open file", fn);
+      }
     }
 
     /// \brief Constructor
@@ -1320,7 +1329,10 @@
         _filename(fn), _graph(graph),
         _use_nodes(false), _use_edges(false),
         _skip_nodes(false), _skip_edges(false) {
-      if (!(*_is)) throw IoError("Cannot open file", fn);
+      if (!(*_is)) {
+        delete _is;
+        throw IoError("Cannot open file", fn);
+      }
     }
 
     /// \brief Destructor
@@ -2094,7 +2106,10 @@
     SectionReader(const std::string& fn)
       : _is(new std::ifstream(fn.c_str())), local_is(true),
         _filename(fn) {
-      if (!(*_is)) throw IoError("Cannot open file", fn);
+      if (!(*_is)) {
+        delete _is;
+        throw IoError("Cannot open file", fn);
+      }
     }
 
     /// \brief Constructor
@@ -2103,7 +2118,10 @@
     SectionReader(const char* fn)
       : _is(new std::ifstream(fn)), local_is(true),
         _filename(fn) {
-      if (!(*_is)) throw IoError("Cannot open file", fn);
+      if (!(*_is)) {
+        delete _is;
+        throw IoError("Cannot open file", fn);
+      }
     }
 
     /// \brief Destructor
@@ -2386,7 +2404,10 @@
     /// file.
     LgfContents(const std::string& fn)
       : _is(new std::ifstream(fn.c_str())), local_is(true) {
-      if (!(*_is)) throw IoError("Cannot open file", fn);
+      if (!(*_is)) {
+        delete _is;
+        throw IoError("Cannot open file", fn);
+      }
     }
 
     /// \brief Constructor
@@ -2395,7 +2416,10 @@
     /// file.
     LgfContents(const char* fn)
       : _is(new std::ifstream(fn)), local_is(true) {
-      if (!(*_is)) throw IoError("Cannot open file", fn);
+      if (!(*_is)) {
+        delete _is;
+        throw IoError("Cannot open file", fn);
+      }
     }
 
     /// \brief Destructor
diff -r 9768e60aa4e1 -r 92b193385702 lemon/lgf_writer.h
--- a/lemon/lgf_writer.h	Sun Oct 05 12:36:26 2008 +0200
+++ b/lemon/lgf_writer.h	Mon Oct 06 11:01:03 2008 +0100
@@ -463,7 +463,10 @@
     DigraphWriter(const Digraph& digraph, const std::string& fn)
       : _os(new std::ofstream(fn.c_str())), local_os(true), _digraph(digraph),
         _skip_nodes(false), _skip_arcs(false) {
-      if (!(*_os)) throw IoError("Cannot write file", fn);
+      if (!(*_os)) {
+        delete _os;
+        throw IoError("Cannot write file", fn);
+      }
     }
 
     /// \brief Constructor
@@ -473,7 +476,10 @@
     DigraphWriter(const Digraph& digraph, const char* fn)
       : _os(new std::ofstream(fn)), local_os(true), _digraph(digraph),
         _skip_nodes(false), _skip_arcs(false) {
-      if (!(*_os)) throw IoError("Cannot write file", fn);
+      if (!(*_os)) {
+        delete _os;
+        throw IoError("Cannot write file", fn);
+      }
     }
 
     /// \brief Destructor
@@ -1024,7 +1030,10 @@
     GraphWriter(const Graph& graph, const std::string& fn)
       : _os(new std::ofstream(fn.c_str())), local_os(true), _graph(graph),
         _skip_nodes(false), _skip_edges(false) {
-      if (!(*_os)) throw IoError("Cannot write file", fn);
+      if (!(*_os)) {
+        delete _os;
+        throw IoError("Cannot write file", fn);
+      }
     }
 
     /// \brief Constructor
@@ -1034,7 +1043,10 @@
     GraphWriter(const Graph& graph, const char* fn)
       : _os(new std::ofstream(fn)), local_os(true), _graph(graph),
         _skip_nodes(false), _skip_edges(false) {
-      if (!(*_os)) throw IoError("Cannot write file", fn);
+      if (!(*_os)) {
+        delete _os;
+        throw IoError("Cannot write file", fn);
+      }
     }
 
     /// \brief Destructor
@@ -1587,7 +1599,10 @@
     /// Construct a section writer, which writes into the given file.
     SectionWriter(const std::string& fn)
       : _os(new std::ofstream(fn.c_str())), local_os(true) {
-      if (!(*_os)) throw IoError("Cannot write file", fn);
+      if (!(*_os)) {
+        delete _os;
+        throw IoError("Cannot write file", fn);
+      }
     }
 
     /// \brief Constructor
@@ -1595,7 +1610,10 @@
     /// Construct a section writer, which writes into the given file.
     SectionWriter(const char* fn)
       : _os(new std::ofstream(fn)), local_os(true) {
-      if (!(*_os)) throw IoError("Cannot write file", fn);
+      if (!(*_os)) {
+        delete _os;
+        throw IoError("Cannot write file", fn);
+      }
     }
 
     /// \brief Destructor



More information about the Lemon-commits mailing list