summaryrefslogtreecommitdiff
path: root/odk
diff options
context:
space:
mode:
authorHossein <hossein@libreoffice.org>2021-06-29 20:24:59 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2021-07-12 00:09:05 +0200
commit0fc020fb73c86a20608e8dff12af607e60327379 (patch)
tree61fca66623ceea8f02de6babf7ea68c7d919aed3 /odk
parentf3cd3927eef4fd79a988cfe61494bc225488b8b6 (diff)
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 <thorsten.behrens@allotropia.de> Tested-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'odk')
-rw-r--r--odk/examples/cpp/DocumentLoader/DocumentLoader.cxx26
1 files 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 <stdio.h>
-#include <wchar.h>
-
+#include <iostream>
#include <sal/main.h>
#include <cppuhelper/bootstrap.hxx>
@@ -51,8 +49,7 @@
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/registry/XSimpleRegistry.hpp>
-#include <string.h>
-
+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=<office_types_rdb_url> <file_url> [<uno_connection_url>]\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=<office_types_rdb_url> <file_url> "
+ "[<uno_connection_url>]"
+ << 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);
}