diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-11-13 13:10:30 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-11-13 13:10:30 +0100 |
commit | cba531bbad8481db47318ac8146c54252100f2ad (patch) | |
tree | 3352e929cfee28b7ebb6003eff9b32d932a9301c /src/utils.cpp | |
parent | a1415d55cd2db58ff5469cabe64efb9ff29dcec0 (diff) | |
download | etisnoop-cba531bbad8481db47318ac8146c54252100f2ad.tar.gz etisnoop-cba531bbad8481db47318ac8146c54252100f2ad.tar.bz2 etisnoop-cba531bbad8481db47318ac8146c54252100f2ad.zip |
Add first filter to display only some FIGs
TODO: many FIGs print without using printbuf, fir which the filter doesn't
work yet.
Diffstat (limited to 'src/utils.cpp')
-rw-r--r-- | src/utils.cpp | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/utils.cpp b/src/utils.cpp index 71df396..7ea00bb 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -44,14 +44,29 @@ int get_verbosity() return verbosity; } +display_settings_t display_settings_t::operator+(int indent_offset) const +{ + return display_settings_t(print, indent+indent_offset); +} + +void printbuf(std::string header, + int indent, + uint8_t* buffer, + size_t size, + std::string desc) +{ + display_settings_t disp(true, indent); + printbuf(header, disp, buffer, size, desc); +} + void printbuf(string header, - int indent_level, + const display_settings_t &disp, uint8_t* buffer, size_t size, string desc) { if (verbosity > 0) { - for (int i = 0; i < indent_level; i++) { + for (int i = 0; i < disp.indent; i++) { printf("\t"); } @@ -75,18 +90,25 @@ void printbuf(string header, } } -void printinfo(string header, - int indent_level, +void printinfo(const string &header, + const display_settings_t &disp, int min_verb) { if (verbosity >= min_verb) { - for (int i = 0; i < indent_level; i++) { + for (int i = 0; i < disp.indent; i++) { printf("\t"); } printf("%s\n", header.c_str()); } } +void printinfo(const std::string &header, + int min_verb) +{ + const display_settings_t disp(true, 0); + printinfo(header, min_verb); +} + int sprintfMJD(char *dst, int mjd) { // EN 62106 Annex G // These formulas are applicable between the inclusive dates: 1st March 1900 to 28th February 2100 |