Skip to content

Commit

Permalink
Increase writer interface
Browse files Browse the repository at this point in the history
  • Loading branch information
wichtounet committed Oct 16, 2023
1 parent 1c9f82a commit a411a40
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
8 changes: 8 additions & 0 deletions include/writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ struct writer {

virtual writer& operator<<(std::string_view value) = 0;
virtual writer& operator<<(double value) = 0;
virtual writer& operator<<(size_t value) = 0;
virtual writer& operator<<(long value) = 0;
virtual writer& operator<<(int value) = 0;
virtual writer& operator<<(unsigned value) = 0;

virtual writer& operator<<(const budget::money& m) = 0;
virtual writer& operator<<(const budget::year& y) = 0;
Expand Down Expand Up @@ -142,6 +146,10 @@ struct console_writer : writer {

writer& operator<<(std::string_view value) override;
writer& operator<<(double value) override;
writer& operator<<(size_t value) override;
writer& operator<<(long value) override;
writer& operator<<(int value) override;
writer& operator<<(unsigned value) override;

writer& operator<<(const budget::money& m) override;
writer& operator<<(const budget::year& y) override;
Expand Down
17 changes: 16 additions & 1 deletion src/console_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,22 @@ budget::writer& budget::console_writer::operator<<(std::string_view value) {

budget::writer& budget::console_writer::operator<<(double value) {
os << value;

return *this;
}
budget::writer& budget::console_writer::operator<<(size_t value) {
os << value;
return *this;
}
budget::writer& budget::console_writer::operator<<(long value) {
os << value;
return *this;
}
budget::writer& budget::console_writer::operator<<(int value) {
os << value;
return *this;
}
budget::writer& budget::console_writer::operator<<(unsigned value) {
os << value;
return *this;
}

Expand Down

0 comments on commit a411a40

Please sign in to comment.