[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [5511] Simplify, avoiding pointless use of smart pointers
From: |
Greg Chicares |
Subject: |
[lmi-commits] [5511] Simplify, avoiding pointless use of smart pointers |
Date: |
Thu, 28 Jun 2012 09:16:20 +0000 |
Revision: 5511
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5511
Author: chicares
Date: 2012-06-28 09:16:19 +0000 (Thu, 28 Jun 2012)
Log Message:
-----------
Simplify, avoiding pointless use of smart pointers
Modified Paths:
--------------
lmi/trunk/illustration_document.cpp
lmi/trunk/illustration_view.cpp
lmi/trunk/mec_view.cpp
lmi/trunk/mec_xml_document.cpp
lmi/trunk/mec_xml_document.hpp
lmi/trunk/single_cell_document.cpp
lmi/trunk/single_cell_document.hpp
Modified: lmi/trunk/illustration_document.cpp
===================================================================
--- lmi/trunk/illustration_document.cpp 2012-06-27 09:08:32 UTC (rev 5510)
+++ lmi/trunk/illustration_document.cpp 2012-06-28 09:16:19 UTC (rev 5511)
@@ -95,7 +95,7 @@
}
else if(wxDOC_NEW & flags)
{
- *doc_.input_data_ = default_cell();
+ doc_.input_data_ = default_cell();
}
else
{
Modified: lmi/trunk/illustration_view.cpp
===================================================================
--- lmi/trunk/illustration_view.cpp 2012-06-27 09:08:32 UTC (rev 5510)
+++ lmi/trunk/illustration_view.cpp 2012-06-28 09:16:19 UTC (rev 5511)
@@ -110,7 +110,7 @@
inline Input& IllustrationView::input_data()
{
- return *document().doc_.input_data_;
+ return document().doc_.input_data_;
}
IllustrationDocument& IllustrationView::document() const
Modified: lmi/trunk/mec_view.cpp
===================================================================
--- lmi/trunk/mec_view.cpp 2012-06-27 09:08:32 UTC (rev 5510)
+++ lmi/trunk/mec_view.cpp 2012-06-28 09:16:19 UTC (rev 5511)
@@ -103,7 +103,7 @@
inline mec_input& mec_view::input_data()
{
- return *document().doc_.input_data_;
+ return document().doc_.input_data_;
}
mec_document& mec_view::document() const
Modified: lmi/trunk/mec_xml_document.cpp
===================================================================
--- lmi/trunk/mec_xml_document.cpp 2012-06-27 09:08:32 UTC (rev 5510)
+++ lmi/trunk/mec_xml_document.cpp 2012-06-28 09:16:19 UTC (rev 5511)
@@ -29,7 +29,6 @@
#include "mec_xml_document.hpp"
#include "assert_lmi.hpp"
-#include "mec_input.hpp"
#include "xml_lmi.hpp"
#include <xmlwrapp/nodes_view.h>
@@ -39,13 +38,13 @@
//============================================================================
mec_xml_document::mec_xml_document()
- :input_data_(new mec_input)
+ :input_data_()
{
}
//============================================================================
mec_xml_document::mec_xml_document(mec_input const& z)
- :input_data_(new mec_input(z))
+ :input_data_(z)
{
}
@@ -67,7 +66,7 @@
xml::const_nodes_view const elements(root.elements());
LMI_ASSERT(!elements.empty());
xml::const_nodes_view::const_iterator i(elements.begin());
- *i >> *input_data_;
+ *i >> input_data_;
// XMLWRAPP !! It would be better to have operator+(int) in the
// iterator class, and to write this check above as
// LMI_ASSERT(elements.end() == 1 + i);
@@ -82,11 +81,11 @@
}
//============================================================================
-void mec_xml_document::write(std::ostream& os)
+void mec_xml_document::write(std::ostream& os) const
{
xml_lmi::xml_document document(xml_root_name());
xml::element& root = document.root_node();
- root << *input_data_;
+ root << input_data_;
os << document;
}
Modified: lmi/trunk/mec_xml_document.hpp
===================================================================
--- lmi/trunk/mec_xml_document.hpp 2012-06-27 09:08:32 UTC (rev 5510)
+++ lmi/trunk/mec_xml_document.hpp 2012-06-28 09:16:19 UTC (rev 5511)
@@ -26,13 +26,12 @@
#include "config.hpp"
+#include "mec_input.hpp"
#include "obstruct_slicing.hpp"
#include "so_attributes.hpp"
#include "uncopyable_lmi.hpp"
#include "xml_lmi_fwd.hpp"
-#include <boost/scoped_ptr.hpp>
-
#include <iosfwd>
#include <string>
@@ -53,18 +52,18 @@
mec_input const& input_data() const;
void read(std::istream const&);
- void write(std::ostream&);
+ void write(std::ostream&) const;
private:
void parse(xml::element const&);
std::string const& xml_root_name() const;
- boost::scoped_ptr<mec_input> const input_data_;
+ mec_input input_data_;
};
inline mec_input const& mec_xml_document::input_data() const
{
- return *input_data_;
+ return input_data_;
}
#endif // mec_xml_document_hpp
Modified: lmi/trunk/single_cell_document.cpp
===================================================================
--- lmi/trunk/single_cell_document.cpp 2012-06-27 09:08:32 UTC (rev 5510)
+++ lmi/trunk/single_cell_document.cpp 2012-06-28 09:16:19 UTC (rev 5511)
@@ -29,7 +29,6 @@
#include "single_cell_document.hpp"
#include "assert_lmi.hpp"
-#include "input.hpp"
#include "xml_lmi.hpp"
#include <xmlwrapp/nodes_view.h>
@@ -39,20 +38,20 @@
//============================================================================
single_cell_document::single_cell_document()
- :input_data_(new Input)
+ :input_data_()
{
}
//============================================================================
single_cell_document::single_cell_document(Input const& parms)
- :input_data_(new Input(parms))
+ :input_data_(parms)
{
}
/// This ctor is used to read the default input file.
single_cell_document::single_cell_document(std::string const& filename)
- :input_data_(new Input)
+ :input_data_()
{
xml_lmi::dom_parser parser(filename);
parse(parser.root_node(xml_root_name()));
@@ -76,7 +75,7 @@
xml::const_nodes_view const elements(root.elements());
LMI_ASSERT(!elements.empty());
xml::const_nodes_view::const_iterator i(elements.begin());
- *i >> *input_data_;
+ *i >> input_data_;
// XMLWRAPP !! It would be better to have operator+(int) in the
// iterator class, and to write this check above as
// LMI_ASSERT(elements.end() == 1 + i);
@@ -91,11 +90,11 @@
}
//============================================================================
-void single_cell_document::write(std::ostream& os)
+void single_cell_document::write(std::ostream& os) const
{
xml_lmi::xml_document document(xml_root_name());
xml::element& root = document.root_node();
- root << *input_data_;
+ root << input_data_;
os << document;
}
Modified: lmi/trunk/single_cell_document.hpp
===================================================================
--- lmi/trunk/single_cell_document.hpp 2012-06-27 09:08:32 UTC (rev 5510)
+++ lmi/trunk/single_cell_document.hpp 2012-06-28 09:16:19 UTC (rev 5511)
@@ -26,13 +26,12 @@
#include "config.hpp"
+#include "input.hpp"
#include "obstruct_slicing.hpp"
#include "so_attributes.hpp"
#include "uncopyable_lmi.hpp"
#include "xml_lmi_fwd.hpp"
-#include <boost/scoped_ptr.hpp>
-
#include <iosfwd>
#include <string>
@@ -54,18 +53,18 @@
Input const& input_data() const;
void read(std::istream const&);
- void write(std::ostream&);
+ void write(std::ostream&) const;
private:
void parse(xml::element const&);
std::string const& xml_root_name() const;
- boost::scoped_ptr<Input> const input_data_;
+ Input input_data_;
};
inline Input const& single_cell_document::input_data() const
{
- return *input_data_;
+ return input_data_;
}
#endif // single_cell_document_hpp
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [5511] Simplify, avoiding pointless use of smart pointers,
Greg Chicares <=