X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetwork%2Fprops.cxx;h=1a42c8d62f536f03c7ea64b815c92222efa53f20;hb=17c96ae69ed7a3c33c816e821ae88c501ab7cf65;hp=77fac588bb47c9f190302b4b89a8cbce70523534;hpb=3b88c71122e33315c51bbf7676f12abf9c512989;p=flightgear.git diff --git a/src/Network/props.cxx b/src/Network/props.cxx index 77fac588b..1a42c8d62 100644 --- a/src/Network/props.cxx +++ b/src/Network/props.cxx @@ -35,8 +35,8 @@ #include "props.hxx" -FG_USING_STD(cout); -FG_USING_STD(istrstream); +SG_USING_STD(cout); +SG_USING_STD(istrstream); FGProps::FGProps() { } @@ -63,6 +63,7 @@ bool FGProps::open() { } set_enabled( true ); + FG_LOG( FG_IO, FG_INFO, "Opening properties channel communication layer." ); return true; } @@ -129,6 +130,22 @@ bool FGProps::process_command( const char *cmd ) { } io->writestring( line.c_str() ); } + } else if ( command == "dump" ) { + strstream buf; + if ( tokens.size() <= 1 ) { + writeProperties ( buf, node); + io->writestring( buf.str() ); + } + else { + SGPropertyNode *child = node->getNode(tokens[1]); + if ( child ) { + writeProperties ( buf, child ); + io->writestring( buf.str() ); + } else { + tokens[1] += " Not Found\n"; + io->writestring( tokens[1].c_str() ); + } + } } else if ( command == "cd" ) { // string tmp = "current path = " + node.getPath() + "\n"; // io->writestring( tmp.c_str() ); @@ -136,8 +153,14 @@ bool FGProps::process_command( const char *cmd ) { if ( tokens.size() <= 1 ) { // do nothing } else { - node = node->getNode(tokens[1]); - path = node->getPath(); + SGPropertyNode *child = node->getNode(tokens[1]); + if ( child ) { + node = child; + path = node->getPath(); + } else { + tokens[1] += " Not Found\n"; + io->writestring( tokens[1].c_str() ); + } } } else if ( command == "pwd" ) { string ttt = node->getPath(); @@ -146,7 +169,7 @@ bool FGProps::process_command( const char *cmd ) { } ttt += "\n"; io->writestring( ttt.c_str() ); - } else if ( command == "show" ) { + } else if ( command == "get" || command == "show" ) { if ( tokens.size() <= 1 ) { // do nothing } else { @@ -183,9 +206,11 @@ bool FGProps::process_command( const char *cmd ) { io->writestring( "\n" ); io->writestring( "help show help message\n" ); io->writestring( "ls list current directory\n" ); + io->writestring( "dump dump current state (in xml)\n" ); io->writestring( "cd cd to a directory, '..' to move back\n" ); io->writestring( "pwd display your current path\n" ); - io->writestring( "show show the value of a parameter\n" ); + io->writestring( "get show the value of a parameter\n" ); + io->writestring( "show synonym for get\n" ); io->writestring( "set set to a new \n" ); io->writestring( "quit terminate connection\n" ); io->writestring( "\n" );