[libvtemm] Added overloaded assignment operator for Master class.



commit 9ad59f33b085f4ea27453ff01e85357bb75ba10e
Author: Krzesimir Nowak <krnowak svn gnome org>
Date:   Mon Jul 27 17:27:28 2009 +0200

    Added overloaded assignment operator for Master class.
    
    * src/libvtemm/ptymaster.cc:
    * src/libvtemm/ptymaster.h: Added overloaded assignment operator
    for Master class - it works like a copy constructor, so now a copy
    won't be a main instance.

 src/libvtemm/ptymaster.cc |    6 ++++++
 src/libvtemm/ptymaster.h  |    6 ++++++
 2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/libvtemm/ptymaster.cc b/src/libvtemm/ptymaster.cc
index 67fe397..4b305cd 100644
--- a/src/libvtemm/ptymaster.cc
+++ b/src/libvtemm/ptymaster.cc
@@ -53,6 +53,12 @@ Master::~Master()
   }
 }
 
+Master& operator=(Master& master)
+{
+  this->md = master.m_d;
+  this->m_is_main(false);
+  return *this;
+}
 
 Glib::Pid
 Master::open(const std::string& command,
diff --git a/src/libvtemm/ptymaster.h b/src/libvtemm/ptymaster.h
index 6d16f5c..1bf76ca 100644
--- a/src/libvtemm/ptymaster.h
+++ b/src/libvtemm/ptymaster.h
@@ -58,6 +58,12 @@ public:
    * close(). Otherwise it does nothing.
    */
   ~Master();
+  
+  /** Just a copy constructor. Copied instance won't be a main instance even if
+   * original is.
+   * @param master Original master to copy.
+   */
+  Master& operator=(Master& master);
 
   /** Start up the given binary (exact path, not interpreted at all) in a
    * pseudo-terminal of its own, returning the child's PID and logging the



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]