blob: 049badf9f2914e499b646a1ce3bc8a8d9ffef5d7 (
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
93
94
95
|
/***************************************************************************
copyright : (C) 2005-2006 by Robby Stephenson
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of version 2 of the GNU General Public License as *
* published by the Free Software Foundation; *
* *
***************************************************************************/
#ifndef TELLICO_BORROWER_H
#define TELLICO_BORROWER_H
#include "datavectors.h"
#include <ksharedptr.h>
#include <qdatetime.h>
namespace Tellico {
namespace Data {
class Loan : public KShared {
public:
Loan(Data::EntryPtr entry, const QDate& loanDate, const QDate& dueDate, const QString& note);
Loan(const Loan& other);
Data::BorrowerPtr borrower() const;
void setBorrower(Data::BorrowerPtr b) { m_borrower = b; }
const QString& uid() const { return m_uid; }
void setUID(const QString& uid) { m_uid = uid; }
Data::EntryPtr entry() const;
const QDate& loanDate() const { return m_loanDate; }
const QDate& dueDate() const { return m_dueDate; }
void setDueDate(const QDate& date) { m_dueDate = date; }
const QString& note() const { return m_note; }
void setNote(const QString& text) { m_note = text; }
bool inCalendar() const { return m_inCalendar; }
void setInCalendar(bool inCalendar) { m_inCalendar = inCalendar; }
private:
Loan& operator=(const Loan&);
QString m_uid;
Data::BorrowerPtr m_borrower;
Data::EntryPtr m_entry;
QDate m_loanDate;
QDate m_dueDate;
QString m_note;
bool m_inCalendar;
};
typedef KSharedPtr<Loan> LoanPtr;
typedef Vector<Loan> LoanVec;
typedef LoanVec::Iterator LoanVecIt;
/**
* @author Robby Stephenson
*/
class Borrower : public KShared {
public:
Borrower(const QString& name, const QString& uid);
Borrower(const Borrower& other);
Borrower& operator=(const Borrower& other);
const QString& uid() const { return m_uid; }
const QString& name() const { return m_name; }
const LoanVec& loans() const { return m_loans; }
bool isEmpty() const { return m_loans.isEmpty(); }
int count() const { return m_loans.count(); }
Data::LoanPtr loan(Data::ConstEntryPtr entry);
void addLoan(Data::LoanPtr loan);
bool removeLoan(Data::LoanPtr loan);
private:
QString m_name;
QString m_uid; // uid used by KABC
LoanVec m_loans;
};
} // end namespace
} // end namespace
#endif
|