Loading...
Searching...
No Matches
filters.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2003-2023, John Wiegley. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * - Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * - Neither the name of New Artisans LLC nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
42#pragma once
43
44#include "chain.h"
45#include "xact.h"
46#include "post.h"
47#include "account.h"
48#include "temps.h"
49
50namespace ledger {
51
52using namespace boost::placeholders;
53
55//
56// Posting collector
57//
58
104
106//
107// Posting filters
108//
109
110class ignore_posts : public item_handler<post_t>
111{
112public:
113 virtual void operator()(post_t&) {}
114};
115
116class collect_posts : public item_handler<post_t>
117{
118public:
119 std::vector<post_t *> posts;
120
124 virtual ~collect_posts() {
126 }
127
128 std::size_t length() const {
129 return posts.size();
130 }
131
132 std::vector<post_t *>::iterator begin() {
133 return posts.begin();
134 }
135 std::vector<post_t *>::iterator end() {
136 return posts.end();
137 }
138
139 virtual void flush() {}
140 virtual void operator()(post_t& post) {
141 posts.push_back(&post);
142 }
143
144 virtual void clear() {
145 posts.clear();
147 }
148};
149
150template <typename Iterator>
151class pass_down_posts : public item_handler<post_t>
152{
154
155public:
158 while (post_t * post = *iter) {
159 try {
161 }
162 catch (const std::exception&) {
163 add_error_context(item_context(*post, _("While handling posting")));
164 throw;
165 }
166 iter.increment();
167 }
168
170
171 TRACE_CTOR(pass_down_posts, "post_handler_ptr, posts_iterator");
172 }
173
177};
178
179class push_to_posts_list : public item_handler<post_t>
180{
182
183public:
185
192
193 virtual void operator()(post_t& post) {
194 posts.push_back(&post);
195 }
196};
197
198class truncate_xacts : public item_handler<post_t>
199{
200 int head_count;
201 int tail_count;
202 bool completed;
203
204 posts_list posts;
205 std::size_t xacts_seen;
206 xact_t * last_xact;
207
209
210public:
212 int _head_count, int _tail_count)
214 head_count(_head_count), tail_count(_tail_count),
215 completed(false), xacts_seen(0), last_xact(NULL) {
216 TRACE_CTOR(truncate_xacts, "post_handler_ptr, int, int");
217 }
221
222 virtual void flush();
223 virtual void operator()(post_t& post);
224
225 virtual void clear() {
226 completed = false;
227 posts.clear();
228 xacts_seen = 0;
229 last_xact = NULL;
230
232 }
233};
234
235class sort_posts : public item_handler<post_t>
236{
237 typedef std::deque<post_t *> posts_deque;
238
239 posts_deque posts;
240 expr_t sort_order;
241 report_t& report;
242
243 sort_posts();
244
245public:
248 : item_handler<post_t>(handler), sort_order(_sort_order), report(_report) {
249 TRACE_CTOR(sort_posts, "post_handler_ptr, const value_expr&, report_t&");
250 }
253 : item_handler<post_t>(handler), sort_order(_sort_order), report(_report) {
254 TRACE_CTOR(sort_posts, "post_handler_ptr, const string&, report_t&");
255 }
256 virtual ~sort_posts() {
258 }
259
261
262 virtual void flush() {
265 }
266
267 virtual void operator()(post_t& post) {
268 posts.push_back(&post);
269 }
270
271 virtual void clear() {
272 posts.clear();
273 sort_order.mark_uncompiled();
274
276 }
277};
278
279class sort_xacts : public item_handler<post_t>
280{
281 sort_posts sorter;
282 xact_t * last_xact;
283
284 sort_xacts();
285
286public:
289 : sorter(handler, _sort_order, _report) {
291 "post_handler_ptr, const value_expr&, report_t&");
292 }
295 : sorter(handler, _sort_order, _report) {
297 "post_handler_ptr, const string&, report_t&");
298 }
299 virtual ~sort_xacts() {
301 }
302
303 virtual void flush() {
304 sorter.flush();
306 }
307
308 virtual void operator()(post_t& post) {
309 if (last_xact && post.xact != last_xact)
310 sorter.post_accumulated_posts();
311
312 sorter(post);
313
314 last_xact = post.xact;
315 }
316
317 virtual void clear() {
318 sorter.clear();
319 last_xact = NULL;
320
322 }
323};
324
325class filter_posts : public item_handler<post_t>
326{
327 predicate_t pred;
328 scope_t& context;
329
330 filter_posts();
331
332public:
334 const predicate_t& predicate,
336 : item_handler<post_t>(handler), pred(predicate), context(_context) {
337 TRACE_CTOR(filter_posts, "post_handler_ptr, predicate_t, scope_t&");
338 }
339 virtual ~filter_posts() {
341 }
342
343 virtual void operator()(post_t& post) {
344 bind_scope_t bound_scope(context, post);
345 if (pred(bound_scope)) {
346 post.xdata().add_flags(POST_EXT_MATCHES);
347 (*handler)(post);
348 }
349 }
350
351 virtual void clear() {
352 pred.mark_uncompiled();
354 }
355};
356
357class anonymize_posts : public item_handler<post_t>
358{
359 typedef std::map<commodity_t *, std::size_t> commodity_index_map;
360 typedef variate_generator<mt19937&, uniform_int<> > int_generator_t;
361
362 temporaries_t temps;
363 commodity_index_map comms;
364 std::size_t next_comm_id;
365 xact_t * last_xact;
366 mt19937 rnd_gen;
367 uniform_int<> integer_range;
368 int_generator_t integer_gen;
369
371
372public:
374 : item_handler<post_t>(handler), next_comm_id(0), last_xact(NULL),
375 rnd_gen(static_cast<unsigned int>(static_cast<boost::uintmax_t>(std::time(0)))),
376 integer_range(1, 2000000000L),
377 integer_gen(rnd_gen, integer_range) {
378 TRACE_CTOR(anonymize_posts, "post_handler_ptr");
379 }
382 handler.reset();
383 }
384
386
387 virtual void operator()(post_t& post);
388
389 virtual void clear() {
390 temps.clear();
391 comms.clear();
392 last_xact = NULL;
393
395 }
396};
397
398class calc_posts : public item_handler<post_t>
399{
400 post_t * last_post;
401 expr_t& amount_expr;
402 bool calc_running_total;
403
404 calc_posts();
405
406public:
409 bool _calc_running_total = false)
410 : item_handler<post_t>(handler), last_post(NULL),
411 amount_expr(_amount_expr), calc_running_total(_calc_running_total) {
412 TRACE_CTOR(calc_posts, "post_handler_ptr, expr_t&, bool");
413 }
414 virtual ~calc_posts() {
416 }
417
418 virtual void operator()(post_t& post);
419
420 virtual void clear() {
421 last_post = NULL;
422 amount_expr.mark_uncompiled();
423
425 }
426};
427
428class collapse_posts : public item_handler<post_t>
429{
430
431 typedef std::map<account_t *,value_t> totals_map;
432
433 expr_t& amount_expr;
434 predicate_t display_predicate;
435 predicate_t only_predicate;
436 value_t subtotal;
437 std::size_t count;
438 xact_t * last_xact;
439 post_t * last_post;
440 temporaries_t temps;
441 account_t * global_totals_account;
442 totals_map totals;
443 bool only_collapse_if_zero;
444 unsigned short collapse_depth;
445 std::list<post_t *> component_posts;
446 report_t& report;
447
449
450public:
456 bool _only_collapse_if_zero = false,
457 unsigned short _collapse_depth = 0)
458 : item_handler<post_t>(handler), amount_expr(_amount_expr),
459 display_predicate(_display_predicate),
460 only_predicate(_only_predicate), count(0),
461 last_xact(NULL), last_post(NULL),
462 only_collapse_if_zero(_only_collapse_if_zero),
463 collapse_depth(_collapse_depth), report(_report) {
465 TRACE_CTOR(collapse_posts, "post_handler_ptr, ...");
466 }
467 virtual ~collapse_posts() {
469 handler.reset();
470 }
471
473 global_totals_account = &temps.create_account(_("<Total>"));
474 }
475
477
478 virtual void flush() {
481 }
482
484
485 virtual void operator()(post_t& post);
486
487 virtual void clear() {
488 amount_expr.mark_uncompiled();
489 display_predicate.mark_uncompiled();
490 only_predicate.mark_uncompiled();
491
492 subtotal = value_t();
493 count = 0;
494 last_xact = NULL;
495 last_post = NULL;
496
497 temps.clear();
499 totals.clear();
500 component_posts.clear();
501
503 }
504};
505
506class related_posts : public item_handler<post_t>
507{
508 posts_list posts;
509 bool also_matching;
510
512
513public:
515 const bool _also_matching = false)
517 also_matching(_also_matching) {
518 TRACE_CTOR(related_posts, "post_handler_ptr, const bool");
519 }
520 virtual ~related_posts() throw() {
522 }
523
524 virtual void flush();
525 virtual void operator()(post_t& post) {
526 post.xdata().add_flags(POST_EXT_RECEIVED);
527 posts.push_back(&post);
528 }
529
530 virtual void clear() {
531 posts.clear();
533 }
534};
535
536class display_filter_posts : public item_handler<post_t>
537{
538 // This filter requires that calc_posts be used at some point
539 // later in the chain.
540
541 report_t& report;
542 expr_t& display_amount_expr;
543 expr_t& display_total_expr;
544 bool show_rounding;
545 value_t last_display_total;
546 temporaries_t temps;
547 account_t * rounding_account;
548
550
551public:
553
556 bool _show_rounding);
557
560 handler.reset();
561 }
562
564 rounding_account = &temps.create_account(_("<Adjustment>"));
565 revalued_account = &temps.create_account(_("<Revalued>"));
566 }
567
569
570 virtual void operator()(post_t& post);
571
572 virtual void clear() {
573 display_amount_expr.mark_uncompiled();
574 display_total_expr.mark_uncompiled();
575
576 last_display_total = value_t();
577
578 temps.clear();
580
582 }
583};
584
585class changed_value_posts : public item_handler<post_t>
586{
587 // This filter requires that calc_posts be used at some point
588 // later in the chain.
589
590 report_t& report;
591 expr_t& total_expr;
592 expr_t& display_total_expr;
593 bool changed_values_only;
594 bool historical_prices_only;
595 bool for_accounts_report;
596 bool show_unrealized;
597 post_t * last_post;
598 value_t last_total;
599 value_t repriced_total;
600 temporaries_t temps;
601 account_t * revalued_account;
602 account_t * gains_equity_account;
603 account_t * losses_equity_account;
604
605 display_filter_posts * display_filter;
606
608
609public:
613 bool _show_unrealized,
615
618 temps.clear();
619 handler.reset();
620 }
621
623 revalued_account = (display_filter ? display_filter->revalued_account :
624 &temps.create_account(_("<Revalued>")));
625 }
626
627 virtual void flush();
628
631
632 virtual void operator()(post_t& post);
633
634 virtual void clear() {
635 total_expr.mark_uncompiled();
636 display_total_expr.mark_uncompiled();
637
638 last_post = NULL;
639 last_total = value_t();
640
641 temps.clear();
643
645 }
646};
647
648class subtotal_posts : public item_handler<post_t>
649{
651
652protected:
654 {
655 acct_value_t();
656
657 public:
662
664 bool _must_balance = false)
666 TRACE_CTOR(acct_value_t, "account_t *, bool, bool");
667 }
669 bool _must_balance = false)
672 TRACE_CTOR(acct_value_t, "account_t *, value_t&, bool, bool");
673 }
682 };
683
684 typedef std::map<string, acct_value_t> values_map;
685 typedef std::pair<string, acct_value_t> values_pair;
686
687protected:
692 std::deque<post_t *> component_posts;
693
694public:
702 virtual ~subtotal_posts() {
704 handler.reset();
705 }
706
707 void report_subtotal(const char * spec_fmt = NULL,
708 const optional<date_interval_t>& interval = none);
709
710 virtual void flush() {
711 if (values.size() > 0)
714 }
715 virtual void operator()(post_t& post);
716
717 virtual void clear() {
719 values.clear();
720 temps.clear();
721 component_posts.clear();
722
724 }
725};
726
728{
729 date_interval_t start_interval;
730 date_interval_t interval;
731 account_t * empty_account;
732 bool exact_periods;
733 bool generate_empty_posts;
734 bool align_intervals;
735
736 std::deque<post_t *> all_posts;
737
739
740public:
741
745 bool _exact_periods = false,
746 bool _generate_empty_posts = false,
747 bool _align_intervals = false)
748 : subtotal_posts(_handler, amount_expr), start_interval(_interval),
749 interval(start_interval), exact_periods(_exact_periods),
750 generate_empty_posts(_generate_empty_posts),
751 align_intervals(_align_intervals) {
754 "post_handler_ptr, expr_t&, date_interval_t, bool, bool");
755 }
759
761 empty_account = &temps.create_account(_("<None>"));
762 }
763
765
766#if DEBUG_ON
767 void debug_interval(const date_interval_t& ival) {
768 if (ival.start)
769 DEBUG("filters.interval", "start = " << *ival.start);
770 else
771 DEBUG("filters.interval", "no start");
772
773 if (ival.finish)
774 DEBUG("filters.interval", "finish = " << *ival.finish);
775 else
776 DEBUG("filters.interval", "no finish");
777 }
778#endif
779
780 virtual void operator()(post_t& post);
781 virtual void flush();
782
783 virtual void clear() {
784 interval = start_interval;
785
788 }
789};
790
792{
793 report_t& report;
794 post_t * last_post;
795 account_t * equity_account;
796 account_t * balance_account;
797 bool unround;
798
800
801public:
811
813 equity_account = &temps.create_account(_("Equity"));
814 balance_account = equity_account->find_account(_("Opening Balances"));
815 }
816
818
819 virtual void flush() {
822 }
823
824 virtual void clear() {
825 last_post = NULL;
828 }
829};
830
831class by_payee_posts : public item_handler<post_t>
832{
833 typedef std::map<string, shared_ptr<subtotal_posts> > payee_subtotals_map;
834 typedef std::pair<string, shared_ptr<subtotal_posts> > payee_subtotals_pair;
835
836 expr_t& amount_expr;
837 payee_subtotals_map payee_subtotals;
838
840
841 public:
843 : item_handler<post_t>(handler), amount_expr(_amount_expr) {
844 TRACE_CTOR(by_payee_posts, "post_handler_ptr, expr_t&");
845 }
849
850 virtual void flush();
851 virtual void operator()(post_t& post);
852
853 virtual void clear() {
854 amount_expr.mark_uncompiled();
855 payee_subtotals.clear();
856
858 }
859};
860
861class transfer_details : public item_handler<post_t>
862{
863 account_t * master;
864 expr_t expr;
865 scope_t& scope;
866 temporaries_t temps;
867
869
870public:
876
880 const expr_t& _expr,
882 : item_handler<post_t>(handler), master(_master),
883 expr(_expr), scope(_scope), which_element(_which_element) {
885 "post_handler_ptr, element_t, account_t *, expr_t, scope_t&");
886 }
889 handler.reset();
890 }
891
892 virtual void operator()(post_t& post);
893
894 virtual void clear() {
895 expr.mark_uncompiled();
896 temps.clear();
897
899 }
900};
901
903{
904 posts_list days_of_the_week[7];
905
907
908public:
916
917 virtual void flush();
918 virtual void operator()(post_t& post) {
919 days_of_the_week[post.date().day_of_week()].push_back(&post);
920 }
921
922 virtual void clear() {
923 for (int i = 0; i < 7; i++)
924 days_of_the_week[i].clear();
925
927 }
928};
929
930class generate_posts : public item_handler<post_t>
931{
933
934protected:
935 typedef std::pair<date_interval_t, post_t *> pending_posts_pair;
936 typedef std::list<pending_posts_pair> pending_posts_list;
937
940
941public:
946
947 virtual ~generate_posts() {
949 handler.reset();
950 }
951
953
954 virtual void add_post(const date_interval_t& period, post_t& post);
955
956 virtual void clear() {
957 pending_posts.clear();
958 temps.clear();
959
961 }
962};
963
965{
966#define BUDGET_NO_BUDGET 0x00
967#define BUDGET_BUDGETED 0x01
968#define BUDGET_UNBUDGETED 0x02
969#define BUDGET_WRAP_VALUES 0x04
970
971 uint_least8_t flags;
972 date_t terminus;
973
974 budget_posts();
975
976public:
980 : generate_posts(handler), flags(_flags), terminus(_terminus) {
981 TRACE_CTOR(budget_posts, "post_handler_ptr, date_t, uint_least8_t");
982 }
983 virtual ~budget_posts() throw() {
985 }
986
988
989 virtual void flush();
990 virtual void operator()(post_t& post);
991};
992
994{
995 predicate_t pred;
996 scope_t& context;
997 const std::size_t forecast_years;
998
999 public:
1001 const predicate_t& predicate,
1003 const std::size_t _forecast_years)
1004 : generate_posts(handler), pred(predicate), context(_context),
1005 forecast_years(_forecast_years) {
1007 "post_handler_ptr, predicate_t, scope_t&, std::size_t");
1008 }
1011 }
1012
1013 virtual void add_post(const date_interval_t& period, post_t& post);
1014 virtual void flush();
1015
1016 virtual void clear() {
1017 pred.mark_uncompiled();
1019 }
1020};
1021
1022class inject_posts : public item_handler<post_t>
1023{
1024 typedef std::set<xact_t *> tag_injected_set;
1025 typedef std::pair<account_t *, tag_injected_set> tag_mapping_pair;
1026 typedef std::pair<string, tag_mapping_pair> tags_list_pair;
1027
1028 std::list<tags_list_pair> tags_list;
1029 temporaries_t temps;
1030
1031 public:
1033 account_t * master);
1034
1035 virtual ~inject_posts() throw() {
1037 handler.reset();
1038 }
1039
1040 virtual void operator()(post_t& post);
1041};
1042
1044//
1045// Account filters
1046//
1047
1048template <typename Iterator>
1049class pass_down_accounts : public item_handler<account_t>
1050{
1052
1054 optional<scope_t&> context;
1055
1056public:
1058 Iterator& iter,
1061 : item_handler<account_t>(handler), pred(_pred), context(_context) {
1062 TRACE_CTOR(pass_down_accounts, "acct_handler_ptr, accounts_iterator, ...");
1063
1064 while (account_t * account = *iter++) {
1065 if (! pred) {
1067 } else {
1068 bind_scope_t bound_scope(*context, *account);
1069 if ((*pred)(bound_scope))
1071 }
1072 }
1073
1075 }
1076
1080
1081 virtual void clear() {
1082 if (pred)
1083 pred->mark_uncompiled();
1084
1086 }
1087};
1088
1089} // namespace ledger
#define TRACE_DTOR(cls)
Definition utils.h:144
#define TRACE_CTOR(cls, args)
Definition utils.h:143
#define DEBUG(cat, msg)
Definition utils.h:327
#define BUDGET_BUDGETED
Definition filters.h:967
#define add_error_context(msg)
Definition error.h:71
#define POST_EXT_MATCHES
Definition post.h:175
#define POST_EXT_RECEIVED
Definition post.h:168
gregorian::date date
Definition utils.h:64
string item_context(const item_t &item, const string &desc)
boost::gregorian::date date_t
Definition times.h:60
shared_ptr< item_handler< post_t > > post_handler_ptr
Definition chain.h:90
T & downcast(U &object)
Definition utils.h:468
std::list< post_t * > posts_list
Definition account.h:54
shared_ptr< item_handler< account_t > > acct_handler_ptr
Definition chain.h:91
std::list< period_xact_t * > period_xacts_list
Definition journal.h:62
account_t * find_account(const string &name, bool auto_create=true)
Encapsulate infinite-precision commoditized amounts.
Definition amount.h:96
virtual void clear()
Definition chain.h:84
virtual void operator()(T &item)
Definition chain.h:77
virtual void flush()
Definition chain.h:73
shared_ptr< item_handler > handler
Definition chain.h:55
virtual void mark_uncompiled()
Definition exprbase.h:134
virtual void print_title(const value_t &val)
void set_preflush_func(custom_flusher_t functor)
Definition filters.h:86
expr_t & group_by_expr
Definition filters.h:69
post_splitter(post_handler_ptr _post_chain, report_t &_report, expr_t &_group_by_expr)
Definition filters.h:74
virtual void clear()
Definition filters.h:98
virtual ~post_splitter()
Definition filters.h:82
value_to_posts_map posts_map
Definition filters.h:66
void set_postflush_func(custom_flusher_t functor)
Definition filters.h:89
virtual void flush()
post_handler_ptr post_chain
Definition filters.h:67
virtual void operator()(post_t &post)
report_t & report
Definition filters.h:68
function< void(const value_t &) custom_flusher_t)
Definition filters.h:63
std::map< value_t, posts_list > value_to_posts_map
Definition filters.h:62
optional< custom_flusher_t > postflush_func
Definition filters.h:71
custom_flusher_t preflush_func
Definition filters.h:70
virtual void operator()(post_t &)
Definition filters.h:113
std::vector< post_t * >::iterator begin()
Definition filters.h:132
virtual void clear()
Definition filters.h:144
virtual ~collect_posts()
Definition filters.h:124
virtual void operator()(post_t &post)
Definition filters.h:140
std::vector< post_t * > posts
Definition filters.h:119
virtual void flush()
Definition filters.h:139
std::vector< post_t * >::iterator end()
Definition filters.h:135
std::size_t length() const
Definition filters.h:128
virtual ~pass_down_posts()
Definition filters.h:174
pass_down_posts(post_handler_ptr handler, Iterator &iter)
Definition filters.h:156
push_to_posts_list(posts_list &_posts)
Definition filters.h:186
virtual void operator()(post_t &post)
Definition filters.h:193
virtual ~push_to_posts_list()
Definition filters.h:189
virtual void operator()(post_t &post)
virtual ~truncate_xacts()
Definition filters.h:218
virtual void clear()
Definition filters.h:225
virtual void flush()
truncate_xacts(post_handler_ptr handler, int _head_count, int _tail_count)
Definition filters.h:211
virtual void post_accumulated_posts()
sort_posts(post_handler_ptr handler, const string &_sort_order, report_t &_report)
Definition filters.h:251
sort_posts(post_handler_ptr handler, const expr_t &_sort_order, report_t &_report)
Definition filters.h:246
virtual void clear()
Definition filters.h:271
virtual ~sort_posts()
Definition filters.h:256
virtual void operator()(post_t &post)
Definition filters.h:267
virtual void flush()
Definition filters.h:262
sort_xacts(post_handler_ptr handler, const string &_sort_order, report_t &_report)
Definition filters.h:293
virtual void operator()(post_t &post)
Definition filters.h:308
virtual void flush()
Definition filters.h:303
virtual ~sort_xacts()
Definition filters.h:299
sort_xacts(post_handler_ptr handler, const expr_t &_sort_order, report_t &_report)
Definition filters.h:287
virtual void clear()
Definition filters.h:317
filter_posts(post_handler_ptr handler, const predicate_t &predicate, scope_t &_context)
Definition filters.h:333
virtual void clear()
Definition filters.h:351
virtual ~filter_posts()
Definition filters.h:339
virtual void operator()(post_t &post)
Definition filters.h:343
virtual ~anonymize_posts()
Definition filters.h:380
virtual void clear()
Definition filters.h:389
virtual void operator()(post_t &post)
void render_commodity(amount_t &amt)
anonymize_posts(post_handler_ptr handler)
Definition filters.h:373
calc_posts(post_handler_ptr handler, expr_t &_amount_expr, bool _calc_running_total=false)
Definition filters.h:407
virtual void operator()(post_t &post)
virtual ~calc_posts()
Definition filters.h:414
virtual void clear()
Definition filters.h:420
virtual void clear()
Definition filters.h:487
value_t & find_totals(account_t *account)
collapse_posts(post_handler_ptr handler, report_t &_report, expr_t &_amount_expr, predicate_t _display_predicate, predicate_t _only_predicate, bool _only_collapse_if_zero=false, unsigned short _collapse_depth=0)
Definition filters.h:451
virtual void flush()
Definition filters.h:478
virtual ~collapse_posts()
Definition filters.h:467
virtual void operator()(post_t &post)
related_posts(post_handler_ptr handler, const bool _also_matching=false)
Definition filters.h:514
virtual void flush()
virtual void clear()
Definition filters.h:530
virtual ~related_posts()
Definition filters.h:520
virtual void operator()(post_t &post)
Definition filters.h:525
bool output_rounding(post_t &post)
virtual void operator()(post_t &post)
display_filter_posts(post_handler_ptr handler, report_t &_report, bool _show_rounding)
virtual void operator()(post_t &post)
changed_value_posts(post_handler_ptr handler, report_t &_report, bool _for_accounts_report, bool _show_unrealized, display_filter_posts *_display_filter)
void output_intermediate_prices(post_t &post, const date_t &current)
void output_revaluation(post_t &post, const date_t &current)
std::pair< string, acct_value_t > values_pair
Definition filters.h:685
temporaries_t temps
Definition filters.h:691
std::map< string, acct_value_t > values_map
Definition filters.h:684
subtotal_posts(post_handler_ptr handler, expr_t &_amount_expr, const optional< string > &_date_format=none)
Definition filters.h:695
virtual void flush()
Definition filters.h:710
void report_subtotal(const char *spec_fmt=NULL, const optional< date_interval_t > &interval=none)
virtual void clear()
Definition filters.h:717
optional< string > date_format
Definition filters.h:690
virtual void operator()(post_t &post)
virtual ~subtotal_posts()
Definition filters.h:702
std::deque< post_t * > component_posts
Definition filters.h:692
acct_value_t(const acct_value_t &av)
Definition filters.h:674
acct_value_t(account_t *a, bool _is_virtual=false, bool _must_balance=false)
Definition filters.h:663
acct_value_t(account_t *a, value_t &v, bool _is_virtual=false, bool _must_balance=false)
Definition filters.h:668
virtual ~interval_posts()
Definition filters.h:756
void report_subtotal(const date_interval_t &ival)
virtual void operator()(post_t &post)
virtual void clear()
Definition filters.h:783
virtual void flush()
interval_posts(post_handler_ptr _handler, expr_t &amount_expr, const date_interval_t &_interval, bool _exact_periods=false, bool _generate_empty_posts=false, bool _align_intervals=false)
Definition filters.h:742
virtual void flush()
Definition filters.h:819
virtual ~posts_as_equity()
Definition filters.h:808
posts_as_equity(post_handler_ptr _handler, report_t &_report, expr_t &amount_expr, bool _unround)
Definition filters.h:802
virtual void clear()
Definition filters.h:824
virtual void clear()
Definition filters.h:853
virtual void flush()
virtual void operator()(post_t &post)
virtual ~by_payee_posts()
Definition filters.h:846
by_payee_posts(post_handler_ptr handler, expr_t &_amount_expr)
Definition filters.h:842
transfer_details(post_handler_ptr handler, element_t _which_element, account_t *_master, const expr_t &_expr, scope_t &_scope)
Definition filters.h:877
virtual ~transfer_details()
Definition filters.h:887
virtual void operator()(post_t &post)
enum ledger::transfer_details::element_t which_element
virtual void clear()
Definition filters.h:894
virtual void clear()
Definition filters.h:922
virtual ~day_of_week_posts()
Definition filters.h:913
virtual void operator()(post_t &post)
Definition filters.h:918
day_of_week_posts(post_handler_ptr handler, expr_t &amount_expr)
Definition filters.h:909
virtual void clear()
Definition filters.h:956
temporaries_t temps
Definition filters.h:939
virtual ~generate_posts()
Definition filters.h:947
generate_posts(post_handler_ptr handler)
Definition filters.h:942
std::pair< date_interval_t, post_t * > pending_posts_pair
Definition filters.h:935
pending_posts_list pending_posts
Definition filters.h:938
virtual void add_post(const date_interval_t &period, post_t &post)
void add_period_xacts(period_xacts_list &period_xacts)
std::list< pending_posts_pair > pending_posts_list
Definition filters.h:936
virtual void flush()
void report_budget_items(const date_t &date)
virtual ~budget_posts()
Definition filters.h:983
virtual void operator()(post_t &post)
budget_posts(post_handler_ptr handler, date_t _terminus, uint_least8_t _flags=0x01)
Definition filters.h:977
virtual void add_post(const date_interval_t &period, post_t &post)
virtual void clear()
Definition filters.h:1016
virtual ~forecast_posts()
Definition filters.h:1009
virtual void flush()
forecast_posts(post_handler_ptr handler, const predicate_t &predicate, scope_t &_context, const std::size_t _forecast_years)
Definition filters.h:1000
inject_posts(post_handler_ptr handler, const string &tag_list, account_t *master)
virtual ~inject_posts()
Definition filters.h:1035
virtual void operator()(post_t &post)
pass_down_accounts(acct_handler_ptr handler, Iterator &iter, const optional< predicate_t > &_pred=none, const optional< scope_t & > &_context=none)
Definition filters.h:1057
account_t & create_account(const string &name="", account_t *parent=NULL)
Dynamic type representing various numeric types.
Definition value.h:83