Change operators in format:
f1 + f2 = f1 <> f2 f1 ^ f2 = f1 <> " " <> f2
This commit is contained in:
parent
bddecd7d9c
commit
5f10d47035
2 changed files with 15 additions and 2 deletions
|
@ -237,6 +237,10 @@ format operator+(format const & f1, format const & f2) {
|
|||
return format{f1, f2};
|
||||
}
|
||||
|
||||
format operator^(format const & f1, format const & f2) {
|
||||
return format{f1, format(" "), f2};
|
||||
}
|
||||
|
||||
std::ostream & pretty(std::ostream & out, unsigned w, format const & f) {
|
||||
sexpr const & b = format::best(w, 0, f.m_value);
|
||||
return layout_list(out, b);
|
||||
|
|
|
@ -177,13 +177,22 @@ public:
|
|||
friend format bracket(std::string const l, format const & x, std::string const r);
|
||||
friend format wrap(format const & f1, format const & f2);
|
||||
|
||||
// x + y = x <> y
|
||||
friend format operator+(format const & f1, format const & f2);
|
||||
format & operator+=(format const & f) {
|
||||
*this = *this + f;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// x ^ y = x <> " " <> y
|
||||
friend format operator^(format const & f1, format const & f2);
|
||||
format & operator^=(format const & f) {
|
||||
*this = *this ^ f;
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend std::ostream & operator<<(std::ostream & out, format const & f);
|
||||
// x <+> y = x <> text " " <> y
|
||||
friend format operator+(format const & f1, format const & f2);
|
||||
|
||||
friend std::ostream & layout(std::ostream & out, sexpr const & s);
|
||||
friend std::ostream & pretty(std::ostream & out, unsigned w, format const & f);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue