Logo Search packages:      
Sourcecode: tardy version File versions  Download package

bool filenamelist_filter_progress::read_one_line ( rcstring result  )  [virtual]

The read_one_line method is used to read a file name from the list of file names.

Implements filenamelist.

Definition at line 248 of file progress.cc.

References list, position, filenamelist_filter::read_one_deeper(), show_end_status(), show_middle_status(), show_start_status(), size_position, size_total, start_time, state, and rcstring::to_c_string().

{
      switch (state)
      {
      case state_begin:
            {
                rcstring temp;
                while (read_one_deeper(temp))
                {
                  show_start_status();
                  struct stat st;
                  if (lstat(temp.to_c_string(), &st))
                        memset(&st, 0, sizeof(st));
                  long size = S_ISREG(st.st_mode) ? st.st_size : 0;
                  // round up
                  size = ((size + 511) & ~511) + 512;
                  list.push_back(item_t(temp, size));
                  size_total += size;
                }
                state = state_middle;
                time(&start_time);
            }
            // fall through...
      
      case state_middle:
            if (position < list.size())
            {
                  show_middle_status();
                  item_t item = list[position++];
                  result = item.name;
                  size_position += item.size;
                  return true;
            }
            show_end_status();
            state = state_end;
            // fall through...

      case state_end:
            break;
      }
      return false;
}


Generated by  Doxygen 1.6.0   Back to index