00001 /******************************************************************************* 00002 00003 Copyright (C) 2007 by Brendon Costa 00004 00005 This library is free software; you can redistribute it and/or modify 00006 it under the terms of the "LGPL Like" License defined in the file COPYING 00007 that should have been distributed along with this source. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 You should have received a copy of the "LGPL Like" License 00014 along with this library; see the file COPYING. if not, it can be 00015 obtained from the EDoc++ website: 00016 http://edoc.sourceforge.net/license.html 00017 00018 *******************************************************************************/ 00019 #include "config.h" 00020 00021 #include "EDoc/StdErrFunctionProgress.h" 00022 #include "EDoc/Function.h" 00023 00024 #include <iostream> 00025 #include <iomanip> 00026 #include <sstream> 00027 00028 namespace EDoc 00029 { 00030 //=========================================================================== 00031 void StdErrFunctionProgress::Start(size_t total_in) 00032 { 00033 current = 0; 00034 total = total_in; 00035 } 00036 //=========================================================================== 00037 void StdErrFunctionProgress::Progress(Function* data) 00038 { 00039 size_t count = ++current; 00040 std::ostringstream stream; 00041 stream << total; 00042 size_t total_str_len = stream.str().size(); 00043 00044 00045 std::cerr << std::setw(total_str_len) 00046 << std::setfill('0') 00047 << count 00048 << "/" << total << " " << data->GetKeyName() << std::endl; 00049 } 00050 //=========================================================================== 00051 }