From: <gua...@us...> - 2013-11-15 03:26:27
|
Revision: 5236 http://sourceforge.net/p/moneymanagerex/code/5236 Author: guanlisheng Date: 2013-11-15 03:26:24 +0000 (Fri, 15 Nov 2013) Log Message: ----------- reduce object copy Modified Paths: -------------- trunk/src/import_export/qif_import.cpp trunk/src/import_export/qif_import.h Modified: trunk/src/import_export/qif_import.cpp =================================================================== --- trunk/src/import_export/qif_import.cpp 2013-11-14 12:09:37 UTC (rev 5235) +++ trunk/src/import_export/qif_import.cpp 2013-11-15 03:26:24 UTC (rev 5236) @@ -299,7 +299,7 @@ Model_Payee::Data* payee = 0; //mmSplitTransactionEntries* mmSplit(new mmSplitTransactionEntries()); - Model_Splittransaction::Data_Set mmSplit; + Model_Splittransaction::Cache mmSplit; wxFileInputStream input(sFileName_); wxTextInputStream text(input, "\x09", wxConvUTF8); @@ -578,7 +578,7 @@ //pSplitEntry->subCategID_ = subCategID; pSplitEntry->SUBCATEGID = subCategID; //mmSplit->addSplit(pSplitEntry); - mmSplit.push_back(*pSplitEntry); + mmSplit.push_back(pSplitEntry); continue; } //MemoSplit @@ -736,15 +736,15 @@ for (const auto &split_entry : mmSplit) { - int c = split_entry.CATEGID; //mmSplit->entries_[i]->categID_; - int s = split_entry.SUBCATEGID; //mmSplit->entries_[i]->subCategID_; + int c = split_entry->CATEGID; //mmSplit->entries_[i]->categID_; + int s = split_entry->SUBCATEGID; //mmSplit->entries_[i]->subCategID_; Model_Category::Data* category = Model_Category::instance().get(c); Model_Subcategory::Data* sub_category = (s != -1 ? Model_Subcategory::instance().get(s) : 0); wxString cn = category->CATEGNAME; wxString sn = (sub_category ? sub_category->SUBCATEGNAME : ""); - double v = split_entry.SPLITTRANSAMOUNT; // mmSplit->entries_[i]->splitAmount_; + double v = split_entry->SPLITTRANSAMOUNT; // mmSplit->entries_[i]->splitAmount_; sMsg = (cn << ":" << sn << " " << v << "\n"); logWindow->AppendText(sMsg); } @@ -812,7 +812,7 @@ int num = 0; for (const auto& refTransaction : vQIF_trxs_) { - auto *transaction(refTransaction.first); + Model_Checking::Data* transaction = refTransaction.first; const Model_Account::Data* account = Model_Account::instance().get(transaction->ACCOUNTID); wxVector<wxVariant> data; data.push_back(wxVariant(account->ACCOUNTNAME)); @@ -835,9 +835,8 @@ data.push_back(wxVariant(transaction->STATUS)); wxString categs = Model_Category::full_name(transaction->CATEGID, transaction->SUBCATEGID); - for (const auto&split_item : refTransaction.second) categs - << Model_Category::full_name(split_item.CATEGID, split_item.SUBCATEGID) - << "|"; + for (const auto& split_item : refTransaction.second) + categs << Model_Category::full_name(split_item->CATEGID, split_item->SUBCATEGID) << "|"; data.push_back(wxVariant(categs)); data.push_back(wxVariant(wxString::Format("%.2f", Model_Checking::balance(transaction, transaction->ACCOUNTID)))); @@ -1017,10 +1016,10 @@ int transID = Model_Checking::instance().save(refTrans); //TODO:fix speed for (auto& split : refTransaction.second) { - split.TRANSID = transID; + split->TRANSID = transID; if (Model_Checking::type(refTrans) != Model_Checking::DEPOSIT) - split.SPLITTRANSAMOUNT = -split.SPLITTRANSAMOUNT; - Model_Splittransaction::instance().save(&split); //TODO:fix speed + split->SPLITTRANSAMOUNT = -split->SPLITTRANSAMOUNT; + Model_Splittransaction::instance().save(split); //TODO:fix speed } last_imported_acc_id_ = refTrans->ACCOUNTID; Modified: trunk/src/import_export/qif_import.h =================================================================== --- trunk/src/import_export/qif_import.h 2013-11-14 12:09:37 UTC (rev 5235) +++ trunk/src/import_export/qif_import.h 2013-11-15 03:26:24 UTC (rev 5236) @@ -72,7 +72,7 @@ void OnCancel(wxCommandEvent& event); void OnOk(wxCommandEvent& /*event*/); - std::vector< std::pair<Model_Checking::Data*, Model_Splittransaction::Data_Set> > vQIF_trxs_; + std::vector< std::pair<Model_Checking::Data*, Model_Splittransaction::Cache> > vQIF_trxs_; wxWindow* parent_; wxString dateFormat_; wxArrayInt accounts_id_; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |