本文整理汇总了C++中Transaction::Action方法的典型用法代码示例。如果您正苦于以下问题:C++ Transaction::Action方法的具体用法?C++ Transaction::Action怎么用?C++ Transaction::Action使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transaction
的用法示例。
在下文中一共展示了Transaction::Action方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Name
void
Category::Save(ofstream& file)
{
for (Category::Iterator i = Begin(); i != End(); i++) {
Transaction* t = i->second;
csv_fwrite(file, Name());
file << ',';
csv_fwrite(file, t->Timestamp());
file << ',';
csv_fwrite(file, t->Reason());
file << ',';
ostringstream amount;
amount.setf(ios::showpoint);
amount.setf(ios::fixed);
amount << setprecision(2) << t->Amount();
csv_fwrite(file, amount.str());
file << ',';
csv_fwrite(file, t->Action());
file << "\r\n"; // Carriage return + line feed (DOS style newline)
}
}
示例2:
void
RemoveCategoryCommand::Undo()
{
if (_document == NULL) {
return;
}
// Add the category and all of its transactions
// back into the budget
list<Transaction*>::const_iterator it;
for (it = _transactions.begin(); it != _transactions.end(); it++) {
Transaction* t = *it;
_document->AddTransaction(_category, t->Timestamp(), t->Reason(), t->Amount(), t->Action());
}
}
示例3: Transaction
void
RemoveCategoryCommand::SetDocument(Budget* document)
{
Command::SetDocument(document);
list<Transaction*>::iterator list_it;
// Delete any old transactions (there probably aren't any)
for (list_it = _transactions.begin(); list_it != _transactions.end(); list_it++) {
delete *list_it;
}
Category* c = _document->Categories()->find(_category)->second;
// Save all of the transactions that are in this category
for (Category::Iterator i = c->Begin(); i != c->End(); i++) {
Transaction* t = i->second;
Transaction* new_t = new Transaction(t->Timestamp(), t->Reason(), t->Amount(), t->Action());
_transactions.push_back(new_t);
}
}