From: <ste...@us...> - 2013-12-27 07:44:15
|
Revision: 5727 http://sourceforge.net/p/moneymanagerex/code/5727 Author: stef145g Date: 2013-12-27 07:44:11 +0000 (Fri, 27 Dec 2013) Log Message: ----------- more XXX CHOICES for enum values Modified Paths: -------------- trunk/src/model/Model_Account.cpp trunk/src/model/Model_Account.h trunk/src/model/Model_Billsdeposits.cpp trunk/src/model/Model_Billsdeposits.h trunk/src/model/Model_Budget.cpp trunk/src/model/Model_Budget.h Modified: trunk/src/model/Model_Account.cpp =================================================================== --- trunk/src/model/Model_Account.cpp 2013-12-25 07:41:21 UTC (rev 5726) +++ trunk/src/model/Model_Account.cpp 2013-12-27 07:44:11 UTC (rev 5727) @@ -19,6 +19,19 @@ #include "Model_Account.h" #include "Model_Stock.h" +const std::vector<std::pair<Model_Account::STATUS, wxString> > Model_Account::STATUS_CHOICES = +{ + std::make_pair(Model_Account::OPEN, wxTRANSLATE("Open")), + std::make_pair(Model_Account::CLOSED, wxTRANSLATE("Closed")) +}; + +const std::vector<std::pair<Model_Account::TYPE, wxString> > Model_Account::TYPE_CHOICES = +{ + std::make_pair(Model_Account::CHECKING, wxTRANSLATE("Checking")), + std::make_pair(Model_Account::TERM, wxTRANSLATE("Term")), + std::make_pair(Model_Account::INVESTMENT, wxTRANSLATE("Investment")) +}; + Model_Account::Model_Account() : Model<DB_Table_ACCOUNTLIST_V1>() { @@ -72,19 +85,14 @@ wxArrayString Model_Account::all_status() { wxArrayString status; - status.Add(wxTRANSLATE("Open")); - status.Add(wxTRANSLATE("Closed")); - + for (const auto& item : STATUS_CHOICES) status.Add(item.second); return status; } wxArrayString Model_Account::all_type() { wxArrayString type; - type.Add(wxTRANSLATE("Checking")); - type.Add(wxTRANSLATE("Term")); - type.Add(wxTRANSLATE("Investment")); - + for (const auto& item : TYPE_CHOICES) type.Add(item.second); return type; } Modified: trunk/src/model/Model_Account.h =================================================================== --- trunk/src/model/Model_Account.h 2013-12-25 07:41:21 UTC (rev 5726) +++ trunk/src/model/Model_Account.h 2013-12-27 07:44:11 UTC (rev 5727) @@ -32,8 +32,11 @@ using Model<DB_Table_ACCOUNTLIST_V1>::get; enum STATUS { OPEN = 0, CLOSED }; - enum TYPE { CHECKING = 0, TERM, INVESTMENT }; + enum TYPE { CHECKING = 0, TERM, INVESTMENT }; + static const std::vector<std::pair<STATUS, wxString> > STATUS_CHOICES; + static const std::vector<std::pair<TYPE, wxString> > TYPE_CHOICES; + public: Model_Account(); ~Model_Account(); Modified: trunk/src/model/Model_Billsdeposits.cpp =================================================================== --- trunk/src/model/Model_Billsdeposits.cpp 2013-12-25 07:41:21 UTC (rev 5726) +++ trunk/src/model/Model_Billsdeposits.cpp 2013-12-27 07:44:11 UTC (rev 5727) @@ -19,6 +19,22 @@ #include "Model_Billsdeposits.h" #include "mmOption.h" +const std::vector<std::pair<Model_Billsdeposits::TYPE, wxString> > Model_Billsdeposits::TYPE_CHOICES = +{ + std::make_pair(Model_Billsdeposits::WITHDRAWAL, wxTRANSLATE("Withdrawal")) + , std::make_pair(Model_Billsdeposits::DEPOSIT, wxTRANSLATE("Deposit")) + , std::make_pair(Model_Billsdeposits::TRANSFER, wxTRANSLATE("Transfer")) +}; + +const std::vector<std::pair<Model_Billsdeposits::STATUS_ENUM, wxString> > Model_Billsdeposits::STATUS_ENUM_CHOICES = +{ + std::make_pair(Model_Billsdeposits::NONE, wxTRANSLATE("None")) + , std::make_pair(Model_Billsdeposits::RECONCILED, wxTRANSLATE("Reconciled")) + , std::make_pair(Model_Billsdeposits::VOID_, wxTRANSLATE("Void")) + , std::make_pair(Model_Billsdeposits::FOLLOWUP, wxTRANSLATE("Follow up")) + , std::make_pair(Model_Billsdeposits::DUPLICATE_, wxTRANSLATE("Duplicate")) +}; + Model_Billsdeposits::Model_Billsdeposits() : Model<DB_Table_BILLSDEPOSITS_V1>() { @@ -31,24 +47,14 @@ wxArrayString Model_Billsdeposits::all_type() { wxArrayString types; - // keep the sequence with TYPE - types.Add(wxTRANSLATE("Withdrawal")); - types.Add(wxTRANSLATE("Deposit")); - types.Add(wxTRANSLATE("Transfer")); - + for (const auto& item : TYPE_CHOICES) types.Add(item.second); return types; } wxArrayString Model_Billsdeposits::all_status() { wxArrayString status; - // keep the sequence with STATUS - status.Add(wxTRANSLATE("None")); - status.Add(wxTRANSLATE("Reconciled")); - status.Add(wxTRANSLATE("Void")); - status.Add(wxTRANSLATE("Follow up")); - status.Add(wxTRANSLATE("Duplicate")); - + for (const auto& item : STATUS_ENUM_CHOICES) status.Add(item.second); return status; } Modified: trunk/src/model/Model_Billsdeposits.h =================================================================== --- trunk/src/model/Model_Billsdeposits.h 2013-12-25 07:41:21 UTC (rev 5726) +++ trunk/src/model/Model_Billsdeposits.h 2013-12-27 07:44:11 UTC (rev 5727) @@ -29,6 +29,7 @@ { public: using Model<DB_Table_BILLSDEPOSITS_V1>::remove; + public: enum TYPE { WITHDRAWAL = 0, DEPOSIT, TRANSFER }; enum STATUS_ENUM { NONE = 0, RECONCILED, VOID_, FOLLOWUP, DUPLICATE_ }; @@ -53,6 +54,9 @@ REPEAT_MONTHLY_LAST_BUSINESS_DAY }; + static const std::vector<std::pair<TYPE, wxString> > TYPE_CHOICES; + static const std::vector<std::pair<STATUS_ENUM, wxString> > STATUS_ENUM_CHOICES; + public: Model_Billsdeposits(); ~Model_Billsdeposits(); Modified: trunk/src/model/Model_Budget.cpp =================================================================== --- trunk/src/model/Model_Budget.cpp 2013-12-25 07:41:21 UTC (rev 5726) +++ trunk/src/model/Model_Budget.cpp 2013-12-27 07:44:11 UTC (rev 5727) @@ -49,19 +49,23 @@ return Singleton<Model_Budget>::instance(); } +const std::vector<std::pair<Model_Budget::PERIOD_ENUM, wxString> > Model_Budget::PERIOD_ENUM_CHOICES = +{ + std::make_pair(Model_Budget::NONE, wxTRANSLATE("None")) + , std::make_pair(Model_Budget::WEEKLY, wxTRANSLATE("Weekly")) + , std::make_pair(Model_Budget::BIWEEKLY, wxTRANSLATE("Bi-Weekly")) + , std::make_pair(Model_Budget::MONTHLY, wxTRANSLATE("Monthly")) + , std::make_pair(Model_Budget::BIMONTHLY, wxTRANSLATE("Bi-Monthly")) + , std::make_pair(Model_Budget::QUARTERLY, wxTRANSLATE("Quarterly")) + , std::make_pair(Model_Budget::HALFYEARLY, wxTRANSLATE("Half-Yearly")) + , std::make_pair(Model_Budget::YEARLY, wxTRANSLATE("Yearly")) + , std::make_pair(Model_Budget::DAILY, wxTRANSLATE("Daily")) +}; + wxArrayString Model_Budget::all_period() { wxArrayString period; - // keep the sequence with PERIOD_ENUM - period.Add(wxTRANSLATE("None")); - period.Add(wxTRANSLATE("Weekly")); - period.Add(wxTRANSLATE("Bi-Weekly")); - period.Add(wxTRANSLATE("Monthly")); - period.Add(wxTRANSLATE("Bi-Monthly")); - period.Add(wxTRANSLATE("Quarterly")); - period.Add(wxTRANSLATE("Half-Yearly")); - period.Add(wxTRANSLATE("Yearly")); - period.Add(wxTRANSLATE("Daily")); + for (const auto& item : PERIOD_ENUM_CHOICES) period.Add(item.second); return period; } Modified: trunk/src/model/Model_Budget.h =================================================================== --- trunk/src/model/Model_Budget.h 2013-12-25 07:41:21 UTC (rev 5726) +++ trunk/src/model/Model_Budget.h 2013-12-27 07:44:11 UTC (rev 5727) @@ -40,6 +40,7 @@ public: enum PERIOD_ENUM { NONE = 0, WEEKLY, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, HALFYEARLY, YEARLY, DAILY }; + static const std::vector<std::pair<PERIOD_ENUM, wxString> > PERIOD_ENUM_CHOICES; static wxArrayString all_period(); static PERIOD_ENUM period(const Data* r); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |