diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2007-01-17 18:11:11 +0000 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2007-01-17 18:11:11 +0000 |
commit | e124e693704faa56ecf32ce2a243d0c3fa3a5e6e (patch) | |
tree | 071dcaa6edc458f9371289976a4537880e5bb005 /cpp/demo/Ice/async/Publisher.cpp | |
parent | Changed async demo (diff) | |
download | ice-e124e693704faa56ecf32ce2a243d0c3fa3a5e6e.tar.bz2 ice-e124e693704faa56ecf32ce2a243d0c3fa3a5e6e.tar.xz ice-e124e693704faa56ecf32ce2a243d0c3fa3a5e6e.zip |
Changed demo
Diffstat (limited to 'cpp/demo/Ice/async/Publisher.cpp')
-rw-r--r-- | cpp/demo/Ice/async/Publisher.cpp | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/cpp/demo/Ice/async/Publisher.cpp b/cpp/demo/Ice/async/Publisher.cpp deleted file mode 100644 index e73796fc45b..00000000000 --- a/cpp/demo/Ice/async/Publisher.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include <Ice/Application.h> -#include <Queue.h> - -using namespace std; -using namespace Demo; - -class QueuePublisher : public Ice::Application -{ -public: - - virtual int run(int, char*[]); - -private: - - void menu(); - string trim(const string& s); -}; - -int -main(int argc, char* argv[]) -{ - QueuePublisher app; - return app.main(argc, argv, "config.client"); -} - -int -QueuePublisher::run(int argc, char* argv[]) -{ - QueuePrx queue = QueuePrx::checkedCast(communicator()->propertyToProxy("Queue.Proxy")); - if(!queue) - { - cerr << argv[0] << ": invalid proxy" << endl; - return EXIT_FAILURE; - } - - cout << "Type a message and hit return to queue a message." << endl; - menu(); - - try - { - do - { - string s; - cout << "==> "; - getline(cin, s); - s = trim(s); - if(!s.empty()) - { - if(s[0] == '/') - { - if(s == "/quit") - { - break; - } - menu(); - } - else - { - queue->add(s); - } - } - } - while(cin.good()); - } - catch(const Ice::Exception& ex) - { - cerr << ex << endl; - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -} - -void -QueuePublisher::menu() -{ - cout << "Enter /quit to exit." << endl; -} - -string -QueuePublisher::trim(const string& s) -{ - static const string delims = "\t\r\n "; - string::size_type last = s.find_last_not_of(delims); - if(last != string::npos) - { - return s.substr(s.find_first_not_of(delims), last+1); - } - return s; -} - |