当前位置: 首页>>代码示例>>C++>>正文


C++ Progress::done方法代码示例

本文整理汇总了C++中Progress::done方法的典型用法代码示例。如果您正苦于以下问题:C++ Progress::done方法的具体用法?C++ Progress::done怎么用?C++ Progress::done使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Progress的用法示例。


在下文中一共展示了Progress::done方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main (int argc, char** argv)
{
  try
  {
    // We don't want any signals causing the program to quit in mid output, as
    // this would lead to odd colors persisting in the terminal.
    signal (SIGHUP,    SIG_IGN);
    signal (SIGINT,    SIG_IGN);
    signal (SIGKILL,   SIG_IGN);
    signal (SIGPIPE,   SIG_IGN);
    signal (SIGTERM,   SIG_IGN);
    signal (SIGUSR1,   SIG_IGN);
    signal (SIGUSR2,   SIG_IGN);

    long        arg_current    = 0;
#ifdef WAITING_FOR_VITAPI
    std::string arg_done       = "";
#endif
    bool        arg_elapsed    = false;
    bool        arg_estimate   = false;
    std::string arg_label;
    long        arg_max        = 0;
    long        arg_min        = 0;
    bool        arg_percentage = false;
#ifdef WAITING_FOR_VITAPI
    std::string arg_remaining  = "";
#endif
    bool        arg_remove     = false;
    time_t      arg_start      = 0;
    int         arg_width      = 80;
    std::string arg_style      = "";

    // Dynamically determine terminal width.
    unsigned short buff[4];
    if (ioctl (fileno(stdout), TIOCGWINSZ, &buff) != -1)
      arg_width = buff[1];

    static struct option longopts[] = {
      { "current",    required_argument, NULL, 'c' },
#ifdef WAITING_FOR_VITAPI
      { "done",       required_argument, NULL, 'd' },
#endif
      { "elapsed",    no_argument,       NULL, 'e' },
      { "estimate",   no_argument,       NULL, 't' },
      { "label",      required_argument, NULL, 'l' },
      { "max",        required_argument, NULL, 'x' },
      { "min",        required_argument, NULL, 'm' },
      { "now",        no_argument,       NULL, 'n' },
      { "percentage", no_argument,       NULL, 'p' },
#ifdef WAITING_FOR_VITAPI
      { "remaining",  required_argument, NULL, 'a' },
#endif
      { "remove",     no_argument,       NULL, 'r' },
      { "start",      required_argument, NULL, 's' },
      { "version",    no_argument,       NULL, 'v' },
      { "width",      required_argument, NULL, 'w' },
      { "style",      required_argument, NULL, 'y' },
      { "help",       no_argument,       NULL, 'h' },
      { NULL,         0,                 NULL, 0   }
    };

    int ch;
#ifdef WAITING_FOR_VITAPI
    while ((ch = getopt_long (argc, argv, "c:d:etl:x:m:npa:rs:vw:h", longopts, NULL)) != -1)
#else
    while ((ch = getopt_long (argc, argv, "c:etl:x:m:nprs:vw:h", longopts, NULL)) != -1)
#endif
    {
      switch (ch)
      {
      case 'c': arg_current    = atol (optarg);        break;
#ifdef WAITING_FOR_VITAPI
      case 'd': arg_done       = optarg;               break;
#endif
      case 'e': arg_elapsed    = true;                 break;
      case 't': arg_estimate   = true;                 break;
      case 'l': arg_label      = optarg;               break;
      case 'x': arg_max        = atol (optarg);        break;
      case 'm': arg_min        = atol (optarg);        break;
      case 'n': std::cout << time (NULL) << std::endl; exit (0);
      case 'p': arg_percentage = true;                 break;
#ifdef WAITING_FOR_VITAPI
      case 'a': arg_remaining  = optarg;               break;
#endif
      case 'r': arg_remove     = true;                 break;
      case 's': arg_start      = atoi (optarg);        break;
      case 'v': showVersion ();                        break;
      case 'w': arg_width      = atoi (optarg);        break;
      case 'y': arg_style      = optarg;               break;
      case 'h': showUsage ();                          break;

      default:
        std::cout << "<default>" << std::endl;
        break;
      }
    }

    argc -= optind;
    argv += optind;

//.........这里部分代码省略.........
开发者ID:GothenburgBitFactory,项目名称:vramsteg,代码行数:101,代码来源:vramsteg.cpp


注:本文中的Progress::done方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。