X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fmisc%2Fcommands.cxx;h=2280b6642eb54a5c026c34ecf2430455a5555646;hb=5bab565cfe4c30d6cf08ecaba50af74d5e4f0c98;hp=73964428eaed6f0b40ccbdd4455945f8cdd83f72;hpb=3980f08cc556865eadc94f854b08753aacb8f15d;p=simgear.git diff --git a/simgear/misc/commands.cxx b/simgear/misc/commands.cxx index 73964428..2280b664 100644 --- a/simgear/misc/commands.cxx +++ b/simgear/misc/commands.cxx @@ -7,6 +7,36 @@ #include "commands.hxx" + +//////////////////////////////////////////////////////////////////////// +// Implementation of SGCommandState class. +//////////////////////////////////////////////////////////////////////// + +SGCommandState::SGCommandState () + : _args(0) +{ +} + +SGCommandState::SGCommandState (const SGPropertyNode * args) + : _args(0) +{ + setArgs(args); +} + +SGCommandState::~SGCommandState () +{ + delete _args; +} + +void +SGCommandState::setArgs (const SGPropertyNode * args) +{ + delete _args; + _args = new SGPropertyNode(); + copyProperties(args, _args); +} + + //////////////////////////////////////////////////////////////////////// // Implementation of SGCommandMgr class. @@ -50,83 +80,84 @@ SGCommandMgr::getCommandNames () const } bool -SGCommandMgr::execute (const string &name, const SGPropertyNode * arg) const +SGCommandMgr::execute (const string &name, const SGPropertyNode * arg, + SGCommandState ** state) const { command_t command = getCommand(name); if (command == 0) return false; else - return (*command)(arg); + return (*command)(arg, state); } -bool -SGCommandMgr::execute (const string &name) const -{ - // FIXME - SGPropertyNode node; - execute(name, &node); -} - - -bool -SGCommandMgr::execute (const string &name, bool value) const -{ - // FIXME - SGPropertyNode node; - node.setBoolValue(value); - execute(name, &node); -} - - -bool -SGCommandMgr::execute (const string &name, int value) const -{ - // FIXME - SGPropertyNode node; - node.setIntValue(value); - execute(name, &node); -} - - -bool -SGCommandMgr::execute (const string &name, long value) const -{ - // FIXME - SGPropertyNode node; - node.setLongValue(value); - execute(name, &node); -} - - -bool -SGCommandMgr::execute (const string &name, float value) const -{ - // FIXME - SGPropertyNode node; - node.setFloatValue(value); - execute(name, &node); -} - - -bool -SGCommandMgr::execute (const string &name, double value) const -{ - // FIXME - SGPropertyNode node; - node.setDoubleValue(value); - execute(name, &node); -} - - -bool -SGCommandMgr::execute (const string &name, string value) const -{ - // FIXME - SGPropertyNode node; - node.setStringValue(value); - execute(name, &node); -} +// bool +// SGCommandMgr::execute (const string &name) const +// { +// // FIXME +// SGPropertyNode node; +// return execute(name, &node); +// } + + +// bool +// SGCommandMgr::execute (const string &name, bool value) const +// { +// // FIXME +// SGPropertyNode node; +// node.setBoolValue(value); +// return execute(name, &node); +// } + + +// bool +// SGCommandMgr::execute (const string &name, int value) const +// { +// // FIXME +// SGPropertyNode node; +// node.setIntValue(value); +// return execute(name, &node); +// } + + +// bool +// SGCommandMgr::execute (const string &name, long value) const +// { +// // FIXME +// SGPropertyNode node; +// node.setLongValue(value); +// return execute(name, &node); +// } + + +// bool +// SGCommandMgr::execute (const string &name, float value) const +// { +// // FIXME +// SGPropertyNode node; +// node.setFloatValue(value); +// return execute(name, &node); +// } + + +// bool +// SGCommandMgr::execute (const string &name, double value) const +// { +// // FIXME +// SGPropertyNode node; +// node.setDoubleValue(value); +// return execute(name, &node); +// } + + +// bool +// SGCommandMgr::execute (const string &name, string value) const +// { +// // FIXME +// SGPropertyNode node; +// node.setStringValue(value); +// return execute(name, &node); +// } // end of commands.cxx