1
0
Fork 0

changes for SGPropertyNode::getPath return type

It's now a std::string.
This commit is contained in:
Tim Moore 2009-12-18 07:15:48 +01:00 committed by Tim Moore
parent fa7d9ed549
commit 7ff80d11a0
6 changed files with 15 additions and 7 deletions

View file

@ -226,7 +226,7 @@ void FGAIBase::initModel(osg::Node *node)
{ {
if (model.valid()) { if (model.valid()) {
fgSetString("/ai/models/model-added", props->getPath()); fgSetString("/ai/models/model-added", props->getPath().c_str());
} else if (!model_path.empty()) { } else if (!model_path.empty()) {
SG_LOG(SG_INPUT, SG_WARN, "AIBase: Could not load model " << model_path); SG_LOG(SG_INPUT, SG_WARN, "AIBase: Could not load model " << model_path);

View file

@ -356,7 +356,7 @@ FGMenuBar::add_enabled_listener(SGPropertyNode * node)
bool bool
FGMenuBar::enable_item(const SGPropertyNode * node, bool state) FGMenuBar::enable_item(const SGPropertyNode * node, bool state)
{ {
const char *path = node->getPath(); string path = node->getPath();
if (_objects.find(path) == _objects.end()) { if (_objects.find(path) == _objects.end()) {
SG_LOG(SG_GENERAL, SG_ALERT, "Trying to enable/disable " SG_LOG(SG_GENERAL, SG_ALERT, "Trying to enable/disable "
"non-existent menu item for node `" << path << '\''); "non-existent menu item for node `" << path << '\'');

View file

@ -23,6 +23,7 @@
#ifndef _PROPERTY_LIST_HXX #ifndef _PROPERTY_LIST_HXX
#define _PROPERTY_LIST_HXX #define _PROPERTY_LIST_HXX
#include <string>
#include <plib/puAux.h> #include <plib/puAux.h>
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
@ -41,7 +42,13 @@ public:
void toggleVerbosity() { _verbose = !_verbose; } void toggleVerbosity() { _verbose = !_verbose; }
// overridden plib pui methods // overridden plib pui methods
virtual char *getStringValue(void) { return (char *)(_return ? _return->getPath(true) : ""); } virtual char *getStringValue(void)
{
_return_path.clear();
if (_return)
_return_path = _return->getPath(true);
return const_cast<char*>(_return_path.c_str());
}
//virtual char *getListStringValue() { return (char *)(_return ? _return->getPath(true) : ""); } //virtual char *getListStringValue() { return (char *)(_return ? _return->getPath(true) : ""); }
virtual void setValue(const char *); virtual void setValue(const char *);
@ -81,6 +88,7 @@ private:
bool _dot_files; // . and .. pseudo-dirs currently shown? bool _dot_files; // . and .. pseudo-dirs currently shown?
bool _verbose; // show SGPropertyNode flags bool _verbose; // show SGPropertyNode flags
std::string _return_path;
}; };

View file

@ -222,7 +222,7 @@ GPS::Config::getCourseSource() const
return ""; return "";
} }
return _extCourseSource->getPath(true); return _extCourseSource->getPath(true).c_str();
} }
void void

View file

@ -93,7 +93,7 @@ FGLogger::init ()
fgGetNode(entry->getStringValue("property"), true); fgGetNode(entry->getStringValue("property"), true);
log.nodes.push_back(node); log.nodes.push_back(node);
(*log.output) << log.delimiter (*log.output) << log.delimiter
<< entry->getStringValue("title", node->getPath()); << entry->getStringValue("title", node->getPath().c_str());
} }
(*log.output) << endl; (*log.output) << endl;
} }

View file

@ -759,7 +759,7 @@ void FGNasalSys::loadPropertyScripts()
const char* src = n->getStringValue("script"); const char* src = n->getStringValue("script");
if(!n->hasChild("script")) src = 0; // Hrm... if(!n->hasChild("script")) src = 0; // Hrm...
if(src) if(src)
createModule(module, n->getPath(), src, strlen(src)); createModule(module, n->getPath().c_str(), src, strlen(src));
if(!file_specified && !src) if(!file_specified && !src)
SG_LOG(SG_NASAL, SG_ALERT, "Nasal error: " << SG_LOG(SG_NASAL, SG_ALERT, "Nasal error: " <<
@ -856,7 +856,7 @@ bool FGNasalSys::handleCommand(const SGPropertyNode* arg)
{ {
const char* nasal = arg->getStringValue("script"); const char* nasal = arg->getStringValue("script");
const char* moduleName = arg->getStringValue("module"); const char* moduleName = arg->getStringValue("module");
naRef code = parse(arg->getPath(true), nasal, strlen(nasal)); naRef code = parse(arg->getPath(true).c_str(), nasal, strlen(nasal));
if(naIsNil(code)) return false; if(naIsNil(code)) return false;
// Commands can be run "in" a module. Make sure that module // Commands can be run "in" a module. Make sure that module