summaryrefslogtreecommitdiff
path: root/cpp/src/IcePatch/Client.cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-04-05 03:45:23 +0000
committerMarc Laukien <marc@zeroc.com>2002-04-05 03:45:23 +0000
commitc92972c738d538caca10fe31921d577c1f70ea4f (patch)
treede87b66756095437699460c062a4f8f91ab6a239 /cpp/src/IcePatch/Client.cpp
parentmore IcePatch stuff (diff)
downloadice-c92972c738d538caca10fe31921d577c1f70ea4f.tar.bz2
ice-c92972c738d538caca10fe31921d577c1f70ea4f.tar.xz
ice-c92972c738d538caca10fe31921d577c1f70ea4f.zip
more IcePatch stuff
Diffstat (limited to 'cpp/src/IcePatch/Client.cpp')
-rw-r--r--cpp/src/IcePatch/Client.cpp34
1 files changed, 29 insertions, 5 deletions
diff --git a/cpp/src/IcePatch/Client.cpp b/cpp/src/IcePatch/Client.cpp
index f4541e52a6c..ec2a12f6b2d 100644
--- a/cpp/src/IcePatch/Client.cpp
+++ b/cpp/src/IcePatch/Client.cpp
@@ -11,6 +11,7 @@
#include <Ice/Application.h>
#include <IcePatch/NodeDescFactory.h>
#include <IcePatch/Util.h>
+#include <iomanip>
using namespace std;
using namespace Ice;
@@ -116,13 +117,34 @@ IcePatch::Client::run(int argc, char* argv[])
}
catch (const NodeAccessException& ex)
{
- cerr << ex << ":\n" << ex.reason << endl;
+ cerr << appName() << ": " << ex << ":\n" << ex.reason << endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
+class MyProgressCB : public ProgressCB
+{
+public:
+
+ virtual void start(Int)
+ {
+ cout << " 0% " << flush;
+ }
+
+ virtual void update(Int total, Int pos)
+ {
+ Ice::Int percent = pos * 100 / total;
+ cout << "\b\b\b\b\b" << setw(3) << percent << "% " << flush;
+ }
+
+ virtual void finished(Int total)
+ {
+ cout << "\b\b\b\b\b" << "100% " << flush;
+ }
+};
+
void
IcePatch::Client::printNodeDescSeq(const NodeDescSeq& nodeDescSeq, const string& indent)
{
@@ -206,13 +228,15 @@ IcePatch::Client::printNodeDescSeq(const NodeDescSeq& nodeDescSeq, const string&
assert(fileDesc);
cout << indent << "+-" << pathToName(path) << "... " << flush;
+ MyProgressCB progressCB;
+
FileInfo info = getFileInfo(path);
switch (info)
{
case FileInfoNotExist:
{
cout << "getting file... " << flush;
- getFile(fileDesc->file);
+ getFile(fileDesc->file, progressCB);
break;
}
@@ -221,7 +245,7 @@ IcePatch::Client::printNodeDescSeq(const NodeDescSeq& nodeDescSeq, const string&
cout << "removing directory... " << flush;
removeRecursive(path);
cout << "getting file... " << flush;
- getFile(fileDesc->file);
+ getFile(fileDesc->file, progressCB);
break;
}
@@ -233,7 +257,7 @@ IcePatch::Client::printNodeDescSeq(const NodeDescSeq& nodeDescSeq, const string&
cout << "removing file... " << flush;
removeRecursive(path);
cout << "getting file... " << flush;
- getFile(fileDesc->file);
+ getFile(fileDesc->file, progressCB);
}
break;
}
@@ -243,7 +267,7 @@ IcePatch::Client::printNodeDescSeq(const NodeDescSeq& nodeDescSeq, const string&
cout << "removing unknown file... " << flush;
removeRecursive(path);
cout << "getting file... " << flush;
- getFile(fileDesc->file);
+ getFile(fileDesc->file, progressCB);
break;
}
}