Brief description of class still missing. More...
#include <Group.h>
Public Types | |
| enum | Category { Valid, Ambiguous, SameAmount, SameAmountAmbiguous, Cents, CentsAmbiguous, DistinctAmount, None } |
Public Member Functions | |
| const Category & | category () const |
| QString | categoryString () const |
| Group () | |
| const QList< AccountingRecord * > & | list1 () const |
| const QList< AccountingRecord * > & | list2 () const |
| void | setCategory (const Category &c) |
| void | setList1 (const QList< AccountingRecord * > &l) |
| void | setList2 (const QList< AccountingRecord * > &l) |
| void | write (QTextStream &s, Mode mode1, Mode mode2, int index) |
| ~Group () | |
Static Public Member Functions | |
| static bool | lessThan (const Group *g1, const Group *g2) |
Brief description of class still missing.
Full description of class still missing
| enum Group::Category |
| Group::Group | ( | ) |
| Group::~Group | ( | ) |
| const Category& Group::category | ( | ) | const [inline] |
Referenced by AccountingRecord::category().
{return _category;}
| QString Group::categoryString | ( | ) | const |
References Ambiguous, Cents, CentsAmbiguous, DistinctAmount, None, SameAmount, SameAmountAmbiguous, QGpCoreTools::tr(), and Valid.
Referenced by write().
{
switch(_category) {
case None: break;
case Valid: return tr("valid"); break;
case Ambiguous: return tr("ambiguous"); break;
case SameAmount: return tr("same amount"); break;
case SameAmountAmbiguous: return tr("same amount ambiguous"); break;
case Cents: return tr("cents"); break;
case CentsAmbiguous: return tr("cents ambiguous"); break;
case DistinctAmount: return tr("distinct amount"); break;
}
return tr("none");
}
| bool Group::lessThan | ( | const Group * | g1, |
| const Group * | g2 | ||
| ) | [static] |
References AccountingRecord::amount(), and AccountingRecord::supplier().
Referenced by RecordList::match().
{
if(g1->_category<g2->_category) {
return true;
} else if(g1->_category>g2->_category) {
return false;
} else {
AccountingRecord *r1, *r2;
if(g1->_list1.isEmpty()) {
r1=g1->_list2.first();
} else {
r1=g1->_list1.first();
}
if(g2->_list1.isEmpty()) {
r2=g2->_list2.first();
} else {
r2=g2->_list1.first();
}
if(r1->amount()>r2->amount()) {
return true;
} else if(r1->amount()<r2->amount()) {
return false;
} else {
return r1->supplier()<r2->supplier();
}
}
}
| const QList<AccountingRecord *>& Group::list1 | ( | ) | const [inline] |
{return _list1;}
| const QList<AccountingRecord *>& Group::list2 | ( | ) | const [inline] |
{return _list2;}
| void Group::setCategory | ( | const Category & | c | ) | [inline] |
{_category=c;}
| void Group::setList1 | ( | const QList< AccountingRecord * > & | l | ) |
References AccountingRecord::lessThanAmount().
{
_list1=l;
qSort(_list1.begin(), _list1.end(), AccountingRecord::lessThanAmount);
setGroup(_list1);
}
| void Group::setList2 | ( | const QList< AccountingRecord * > & | l | ) |
References AccountingRecord::lessThanAmount().
{
_list2=l;
qSort(_list2.begin(), _list2.end(), AccountingRecord::lessThanAmount);
setGroup(_list2);
}
| void Group::write | ( | QTextStream & | s, |
| Mode | mode1, | ||
| Mode | mode2, | ||
| int | index | ||
| ) |
References categoryString(), and AccountingRecord::skip().
{
int i;
if(_list1.count()<_list2.count()) {
for(i=0; i<_list1.count(); i++) {
s << _list1.at(i)->contract() << "\t";
_list1.at(i)->write(s, mode1);
s << "\t";
_list2.at(i)->write(s, mode2);
s << "\t" << categoryString() << "\t" << index << "\n";
}
for(; i<_list2.count(); i++) {
s << _list2.at(i)->contract() << "\t";
AccountingRecord::skip(s, mode1);
s << "\t";
_list2.at(i)->write(s, mode2);
s << "\t" << categoryString() << "\t" << index << "\n";
}
} else {
for(i=0; i<_list2.count(); i++) {
s << _list1.at(i)->contract() << "\t";
_list1.at(i)->write(s, mode1);
s << "\t";
_list2.at(i)->write(s, mode2);
s << "\t" << categoryString() << "\t" << index << "\n";
}
for(; i<_list1.count(); i++) {
s << _list1.at(i)->contract() << "\t";
_list1.at(i)->write(s, mode1);
s << "\t";
AccountingRecord::skip(s, mode2);
s << "\t" << categoryString() << "\t" << index << "\n";
}
}
}