本文整理汇总了C++中Progress::finish_section方法的典型用法代码示例。如果您正苦于以下问题:C++ Progress::finish_section方法的具体用法?C++ Progress::finish_section怎么用?C++ Progress::finish_section使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Progress
的用法示例。
在下文中一共展示了Progress::finish_section方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*
* Converts the specified registry file. The specified file is
* removed if the conversion is successful. If conversion_count
* is not NULL, the total number of Articles converted will be
* passed back.
*/
int
wsreg_convert_registry(const char *filename, int *conversion_count,
Progress_function progress_callback)
{
File_util *futil = _wsreg_fileutil_initialize();
if (initialized == WSREG_NOT_INITIALIZED) {
return (WSREG_NOT_INITIALIZED);
}
if (!futil->exists(filename)) {
/*
* Bad filename.
*/
return (WSREG_FILE_NOT_FOUND);
}
if (futil->can_read(filename) && futil->can_write(filename)) {
/*
* The registry file can be read and removed.
*/
if (wsreg_can_access_registry(O_RDWR)) {
/*
* The conversion permissions are appropriate.
* Perform the conversion.
*/
int result;
int article_count = 0;
Progress *progress =
_wsreg_progress_create(
(Progress_callback)*progress_callback);
int count = 0;
Unz_article_input_stream *ain = NULL;
Conversion *c = NULL;
/*
* The first progress section represents the
* unzipping of the data file.
*/
progress->set_section_bounds(progress, 5, 1);
ain = _wsreg_uzais_open(filename, &result);
progress->finish_section(progress);
if (result != WSREG_SUCCESS) {
/*
* The open failed. Clean up and
* return the error code.
*/
if (ain != NULL) {
ain->close(ain);
}
progress->free(progress);
return (result);
}
c = _wsreg_conversion_create(progress);
/*
* The second progress section represents
* the reading of articles.
*/
article_count = ain->get_article_count(ain);
progress->set_section_bounds(progress, 8,
article_count);
while (ain->has_more_articles(ain)) {
Article *a = ain->get_next_article(ain);
if (a != NULL) {
c->add_article(c, a);
}
progress->increment(progress);
}
progress->finish_section(progress);
ain->close(ain);
/*
* The third progress section represents
* the conversion and registration of the
* resulting components.
*/
progress->set_section_bounds(progress, 100,
article_count);
count = c->register_components(c, NULL, FALSE);
progress->finish_section(progress);
/*
* Pass the count back to the caller.
*/
if (conversion_count != NULL) {
*conversion_count = count;
}
/*
* Remove the old registry file.
*/
futil->remove(filename);
//.........这里部分代码省略.........