RegFileParser_bin.zip
RegFileParser_bin
bin
RegFileParserAutoTest.exe
RegFileParserTestCmd.exe
RegFileParser_source.zip
RegFileParser_source
src
boost_libs
libboost_program_options-vc90-mt-s-1_38.lib
libboost_program_options-vc90-mt-sgd-1_38.lib
RegFileParserAutoTest
TestFiles
RegFileParserLib
RegFileParserTestCmd
RegFileParserTestCmd.idc
RegFileParser_source_no_boost.zip
RegFileParser_source_no_boost
src
RegFileParserAutoTest
TestFiles
RegFileParserLib
RegFileParserTestCmd
RegFileParserTestCmd.idc
|
#ifndef __STATUS_OBSERVER_H_INCLUDED__
#define __STATUS_OBSERVER_H_INCLUDED__
#include "IRegFileObserver.hpp"
#include <string>
namespace reg_parser
{
template<class charT,class streamT>
class CRegStatusObserver:public IRegFileObserver<charT>
{
size_t bufferStart_;
size_t bufferSize_;
size_t previousStatus_;
streamT& out_;
public:
CRegStatusObserver(size_t bufferStart,
size_t bufferSize,
streamT& out)
: bufferStart_(bufferStart)
, bufferSize_(bufferSize)
, previousStatus_(0)
, out_(out)
{}
void OnKeyFound(const charT* begin, const charT* end)
{
UpdateStatus((size_t)end);
}
void OnValueFound(const charT* nameBegin, const charT* nameEnd,
const charT* dataBegin, const charT* dataEnd)
{
UpdateStatus((size_t)dataEnd);
}
private:
void UpdateStatus(size_t end)
{
float percent = (float)((size_t)end - bufferStart_)/bufferSize_;
size_t status = (size_t)percent*100;
if( (previousStatus_) < status )
{
previousStatus_ = status;
out_ << "\r " << "\r" << status << "%";
}
}
};
}//namespace reg_parser
#endif // __STATUS_OBSERVER_H_INCLUDED__
|
By viewing downloads associated with this article you agree to the Terms of use and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
ApriorIT is a Software Research and Development company that works in advanced knowledge-intensive scopes.
Company offers integrated research&development services for the software projects in such directions as Corporate Security, Remote Control, Mobile Development, Embedded Systems, Virtualization, Drivers and others.
Official site http://www.apriorit.com