Kaydet (Commit) 58e79a27 authored tarafından Rüdiger Timm's avatar Rüdiger Timm

INTEGRATION: CWS jsc21 (1.5.92); FILE MERGED

2008/07/07 11:37:32 jsc 1.5.92.1: #i88797# adapted
üst aaebbb0e
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: TestCppComponent.cxx,v $ * $RCSfile: TestCppComponent.cxx,v $
* *
* $Revision: 1.5 $ * $Revision: 1.6 $
* *
* last change: $Author: kz $ $Date: 2006-11-06 14:59:41 $ * last change: $Author: rt $ $Date: 2008-07-11 14:18:02 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* the BSD license. * the BSD license.
...@@ -38,14 +38,13 @@ ...@@ -38,14 +38,13 @@
* *
*************************************************************************/ *************************************************************************/
#include <iostream> #include <stdio.h>
#include <cppuhelper/bootstrap.hxx> #include <cppuhelper/bootstrap.hxx>
#include <com/sun/star/bridge/XUnoUrlResolver.hpp> #include <com/sun/star/bridge/XUnoUrlResolver.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/XComponentLoader.hpp>
#include <my_module/MyService1.hpp> #include <my_module/MyService1.hpp>
#include <my_module/MyService2.hpp> #include <my_module/MyService2.hpp>
using namespace std;
using namespace rtl; using namespace rtl;
using namespace com::sun::star::uno; using namespace com::sun::star::uno;
//namespace cssuno = ::com::sun::star::uno; //namespace cssuno = ::com::sun::star::uno;
...@@ -58,7 +57,7 @@ int SAL_CALL main( int, char ** ) ...@@ -58,7 +57,7 @@ int SAL_CALL main( int, char ** )
{ {
// get the remote office component context // get the remote office component context
Reference< XComponentContext > xContext( ::cppu::bootstrap() ); Reference< XComponentContext > xContext( ::cppu::bootstrap() );
cout << "\nconnected to a running office...\n"; fprintf(stdout, "\nconnected to a running office...\n");
// create a new instance of MyService1 // create a new instance of MyService1
Reference<my_module::XSomething> xSomething = Reference<my_module::XSomething> xSomething =
...@@ -66,34 +65,28 @@ int SAL_CALL main( int, char ** ) ...@@ -66,34 +65,28 @@ int SAL_CALL main( int, char ** )
// call methodOne and print the return value on stdout // call methodOne and print the return value on stdout
OUString s = xSomething->methodOne(OUString(RTL_CONSTASCII_USTRINGPARAM("Hello World!"))); OUString s = xSomething->methodOne(OUString(RTL_CONSTASCII_USTRINGPARAM("Hello World!")));
cout << "\nCreate new instance of MyService1\n" fprintf(stdout,"\nCreate new instance of MyService1\nCall of XSomething.methOne at MyService1 = %s", OUStringToOString( s, RTL_TEXTENCODING_ASCII_US ).getStr());
<< "Call of XSomething.methOne at MyService1 = "
<< OUStringToOString( s, RTL_TEXTENCODING_ASCII_US ).getStr();
// create a new instance of MyService2 with the specified string argument // create a new instance of MyService2 with the specified string argument
xSomething = my_module::MyService2::create(xContext, OUString(RTL_CONSTASCII_USTRINGPARAM("Hello My World!"))); xSomething = my_module::MyService2::create(xContext, OUString(RTL_CONSTASCII_USTRINGPARAM("Hello My World!")));
// call methodTwo and print the return value of methodTwo // call methodTwo and print the return value of methodTwo
s = xSomething->methodTwo(); s = xSomething->methodTwo();
cout << "\n\nCreate new instance of MyService2 with argument\n" fprintf(stdout, "\n\nCreate new instance of MyService2 with argument\nCall of XSomething.methTwo at MyService2 = %s", OUStringToOString( s, RTL_TEXTENCODING_ASCII_US ).getStr());
<< "Call of XSomething.methTwo at MyService2 = "
<< OUStringToOString( s, RTL_TEXTENCODING_ASCII_US ).getStr();
cout <<"\n\nPlease press 'return' to finish the example!\n"; fprintf(stdout, "\n\nPlease press 'return' to finish the example!\n");
getchar(); getchar();
} }
catch ( ::cppu::BootstrapException & e ) catch ( ::cppu::BootstrapException & e )
{ {
cerr << "\ncaught BootstrapException: " fprintf(stderr, "\ncaught BootstrapException: %s\n",
<< OUStringToOString( e.getMessage(), RTL_TEXTENCODING_ASCII_US ).getStr() OUStringToOString( e.getMessage(), RTL_TEXTENCODING_ASCII_US ).getStr());
<< '\n';
return 1; return 1;
} }
catch ( Exception & e ) catch ( Exception & e )
{ {
cerr << "\ncaught UNO exception: " fprintf(stderr, "\ncaught UNO exception: %s\n",
<< OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
<< '\n';
return 1; return 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment