summaryrefslogtreecommitdiff
path: root/cpp/demo/book/simple_filesystem/Client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/demo/book/simple_filesystem/Client.cpp')
-rwxr-xr-xcpp/demo/book/simple_filesystem/Client.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/cpp/demo/book/simple_filesystem/Client.cpp b/cpp/demo/book/simple_filesystem/Client.cpp
index 870b879e0d9..00cbc8a425e 100755
--- a/cpp/demo/book/simple_filesystem/Client.cpp
+++ b/cpp/demo/book/simple_filesystem/Client.cpp
@@ -27,16 +27,16 @@ listRecursive(const DirectoryPrx & dir, int depth = 0)
NodeSeq contents = dir->list();
for (NodeSeq::const_iterator i = contents.begin(); i != contents.end(); ++i) {
- DirectoryPrx dir = DirectoryPrx::checkedCast(*i);
- FilePrx file = FilePrx::uncheckedCast(*i);
- cout << indent << (*i)->name() << (dir ? " (directory):" : " (file):") << endl;
- if (dir) {
- listRecursive(dir, depth);
- } else {
- Lines text = file->read();
- for (Lines::const_iterator j = text.begin(); j != text.end(); ++j)
- cout << indent << "\t" << *j << endl;
- }
+ DirectoryPrx dir = DirectoryPrx::checkedCast(*i);
+ FilePrx file = FilePrx::uncheckedCast(*i);
+ cout << indent << (*i)->name() << (dir ? " (directory):" : " (file):") << endl;
+ if (dir) {
+ listRecursive(dir, depth);
+ } else {
+ Lines text = file->read();
+ for (Lines::const_iterator j = text.begin(); j != text.end(); ++j)
+ cout << indent << "\t" << *j << endl;
+ }
}
}
@@ -46,38 +46,38 @@ main(int argc, char * argv[])
int status = 0;
Ice::CommunicatorPtr ic;
try {
- // Create a communicator
- //
- ic = Ice::initialize(argc, argv);
+ // Create a communicator
+ //
+ ic = Ice::initialize(argc, argv);
- // Create a proxy for the root directory
- //
- Ice::ObjectPrx base = ic->stringToProxy("RootDir:default -p 10000");
- if (!base)
- throw "Could not create proxy";
+ // Create a proxy for the root directory
+ //
+ Ice::ObjectPrx base = ic->stringToProxy("RootDir:default -p 10000");
+ if (!base)
+ throw "Could not create proxy";
- // Down-cast the proxy to a Directory proxy
- //
- DirectoryPrx rootDir = DirectoryPrx::checkedCast(base);
- if (!rootDir)
- throw "Invalid proxy";
+ // 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);
+ // 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;
+ cerr << ex << endl;
+ status = 1;
} catch (const char * msg) {
- cerr << msg << endl;
- status = 1;
+ cerr << msg << endl;
+ status = 1;
}
// Clean up
//
if (ic)
- ic->destroy();
+ ic->destroy();
return status;
}