diff options
author | Marc Laukien <marc@zeroc.com> | 2002-04-04 01:14:48 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-04-04 01:14:48 +0000 |
commit | 19c25b1c91eca6009439f7d8b2f9b81ea47444e0 (patch) | |
tree | ac5f2dda561f2e475c2f2528b8f78be1571d390d /cpp/src/IcePatch/Client.cpp | |
parent | more IcePatch stuff (diff) | |
download | ice-19c25b1c91eca6009439f7d8b2f9b81ea47444e0.tar.bz2 ice-19c25b1c91eca6009439f7d8b2f9b81ea47444e0.tar.xz ice-19c25b1c91eca6009439f7d8b2f9b81ea47444e0.zip |
more IcePatch stuff
Diffstat (limited to 'cpp/src/IcePatch/Client.cpp')
-rw-r--r-- | cpp/src/IcePatch/Client.cpp | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/cpp/src/IcePatch/Client.cpp b/cpp/src/IcePatch/Client.cpp index 4fb7e347a67..1adc3b93fe4 100644 --- a/cpp/src/IcePatch/Client.cpp +++ b/cpp/src/IcePatch/Client.cpp @@ -24,8 +24,7 @@ public: void usage(); virtual int run(int, char*[]); - void printNode(const NodePrx&); - void printNodes(const Nodes&, const string&); + void printNodeDescSeq(const NodeDescSeq&, const string&); }; }; @@ -96,49 +95,44 @@ IcePatch::Client::run(int argc, char* argv[]) // ObjectPrx topObj = communicator()->stringToProxy("IcePatch/.:" + endpoints); NodePrx top = NodePrx::checkedCast(topObj); - printNode(top); + NodeDescPtr nodeDesc = top->describe(); + NodeDescSeq nodeDescSeq; + nodeDescSeq.push_back(nodeDesc); + printNodeDescSeq(nodeDescSeq, ""); return EXIT_SUCCESS; } void -IcePatch::Client::printNode(const NodePrx& node) +IcePatch::Client::printNodeDescSeq(const NodeDescSeq& nodeDescSeq, const string& indent) { - string name = node->ice_getIdentity().name; - string::size_type pos = name.rfind('/'); - if (pos != string::npos) + for (unsigned int i = 0; i < nodeDescSeq.size(); ++i) { - name.erase(0, pos + 1); - } - - cout << name << endl; - - DirectoryPrx directory = DirectoryPrx::checkedCast(node); - if (directory) - { - printNodes(directory->getNodes(), ""); - } -} - -void -IcePatch::Client::printNodes(const Nodes& nodes, const string& indent) -{ - for (unsigned int i = 0; i < nodes.size(); ++i) - { - string name = nodes[i]->ice_getIdentity().name; + string name; + DirectoryDescPtr directoryDesc = DirectoryDescPtr::dynamicCast(nodeDescSeq[i]); + if (directoryDesc) + { + name = directoryDesc->directory->ice_getIdentity().name; + } + else + { + FileDescPtr fileDesc = FileDescPtr::dynamicCast(nodeDescSeq[i]); + assert(fileDesc); + name = fileDesc->file->ice_getIdentity().name; + } + string::size_type pos = name.rfind('/'); if (pos != string::npos) { name.erase(0, pos + 1); } - - cout << indent << "+-" << name << endl; - DirectoryPrx directory = DirectoryPrx::checkedCast(nodes[i]); - if (directory) + cout << "+-" << name << endl; + + if (directoryDesc) { string newIndent; - if (i < nodes.size() - 1) + if (i < nodeDescSeq.size() - 1) { newIndent = indent + "| "; } @@ -147,7 +141,7 @@ IcePatch::Client::printNodes(const Nodes& nodes, const string& indent) newIndent = indent + " "; } - printNodes(directory->getNodes(), newIndent); + printNodeDescSeq(directoryDesc->directory->getContents(), newIndent); } } } |