]> git.mxchange.org Git - flightgear.git/commitdiff
Use SGPropertyNode_ptr and add a private copy constructor, both for
authordavid <david>
Sun, 22 Dec 2002 19:57:09 +0000 (19:57 +0000)
committerdavid <david>
Sun, 22 Dec 2002 19:57:09 +0000 (19:57 +0000)
safety's sake.

src/Input/input.cxx
src/Input/input.hxx

index 66ae607f81c4c68957386b19c34eef58bd7131e3..f5ccdfa5a5415eae871614f91b8db941fb48e4a4 100644 (file)
@@ -89,27 +89,21 @@ FGBinding::FGBinding ()
 }
 
 FGBinding::FGBinding (const SGPropertyNode * node)
-  : _command(0),
-    _arg(new SGPropertyNode),
-    _setting(0)
 {
+  FGBinding();
   read(node);
 }
 
 FGBinding::~FGBinding ()
 {
-//   delete _arg;                       // Delete the saved arguments
-//   delete _command_state;     // Delete the saved command state
 }
 
 void
 FGBinding::read (const SGPropertyNode * node)
 {
   const SGPropertyNode * conditionNode = node->getChild("condition");
-  if (conditionNode != 0) {
-    cerr << "Adding condition to binding" << endl;
+  if (conditionNode != 0)
     setCondition(fgReadCondition(conditionNode));
-  }
 
   _command_name = node->getStringValue("command", "");
   if (_command_name.empty()) {
@@ -125,10 +119,7 @@ FGBinding::read (const SGPropertyNode * node)
     return;
   }
 
-  delete _arg;
-  _arg = new SGPropertyNode;
-  _setting = 0;
-  copyProperties(node, _arg);  // FIXME: don't use whole node!!!
+  _arg = (SGPropertyNode *)node;
 }
 
 void
index 007e70a9376c703e6605f39a9ea946531f30c47a..491c0a2ca4da41b7c68abb19b395f1202de9ee7a 100644 (file)
@@ -139,10 +139,14 @@ public:
 
 
 private:
+                                // just to be safe.
+  FGBinding (const FGBinding &binding);
+
+
   string _command_name;
   SGCommandMgr::command_t _command;
-  mutable SGPropertyNode * _arg;
-  mutable SGPropertyNode * _setting;
+  mutable SGPropertyNode_ptr _arg;
+  mutable SGPropertyNode_ptr _setting;
 };