diff options
author | Matthew Newhook <matthew@zeroc.com> | 2015-03-18 12:58:16 -0230 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2015-03-18 12:58:16 -0230 |
commit | 9b7668c7c92cf9cb311fe444cdddb489cd2a219d (patch) | |
tree | 5016567c58c81f5654e9d01935e199c6bf4761d2 /cpp/demo/Manual/simple_filesystem/Client.cpp | |
parent | VS add-in & build updates: (diff) | |
download | ice-9b7668c7c92cf9cb311fe444cdddb489cd2a219d.tar.bz2 ice-9b7668c7c92cf9cb311fe444cdddb489cd2a219d.tar.xz ice-9b7668c7c92cf9cb311fe444cdddb489cd2a219d.zip |
Removed demos.
Moved demoscript to distribution.
Diffstat (limited to 'cpp/demo/Manual/simple_filesystem/Client.cpp')
-rw-r--r-- | cpp/demo/Manual/simple_filesystem/Client.cpp | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/cpp/demo/Manual/simple_filesystem/Client.cpp b/cpp/demo/Manual/simple_filesystem/Client.cpp deleted file mode 100644 index 1a225684df3..00000000000 --- a/cpp/demo/Manual/simple_filesystem/Client.cpp +++ /dev/null @@ -1,109 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 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/Ice.h> -#include <Filesystem.h> -#include <iostream> -#include <iterator> - -using namespace std; -using namespace Filesystem; - -// Recursively print the contents of directory "dir" in tree fashion. -// For files, show the contents of each file. The "depth" -// parameter is the current nesting level (for indentation). - -static void -listRecursive(const DirectoryPrx& dir, int depth = 0) -{ - string indent(++depth, '\t'); - - NodeSeq contents = dir->list(); - - for(NodeSeq::const_iterator i = contents.begin(); i != contents.end(); ++i) - { - DirectoryPrx d = DirectoryPrx::checkedCast(*i); - FilePrx file = FilePrx::uncheckedCast(*i); - cout << indent << (*i)->name() << (d ? " (directory):" : " (file):") << endl; - if(d) - { - listRecursive(d, depth); - } - else - { - Lines text = file->read(); - for(Lines::const_iterator j = text.begin(); j != text.end(); ++j) - { - cout << indent << "\t" << *j << endl; - } - } - } -} - -int -main(int argc, char* argv[]) -{ - int status = 0; - Ice::CommunicatorPtr ic; - try - { - // - // Create a communicator - // - ic = Ice::initialize(argc, argv); - - // - // Create a proxy for the root directory - // - Ice::ObjectPrx base = ic->stringToProxy("RootDir:default -h localhost -p 10000"); - - // - // Down-cast the proxy to a Directory proxy - // - DirectoryPrx rootDir = DirectoryPrx::checkedCast(base); - if(!rootDir) - { - throw "Invalid proxy"; - } - - // - // Recursively list the contents of the root directory - // - cout << "Contents of root directory:" << endl; - listRecursive(rootDir); - } - catch(const Ice::Exception& ex) - { - cerr << ex << endl; - status = 1; - } - catch(const char* msg) - { - cerr << msg << endl; - status = 1; - } - - // - // Clean up - // - if(ic) - { - try - { - ic->destroy(); - } - catch(const Ice::Exception& e) - { - cerr << e << endl; - status = 1; - } - } - - return status; -} |