eFinancialPlanner  V1.0 (proof of concept)
Personal Financial Planning based on Maslowian Portfolio Theory
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
global_functions.h File Reference

Go to the source code of this file.

Functions

tm get_tm (int monthNbr=0)
 global functions More...
 
int tm2Mnbr (tm tmDate)
 
string tm2DateStr (tm tmDate)
 
void dateStr2tm (string dStr, tm *target_tm)
 
int dateStr2Mnbr (string dStr)
 
string mNbr2dateStr (int monthNbr=0)
 
bool is_valid_dateStr (string theDate)
 
float flSum (std::map< int, float > *theMap, int N)
 
void thousand_separator (float x, char *s)
 
string currFormat (float x, string theCurr)
 
string curr_format (float dv, string the_curr="")
 
string date_format_tm (tm *the_tm)
 
string date_format_dateStr (string s)
 
string round2str (float x, int nbr_digits=0)
 
string months2yms (int m)
 
string add0 (int x, int n=1)
 

Variables

const float Pi = 3.141593
 global variables More...
 

Function Documentation

string add0 ( int  x,
int  n = 1 
)
inline

add0

adds a zero befor a number if it is smaller than the desired minimum length eg

x = the number to be formatted n = the minimal number of digits to make

Definition at line 311 of file global_functions.h.

string curr_format ( float  dv,
string  the_curr = "" 
)

curr_format

inspired on https://www.arachnoid.com/cpptutor/student3.html

needs: <iostream>, <iomanip>, <string>

Definition at line 190 of file global_functions.h.

string currFormat ( float  x,
string  theCurr 
)
inline

currFormat()

this function converts a given number into currency format followed by EUR

Definition at line 171 of file global_functions.h.

string date_format_dateStr ( string  s)
inline

date_format_dateStr

output the date in a standard format

Definition at line 246 of file global_functions.h.

string date_format_tm ( tm *  the_tm)
inline

date_format_tm

output the date in a standard format

Definition at line 236 of file global_functions.h.

int dateStr2Mnbr ( string  dStr)
inline

dateStr2Mnbr

converts a date string of the form YYYY-MM-DD to a month number

Definition at line 73 of file global_functions.h.

void dateStr2tm ( string  dStr,
tm *  target_tm 
)
inline

dateStr2tm

converts a date string of the form YYYY-MM-DD into a tm

Definition at line 60 of file global_functions.h.

float flSum ( std::map< int, float > *  theMap,
int  N 
)
inline

returns the sum of element of a map which elements are numbered from 1 to N

Definition at line 107 of file global_functions.h.

tm get_tm ( int  monthNbr = 0)
inline

global functions

tm_now returns the date in tm-format for a given number of months in the future the default is 0 months in the future, hence "now"

Definition at line 11 of file global_functions.h.

bool is_valid_dateStr ( string  theDate)
inline

is_valid_dateStr checks is the string is a valid ISO date of the form YYY-MM-DD

Definition at line 96 of file global_functions.h.

string mNbr2dateStr ( int  monthNbr = 0)
inline

mNbr2dateStr

converts a month number to a date-string

Definition at line 85 of file global_functions.h.

string months2yms ( int  m)
inline

parse months2yms

parses a number of months into a year-month string which is something like "1 year and 3 months"

Definition at line 282 of file global_functions.h.

string round2str ( float  x,
int  nbr_digits = 0 
)
inline

round2str

rounds a float to a certain number of digits after the decimal and returns it as a string

Definition at line 258 of file global_functions.h.

void thousand_separator ( float  x,
char *  s 
)

thousand_separator

returns a string with thousand separator added for the integer part of the amount

Definition at line 119 of file global_functions.h.

string tm2DateStr ( tm  tmDate)
inline

Definition at line 51 of file global_functions.h.

int tm2Mnbr ( tm  tmDate)
inline

tm2Mnbr converts a date into a number of months between now and the date

Definition at line 40 of file global_functions.h.

Variable Documentation

const float Pi = 3.141593

global variables

Definition at line 2 of file global_functions.h.