diff options
Diffstat (limited to 'cpp/demo/book/printer/Server.cpp')
-rw-r--r-- | cpp/demo/book/printer/Server.cpp | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/cpp/demo/book/printer/Server.cpp b/cpp/demo/book/printer/Server.cpp index c4330b12499..e5018cc82ab 100644 --- a/cpp/demo/book/printer/Server.cpp +++ b/cpp/demo/book/printer/Server.cpp @@ -13,15 +13,16 @@ using namespace std; using namespace Demo; -class PrinterI : public Printer { +class PrinterI : public Printer +{ public: - virtual void printString(const string & s, - const Ice::Current &); + + virtual void printString(const string &, const Ice::Current&); }; void PrinterI:: -printString(const string & s, const Ice::Current &) +printString(const string &s, const Ice::Current&) { cout << s << endl; } @@ -31,27 +32,34 @@ main(int argc, char* argv[]) { int status = 0; Ice::CommunicatorPtr ic; - try { + try + { ic = Ice::initialize(argc, argv); - Ice::ObjectAdapterPtr adapter - = ic->createObjectAdapterWithEndpoints( - "SimplePrinterAdapter", "default -p 10000"); + Ice::ObjectAdapterPtr adapter = + ic->createObjectAdapterWithEndpoints("SimplePrinterAdapter", "default -p 10000"); Ice::ObjectPtr object = new PrinterI; - adapter->add(object, - ic->stringToIdentity("SimplePrinter")); + adapter->add(object, ic->stringToIdentity("SimplePrinter")); adapter->activate(); ic->waitForShutdown(); - } catch (const Ice::Exception & e) { + } + catch(const Ice::Exception& e) + { cerr << e << endl; status = 1; - } catch (const char * msg) { + } + catch(const char* msg) + { cerr << msg << endl; status = 1; } - if (ic) { - try { + if(ic) + { + try + { ic->destroy(); - } catch (const Ice::Exception & e) { + } + catch(const Ice::Exception& e) + { cerr << e << endl; status = 1; } |