teditor
1.8.0@@fee5e94
Terminal based editor written in C++
|
Go to the documentation of this file.
26 Account(
const std::string& n,
const std::string& d=
"",
29 const std::string&
name()
const {
return nam; }
30 const std::string&
desc()
const {
return descr; }
35 return alias.find(a) != alias.end();
40 bal += (int64_t)(val * 100.0);
46 std::string nam, descr;
55 for(
size_t i=0;i<size();++i) {
57 if(itr.name() == a)
return itr;
58 if(itr.isAnAlias(a))
return itr;
66 typedef std::pair<std::string, int64_t>
AccInfo;
74 Transaction(
const std::string& dateStr,
const std::string& n):
77 void add(
const std::string& acct,
double val) {
78 accts.push_back(
AccInfo(acct, int64_t(val * 100.0)));
82 void add(
const std::string& acct) {
84 for(
const auto& a : accts) val += a.second;
85 accts.push_back(
AccInfo(acct, -val));
89 for(
const auto& a : accts) acc.
find(a.first) += a.second;
92 const std::string&
name()
const {
return nam; }
98 for(
const auto& a : accts) val += a.second;
RepeatType
Definition: todo/objects.h:10
bool isAnAlias(const std::string &a) const
Definition: ledger/objects.h:34
const std::string & name() const
Definition: ledger/objects.h:92
@ Repeat_None
Definition: todo/objects.h:11
double balance() const
Definition: ledger/objects.h:102
TimePoint pt
Definition: todo/objects.h:38
bool hasStart
Definition: todo/objects.h:22
Transaction(const std::string &dateStr, const std::string &n)
Definition: ledger/objects.h:74
Definition: ledger/objects.h:18
std::string description
Definition: todo/objects.h:26
std::vector< CalendarItem > CalendarItems
Definition: todo/objects.h:41
std::vector< MatchItem > CalendarMatches
Definition: todo/objects.h:42
CalendarItem()
Definition: todo/objects.h:28
@ Repeat_Yearly
Definition: todo/objects.h:12
const std::string & desc() const
Definition: ledger/objects.h:30
void insertAlias(const std::string &a)
Definition: ledger/objects.h:37
void add(const std::string &acct)
Definition: ledger/objects.h:82
bool compareMatches(const MatchItem &a, const MatchItem &b)
Definition: objects.cpp:48
Definition: ledger/objects.h:72
Account(const std::string &n, const std::string &d="", const Aliases &a=Aliases())
ctor
Definition: ledger/objects.h:26
RepeatType strToRepeatType(const std::string &str)
Definition: objects.cpp:11
const std::string & name() const
Definition: ledger/objects.h:29
@ Repeat_Weekly
Definition: todo/objects.h:14
Definition: todo/objects.h:36
std::vector< AccInfo > AccountsInfo
Definition: ledger/objects.h:69
Account & operator+=(int64_t val)
Definition: ledger/objects.h:43
void addYear(TimePoint &pt)
Definition: time_utils.cpp:106
void add(const std::string &acct, double val)
Definition: ledger/objects.h:77
#define ASSERT(check, fmt,...)
Macro to assert with runtime_error exception if the check fails.
Definition: utils.h:35
Account & find(const std::string &a)
Definition: ledger/objects.h:54
TimePoint getNextOccurence(const TimePoint &pt) const
Definition: objects.cpp:38
@ Repeat_Monthly
Definition: todo/objects.h:13
void clear()
Definition: objects.cpp:31
std::chrono::system_clock::time_point TimePoint
Definition: time_utils.h:7
RepeatType repeat
Definition: todo/objects.h:25
std::vector< Transaction > Transactions
Definition: ledger/objects.h:110
Definition: ledger/objects.h:52
void addWeek(TimePoint &pt, int times)
Definition: time_utils.cpp:92
TimePoint timeFromStr(const std::string &dt)
Definition: time_utils.cpp:50
const TimePoint & date() const
Definition: ledger/objects.h:93
Account & operator+=(double val)
Definition: ledger/objects.h:39
double balance() const
Definition: ledger/objects.h:32
void updateAccounts(Accounts &acc)
Definition: ledger/objects.h:88
std::set< std::string > Aliases
Definition: ledger/objects.h:15
int64_t rawBalance() const
Definition: ledger/objects.h:31
@ Repeat_Daily
Definition: todo/objects.h:15
std::pair< std::string, int64_t > AccInfo
Definition: ledger/objects.h:66
CalendarMatches findMatchesIn(const CalendarItems &items, const TimePoint &start, const TimePoint &end)
Definition: objects.cpp:54
void addMonth(TimePoint &pt)
Definition: time_utils.cpp:96
int idx
Definition: todo/objects.h:37
bool hasEnd
Definition: todo/objects.h:24
int64_t rawBalance() const
Definition: ledger/objects.h:96
void addDay(TimePoint &pt, int times)
Definition: time_utils.cpp:88