From 0fc020fb73c86a20608e8dff12af607e60327379 Mon Sep 17 00:00:00 2001 From: Hossein Date: Tue, 29 Jun 2021 20:24:59 +0200 Subject: Cleaning up DocumentLoader C++ SDK example * Removing calls to C functions * Simplifying string usage Change-Id: Ia8ca329d7ad586d98e309809e430006eaac9eaaa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118131 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens --- odk/examples/cpp/DocumentLoader/DocumentLoader.cxx | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx b/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx index 7e1f89cf3875..057a9e8152b0 100644 --- a/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx +++ b/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx @@ -34,9 +34,7 @@ *************************************************************************/ // Simple client application using the UnoUrlResolver service. -#include -#include - +#include #include #include @@ -51,8 +49,7 @@ #include #include -#include - +using namespace std; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; @@ -60,9 +57,7 @@ using namespace com::sun::star::bridge; using namespace com::sun::star::frame; using namespace com::sun::star::registry; -using ::rtl::OUString; -using ::rtl::OUStringToOString; - +using namespace rtl; SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { @@ -72,8 +67,14 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) if (nCount < 1) { - printf("using: DocumentLoader -env:URE_MORE_TYPES= []\n\n" - "example: DocumentLoader -env:URE_MORE_TYPES=\"file:///.../program/offapi.rdb\" \"file:///e:/temp/test.odt\" \"uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager\"\n"); + cout << "using: DocumentLoader -env:URE_MORE_TYPES= " + "[]" + << endl + << endl + << "example: DocumentLoader -env:URE_MORE_TYPES=\"file:///.../program/offapi.rdb\" " + "\"file:///e:/temp/test.odt\" " + "\"uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager\"" + << endl; exit(1); } if (nCount == 2) @@ -108,9 +109,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) } catch ( Exception& e ) { - printf("Error: cannot establish a connection using '%s':\n %s\n", - OUStringToOString(sConnectionString, RTL_TEXTENCODING_ASCII_US).getStr(), - OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US).getStr()); + cout << "Error: cannot establish a connection using " + << sConnectionString << endl << e.Message << endl; exit(1); } -- cgit