Personal Finance 1.0.0
An application that allows you to track/store/view finances, as well as calculate different financial values.
main.h File Reference
#include <iostream>
#include "Money.h"
#include "formulas.h"
#include "Expense.h"
#include "Account.h"
#include <nlohmann/json.hpp>

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 
void listAvailableAccounts (nlohmann::json &data)
 Lists the currently available accounts to choose from. More...
 
void viewAccount (Account &acc)
 Prints details of the current account. More...
 
void updateAccount (Account &acc, map< string, Account > &accounts)
 Updates the current account. More...
 
void createAccount (map< string, Account > &accounts)
 Creates a new account. More...
 
Account createAccountInit (map< string, Account > &accounts)
 Creates a new account if no accounts are found on start. More...
 
Account switchAccounts (const nlohmann::json &data)
 Allows the user to switch the account currently being used. More...
 
void tools (Account &acc, map< string, Account > &accMap)
 Provides various tools for the user to use. More...
 
void addIncome (Account &acc, map< string, Account > &accMap)
 
void viewCashFlow (Account acc)
 
void viewRecurring (Account acc)
 
void nowOrLater ()
 
void determineGrowthRate ()
 
void determineLeverageRatio (Account acc)
 
void doubleAnInvestment ()
 
void payOffCreditCard ()
 
void calculateLongTermLoan ()
 
void toJSON (nlohmann::json &j, map< string, Account > accs)
 
void fromJSON (const nlohmann::json &j, Account &acc, const string &nameOf)
 
Account fromJSON (nlohmann::json &j, const string &nameOf)
 
void generateAccountMapFromJSON (map< string, Account > &accMap, nlohmann::json data)
 
void printJSON (const nlohmann::json &j)
 
void loadAccountData (nlohmann::json &j, bool &fileFound)
 
void saveInit (nlohmann::json &j)
 
void saveData (map< string, Account > accounts)
 

Function Documentation

◆ addIncome()

void addIncome ( Account acc,
map< string, Account > &  accMap 
)

◆ calculateLongTermLoan()

void calculateLongTermLoan ( )

◆ createAccount()

void createAccount ( map< string, Account > &  accounts)

Creates a new account.

Creates a new Account object and adds it to the map of current accounts.

Parameters
accountsA map of the current accounts.
Author
Dawson Dauphinais
See also
Account::setValues(string, Money, map<string, string>, map<string, string>)

◆ createAccountInit()

Account createAccountInit ( map< string, Account > &  accounts)

Creates a new account if no accounts are found on start.

Parameters
accountsA map of the current accounts.
Returns
An Account object to be used by the main program.
Note
This is different than createAccount(map<string, Account>) in that it is used to create a new account if there are none present. It then returns an Account object to be used by the program.
Author
Dawson Dauphinais
See also
Account::setValues(string, Money, map<string, string>, map<string, string>) Account::addToIncomeList(Income i) saveData(map<string, Accounts>)

◆ determineGrowthRate()

void determineGrowthRate ( )

◆ determineLeverageRatio()

void determineLeverageRatio ( Account  acc)

◆ doubleAnInvestment()

void doubleAnInvestment ( )

◆ fromJSON() [1/2]

void fromJSON ( const nlohmann::json &  j,
Account acc,
const string &  nameOf 
)

◆ fromJSON() [2/2]

Account fromJSON ( nlohmann::json &  j,
const string &  nameOf 
)

◆ generateAccountMapFromJSON()

void generateAccountMapFromJSON ( map< string, Account > &  accMap,
nlohmann::json  data 
)

◆ listAvailableAccounts()

void listAvailableAccounts ( nlohmann::json &  data)

Lists the currently available accounts to choose from.

Parameters
dataThe JSON data to parse.
Author
Dawson Dauphinais
See also
generateAccountMapFromJSON(map<string, Account>, json &)

◆ loadAccountData()

void loadAccountData ( nlohmann::json &  j,
bool &  fileFound 
)

◆ main()

int main ( int  argc,
char **  argv 
)

◆ nowOrLater()

void nowOrLater ( )

◆ payOffCreditCard()

void payOffCreditCard ( )

◆ printJSON()

void printJSON ( const nlohmann::json &  j)

◆ saveData()

void saveData ( map< string, Account accounts)

◆ saveInit()

void saveInit ( nlohmann::json &  j)

◆ switchAccounts()

Account switchAccounts ( const nlohmann::json &  data)

Allows the user to switch the account currently being used.

Parameters
dataThe JSON data to generate the other account from.
Returns
An Account object containing data from the JSON file.
Author
Dawson Dauphinais
See also
fromJSON(json, Account, string)

◆ toJSON()

void toJSON ( nlohmann::json &  j,
map< string, Account accs 
)

◆ tools()

void tools ( Account acc,
map< string, Account > &  accMap 
)

Provides various tools for the user to use.

Parameters
accThe current Account.
accMapThe map of current accounts.
Author
Dawson Dauphinais
See also
addIncome(Account, map<string, Account>) viewRecurring(Account) viewCashFlow(Account) nowOrLater() determineGrowthRate() determineLeverageRatio(Account) doubleAnInvestment() payOffCreditCard() calculateLongTermLoan()

◆ updateAccount()

void updateAccount ( Account acc,
map< string, Account > &  accounts 
)

Updates the current account.

Parameters
accThe account to update
accountsThe map of the current accounts
Author
Dawson Dauphinais
See also
Account::getNameOfAccount() Account::setName() saveData() Account::setBalance() Account::getBalance() Account::addTransaction(Expense e)

◆ viewAccount()

void viewAccount ( Account acc)

Prints details of the current account.

Parameters
accThe account to print values from.
Author
Dawson Dauphinais
See also
Account::printAccountDetails()

◆ viewCashFlow()

void viewCashFlow ( Account  acc)

◆ viewRecurring()

void viewRecurring ( Account  acc)