~charlesk/indicator-transfer/fix-flint-and-clang-warnings

« back to all changes in this revision

Viewing changes to include/transfer/transfer.h

  • Committer: CI bot
  • Author(s): Charles Kerr
  • Date: 2014-07-07 22:22:21 UTC
  • mfrom: (6.1.9 per-transfer-actions)
  • Revision ID: ps-jenkins@lists.canonical.com-20140707222221-5o6gsim4jnmfy6ry
Create per-transfer actions for simpler state lookup by renderers. Previously this was done as a single action that contained a map of unique transfer ids to states. 
Approved by: Ted Gould, Ted Gould

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
namespace transfer {
35
35
 
36
36
/**
37
 
 * \brief Plain Old Data Structure representing a single Transfer
 
37
 * \brief A simple struct representing a single Transfer
38
38
 */
39
39
struct Transfer
40
40
{
42
42
                 HASHING, PROCESSING, FINISHED,
43
43
                 ERROR } State;
44
44
  State state = QUEUED;
45
 
  bool can_start() const { return state==QUEUED; }
46
 
  bool can_resume() const { return state==PAUSED || state==CANCELED || state==ERROR; }
47
 
  bool can_pause() const { return state==RUNNING || state==HASHING || state==PROCESSING; }
48
 
  bool can_cancel() const { return state!=FINISHED; }
49
 
  bool can_clear() const { return state==FINISHED; }
 
45
  bool can_start() const;
 
46
  bool can_resume() const;
 
47
  bool can_pause() const;
 
48
  bool can_cancel() const;
 
49
  bool can_clear() const;
50
50
 
51
51
  // -1 == unknown
52
52
  int seconds_left = -1;
70
70
 
71
71
  // meaningful iff state is FINISHED
72
72
  std::string local_path;
 
73
 
 
74
protected:
 
75
  static std::string next_unique_id();
73
76
};
74
77
    
75
78
} // namespace transfer