summaryrefslogtreecommitdiff
path: root/cpp/demo/IcePack/hello/Client.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2005-09-12 02:46:32 +0000
committerMatthew Newhook <matthew@zeroc.com>2005-09-12 02:46:32 +0000
commit759f7f34281a2c3d406ce93e52e63272a9d4beba (patch)
tree491339afc3ba74316d9d9019318836ffb6621ce8 /cpp/demo/IcePack/hello/Client.cpp
parentbug fix to the icepack hello demo. (diff)
downloadice-759f7f34281a2c3d406ce93e52e63272a9d4beba.tar.bz2
ice-759f7f34281a2c3d406ce93e52e63272a9d4beba.tar.xz
ice-759f7f34281a2c3d406ce93e52e63272a9d4beba.zip
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=335
Diffstat (limited to 'cpp/demo/IcePack/hello/Client.cpp')
-rw-r--r--cpp/demo/IcePack/hello/Client.cpp63
1 files changed, 23 insertions, 40 deletions
diff --git a/cpp/demo/IcePack/hello/Client.cpp b/cpp/demo/IcePack/hello/Client.cpp
index 045ae8f8419..8ded43dc78d 100644
--- a/cpp/demo/IcePack/hello/Client.cpp
+++ b/cpp/demo/IcePack/hello/Client.cpp
@@ -7,15 +7,33 @@
//
// **********************************************************************
-#include <Ice/Ice.h>
+#include <Ice/Application.h>
#include <IcePack/Query.h>
#include <Hello.h>
using namespace std;
using namespace Demo;
+class HelloClient : public Ice::Application
+{
+public:
+
+ virtual int run(int, char*[]);
+
+private:
+
+ void menu();
+};
+
+int
+main(int argc, char* argv[])
+{
+ HelloClient app;
+ return app.main(argc, argv, "config");
+}
+
void
-menu()
+HelloClient::menu()
{
cout <<
"usage:\n"
@@ -30,11 +48,11 @@ menu()
}
int
-run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
+HelloClient::run(int argc, char* argv[])
{
- Ice::PropertiesPtr properties = communicator->getProperties();
+ Ice::PropertiesPtr properties = communicator()->getProperties();
- IcePack::QueryPrx query = IcePack::QueryPrx::checkedCast(communicator->stringToProxy("IcePack/Query"));
+ IcePack::QueryPrx query = IcePack::QueryPrx::checkedCast(communicator()->stringToProxy("IcePack/Query"));
//
// Get an object implementing the HelloFactory interface.
@@ -155,38 +173,3 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
return EXIT_SUCCESS;
}
-
-int
-main(int argc, char* argv[])
-{
- int status;
- Ice::CommunicatorPtr communicator;
-
- try
- {
- Ice::PropertiesPtr properties = Ice::createProperties();
- properties->load("config");
- communicator = Ice::initializeWithProperties(argc, argv, properties);
- status = run(argc, argv, communicator);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
-
- if(communicator)
- {
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
- }
-
- return status;
-}