]> git.mxchange.org Git - flightgear.git/commitdiff
changes for SGPropertyNode::getPath return type
authorTim Moore <timoore@redhat.com>
Fri, 18 Dec 2009 06:15:48 +0000 (07:15 +0100)
committerTim Moore <timoore33@gmail.com>
Tue, 9 Mar 2010 10:24:45 +0000 (11:24 +0100)
It's now a std::string.

src/AIModel/AIBase.cxx
src/GUI/menubar.cxx
src/GUI/property_list.hxx
src/Instrumentation/gps.cxx
src/Main/logger.cxx
src/Scripting/NasalSys.cxx

index 8c5532db1131be92a5c3eb0033b063473f03f844..de107a682bfc8ae356784e42c119304aa80098b3 100644 (file)
@@ -226,7 +226,7 @@ void FGAIBase::initModel(osg::Node *node)
 {
     if (model.valid()) {
 
-        fgSetString("/ai/models/model-added", props->getPath());
+        fgSetString("/ai/models/model-added", props->getPath().c_str());
 
     } else if (!model_path.empty()) {
         SG_LOG(SG_INPUT, SG_WARN, "AIBase: Could not load model " << model_path);
index d34f0fe3a9c1eadf3eb86a57b1fd24a6839c5694..89246a5ede79a1a6c68478c7af8aa4748a6be86e 100644 (file)
@@ -356,7 +356,7 @@ FGMenuBar::add_enabled_listener(SGPropertyNode * node)
 bool
 FGMenuBar::enable_item(const SGPropertyNode * node, bool state)
 {
-    const char *path = node->getPath();
+    string path = node->getPath();
     if (_objects.find(path) == _objects.end()) {
         SG_LOG(SG_GENERAL, SG_ALERT, "Trying to enable/disable "
             "non-existent menu item for node `" << path << '\'');
index beeaeda220e55ee671081302ce844161d5c90d62..046c09435b3872c4d7d9871b7d04c48a5fd75032 100644 (file)
@@ -23,6 +23,7 @@
 #ifndef _PROPERTY_LIST_HXX
 #define _PROPERTY_LIST_HXX
 
+#include <string>
 
 #include <plib/puAux.h>
 #include <simgear/props/props.hxx>
@@ -41,7 +42,13 @@ public:
     void toggleVerbosity() { _verbose = !_verbose; }
 
     // 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 void setValue(const char *);
 
@@ -81,6 +88,7 @@ private:
 
     bool _dot_files;      // . and .. pseudo-dirs currently shown?
     bool _verbose;        // show SGPropertyNode flags
+    std::string _return_path;
 };
 
 
index 2f7455b83820b022ffbe382d2fdf0935b0df7e93..e05805d831b7982fb174e13d7a4d45fb1a19a735 100644 (file)
@@ -222,7 +222,7 @@ GPS::Config::getCourseSource() const
     return "";
   }
   
-  return _extCourseSource->getPath(true);
+  return _extCourseSource->getPath(true).c_str();
 }
 
 void
index 95e0a5dbe0bc950210c5559ad17611e7b9fbe5b3..2a4561c7300610243673a77866383b08a86550eb 100644 (file)
@@ -93,7 +93,7 @@ FGLogger::init ()
        fgGetNode(entry->getStringValue("property"), true);
       log.nodes.push_back(node);
       (*log.output) << log.delimiter
-                   << entry->getStringValue("title", node->getPath());
+                   << entry->getStringValue("title", node->getPath().c_str());
     }
     (*log.output) << endl;
   }
index dc8b0d4342b94c99c25d3eea60f157348b6b4bca..a210d03569c50bbafbc35ba4bda2f4720e1f9f03 100644 (file)
@@ -759,7 +759,7 @@ void FGNasalSys::loadPropertyScripts()
         const char* src = n->getStringValue("script");
         if(!n->hasChild("script")) src = 0; // Hrm...
         if(src)
-            createModule(module, n->getPath(), src, strlen(src));
+            createModule(module, n->getPath().c_str(), src, strlen(src));
 
         if(!file_specified && !src)
             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* 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;
 
     // Commands can be run "in" a module.  Make sure that module