From 1c9f82aa6b5661764fcb5b7ef0d44e9a39d5a72d Mon Sep 17 00:00:00 2001 From: Baptiste Wicht Date: Mon, 16 Oct 2023 19:10:55 +0200 Subject: [PATCH] More support for date --- include/writer.hpp | 6 ++++-- src/console_writer.cpp | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/writer.hpp b/include/writer.hpp index 4895eab..cf18098 100644 --- a/include/writer.hpp +++ b/include/writer.hpp @@ -89,8 +89,9 @@ struct writer { virtual writer& operator<<(double value) = 0; virtual writer& operator<<(const budget::money& m) = 0; + virtual writer& operator<<(const budget::year& y) = 0; virtual writer& operator<<(const budget::month& m) = 0; - virtual writer& operator<<(const budget::year& m) = 0; + virtual writer& operator<<(const budget::day& d) = 0; virtual writer& operator<<(const end_of_line_t& m) = 0; virtual writer& operator<<(const p_begin_t& m) = 0; @@ -143,8 +144,9 @@ struct console_writer : writer { writer& operator<<(double value) override; writer& operator<<(const budget::money& m) override; + writer& operator<<(const budget::year& y) override; writer& operator<<(const budget::month& m) override; - writer& operator<<(const budget::year& m) override; + writer& operator<<(const budget::day& d) override; writer& operator<<(const end_of_line_t& m) override; writer& operator<<(const p_begin_t& m) override; diff --git a/src/console_writer.cpp b/src/console_writer.cpp index 8913d16..812ad65 100644 --- a/src/console_writer.cpp +++ b/src/console_writer.cpp @@ -121,6 +121,12 @@ budget::writer& budget::console_writer::operator<<(const budget::money& m) { return *this; } +budget::writer& budget::console_writer::operator<<(const budget::day& d) { + os << d.value; + + return *this; +} + budget::writer& budget::console_writer::operator<<(const budget::month& m) { os << m.as_short_string();