diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-01 19:17:32 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-01 19:17:32 +0000 |
commit | e38d2351b83fa65c66ccde443777647ef5cb6cff (patch) | |
tree | 1897fc20e9f73a81c520a5b9f76f8ed042124883 /src/borrower.h | |
download | tellico-e38d2351b83fa65c66ccde443777647ef5cb6cff.tar.gz tellico-e38d2351b83fa65c66ccde443777647ef5cb6cff.zip |
Added KDE3 version of Tellico
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1097620 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/borrower.h')
-rw-r--r-- | src/borrower.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/src/borrower.h b/src/borrower.h new file mode 100644 index 0000000..049badf --- /dev/null +++ b/src/borrower.h @@ -0,0 +1,95 @@ +/*************************************************************************** + copyright : (C) 2005-2006 by Robby Stephenson + email : robby@periapsis.org + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 |