summaryrefslogtreecommitdiffstats
path: root/kbugbuster/backend/bug.h
blob: e60b0e98144b967571e038dad71517b1a6af97db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef __bug_h__
#define __bug_h__

#include "person.h"

#include <tqvaluelist.h>

#include <ksharedptr.h>

class BugImpl;

class Bug
{
public:
    typedef TQValueList<Bug> List;
    typedef TQValueList<int> BugMergeList;

    enum Severity { SeverityUndefined, Critical, Grave, Major, Crash, Normal,
                    Minor, Wishlist };
    enum tqStatus { StatusUndefined, Unconfirmed, New, Assigned, Reopened,
                  Closed };

    Bug();
    Bug( BugImpl *impl );
    Bug( const Bug &other );
    Bug &operator=( const Bug &rhs );
    ~Bug();

    static TQString severityLabel( Severity s );
    /**
      Return string representation of severity. This function is symmetric to
      stringToSeverity().
    */
    static TQString severityToString( Severity s );
    /**
      Return severity code of string representation. This function is symmetric
      to severityToString().
    */
    static Severity stringToSeverity( const TQString &, bool *ok = 0 );

    static TQValueList<Severity> severities();

    uint age() const;
    void setAge( uint days );

    TQString title() const;
    void setTitle( TQString title );
    Person submitter() const;
    TQString number() const;
    Severity severity() const;
    void setSeverity( Severity severity );
    TQString severityAsString() const;
    Person developerTODO() const;

    BugMergeList mergedWith() const;

    /**
     * tqStatus of a bug. Currently open or closed.
     * TODO: Should we add a status 'deleted' here ?
     */
    tqStatus status() const;
    void settqStatus( tqStatus newtqStatus );

    static TQString statusLabel( tqStatus s );
    /**
      Return string representation of status. This function is symmetric to
      stringTotqStatus().
    */
    static TQString statusToString( tqStatus s );
    /**
      Return status code of string representation. This function is symmetric
      to statusToString().
    */
    static tqStatus stringTotqStatus( const TQString &, bool *ok = 0 );

    bool operator==( const Bug &rhs );
    bool operator<( const Bug &rhs ) const;

    bool isNull() const { return m_impl == 0; }

    static Bug fromNumber( const TQString &bugNumber );

private:
    BugImpl *impl() const { return m_impl; }

    KSharedPtr<BugImpl> m_impl;
};

#endif

/* vim: set sw=4 ts=4 et softtabstop=4: */