X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInput%2FFGEventInput.cxx;h=a90d20c882e7c0aead8f5244ee3ec498bd6aa935;hb=f1d0ac52a6155fd511f6dc7bc18642353a0ccea9;hp=928c20c242a58ddee1ea5e97eafef1f0f89580ff;hpb=8933486a564f84d4a64008dca2a800396a6fc684;p=flightgear.git diff --git a/src/Input/FGEventInput.cxx b/src/Input/FGEventInput.cxx index 928c20c24..a90d20c88 100644 --- a/src/Input/FGEventInput.cxx +++ b/src/Input/FGEventInput.cxx @@ -24,11 +24,17 @@ # include #endif +#include #include "FGEventInput.hxx" #include
#include +#include #include +using simgear::PropertyList; +using std::cout; +using std::endl; + FGEventSetting::FGEventSetting( SGPropertyNode_ptr base ) : value(0.0) { @@ -64,7 +70,7 @@ bool FGEventSetting::Test() static inline bool StartsWith( string & s, const char * cp ) { - return s.compare( 0, strlen(cp), cp ) == 0; + return s.find( cp ) == 0; } FGInputEvent * FGInputEvent::NewObject( FGInputDevice * device, SGPropertyNode_ptr node ) @@ -93,8 +99,8 @@ FGInputEvent::FGInputEvent( FGInputDevice * aDevice, SGPropertyNode_ptr node ) : read_bindings( node, bindings, KEYMOD_NONE, device->GetNasalModule() ); - vector settingNodes = node->getChildren("setting"); - for( vector::iterator it = settingNodes.begin(); it != settingNodes.end(); it++ ) + PropertyList settingNodes = node->getChildren("setting"); + for( PropertyList::iterator it = settingNodes.begin(); it != settingNodes.end(); it++ ) settings.push_back( new FGEventSetting( *it ) ); } @@ -221,8 +227,8 @@ FGInputDevice::~FGInputDevice() if( nasal ) { SGPropertyNode_ptr nasalClose = nasal->getNode("close"); if (nasalClose) { - const char *s = nasalClose->getStringValue(); - nas->createModule(nasalModule.c_str(), nasalModule.c_str(), s, strlen(s), deviceNode ); + const string s = nasalClose->getStringValue(); + nas->createModule(nasalModule.c_str(), nasalModule.c_str(), s.c_str(), s.length(), deviceNode ); } } nas->deleteModule(nasalModule.c_str()); @@ -235,8 +241,8 @@ void FGInputDevice::Configure( SGPropertyNode_ptr aDeviceNode ) nasalModule = string("__event:") + GetName(); - vector eventNodes = deviceNode->getChildren( "event" ); - for( vector::iterator it = eventNodes.begin(); it != eventNodes.end(); it++ ) + PropertyList eventNodes = deviceNode->getChildren( "event" ); + for( PropertyList::iterator it = eventNodes.begin(); it != eventNodes.end(); it++ ) AddHandledEvent( FGInputEvent::NewObject( this, *it ) ); debugEvents = deviceNode->getBoolValue("debug-events", debugEvents ); @@ -251,10 +257,10 @@ void FGInputDevice::Configure( SGPropertyNode_ptr aDeviceNode ) if (nasal) { SGPropertyNode_ptr open = nasal->getNode("open"); if (open) { - const char *s = open->getStringValue(); + const string s = open->getStringValue(); FGNasalSys *nas = (FGNasalSys *)globals->get_subsystem("nasal"); if (nas) - nas->createModule(nasalModule.c_str(), nasalModule.c_str(), s, strlen(s), deviceNode ); + nas->createModule(nasalModule.c_str(), nasalModule.c_str(), s.c_str(), s.length(), deviceNode ); } }