src/relpipe-in-x11.cpp
branchv_0
changeset 3 72384bb5c66e
parent 0 3493d6e7016e
child 12 b291a7db2d39
equal deleted inserted replaced
2:8d44cba0a3d1 3:72384bb5c66e
    14  * You should have received a copy of the GNU General Public License
    14  * You should have received a copy of the GNU General Public License
    15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
    15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
    16  */
    16  */
    17 #include <cstdlib>
    17 #include <cstdlib>
    18 #include <memory>
    18 #include <memory>
       
    19 #include <functional>
    19 
    20 
    20 #include <relpipe/writer/RelationalWriter.h>
    21 #include <relpipe/writer/RelationalWriter.h>
    21 #include <relpipe/writer/RelpipeWriterException.h>
    22 #include <relpipe/writer/RelpipeWriterException.h>
    22 #include <relpipe/writer/Factory.h>
    23 #include <relpipe/writer/Factory.h>
    23 #include <relpipe/writer/TypeId.h>
    24 #include <relpipe/writer/TypeId.h>
    44 	try {
    45 	try {
    45 		CLIParser cliParser;
    46 		CLIParser cliParser;
    46 		Configuration configuration = cliParser.parse(cli.arguments());
    47 		Configuration configuration = cliParser.parse(cli.arguments());
    47 		X11Command command;
    48 		X11Command command;
    48 		std::shared_ptr<RelationalWriter> writer(Factory::create(std::cout));
    49 		std::shared_ptr<RelationalWriter> writer(Factory::create(std::cout));
    49 		command.process(configuration, writer);
    50 		command.process(configuration, writer, std::bind(fflush, stdout)); // std::bind(fflush, XXX) Factory::create(XXX) must be the same stream XXX
    50 		resultCode = CLI::EXIT_CODE_SUCCESS;
    51 		resultCode = CLI::EXIT_CODE_SUCCESS;
    51 	} catch (RelpipeWriterException& e) {
    52 	} catch (RelpipeWriterException& e) {
    52 		fwprintf(stderr, L"Caught Writer exception: %ls\n", e.getMessge().c_str());
    53 		fwprintf(stderr, L"Caught Writer exception: %ls\n", e.getMessge().c_str());
    53 		fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount());
    54 		fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount());
    54 		resultCode = CLI::EXIT_CODE_DATA_ERROR;
    55 		resultCode = CLI::EXIT_CODE_DATA_ERROR;