pass small structs and POD types to Window::operator<<() by value

This commit is contained in:
Andrzej Rybczak
2009-04-03 22:33:00 +02:00
parent 2d8b5f7abc
commit a1376e8a4e
2 changed files with 18 additions and 18 deletions

View File

@@ -659,7 +659,7 @@ void Window::Scroll(Where where)
} }
Window &Window::operator<<(const Colors &colors) Window &Window::operator<<(Colors colors)
{ {
if (colors.fg == clEnd || colors.bg == clEnd) if (colors.fg == clEnd || colors.bg == clEnd)
return *this; return *this;
@@ -668,7 +668,7 @@ Window &Window::operator<<(const Colors &colors)
return *this; return *this;
} }
Window &Window::operator<<(const Color &color) Window &Window::operator<<(Color color)
{ {
switch (color) switch (color)
{ {
@@ -692,7 +692,7 @@ Window &Window::operator<<(const Color &color)
return *this; return *this;
} }
Window &Window::operator<<(const Format &format) Window &Window::operator<<(Format format)
{ {
switch (format) switch (format)
{ {
@@ -729,7 +729,7 @@ Window &Window::operator<<(int (*f)(WINDOW *))
return *this; return *this;
} }
Window &Window::operator<<(const XY &coords) Window &Window::operator<<(XY coords)
{ {
GotoXY(coords.x, coords.y); GotoXY(coords.x, coords.y);
return *this; return *this;
@@ -741,7 +741,7 @@ Window &Window::operator<<(const char *s)
return *this; return *this;
} }
Window &Window::operator<<(const char &c) Window &Window::operator<<(char c)
{ {
wprintw(itsWindow, "%c", c); wprintw(itsWindow, "%c", c);
return *this; return *this;
@@ -753,19 +753,19 @@ Window &Window::operator<<(const wchar_t *ws)
return *this; return *this;
} }
Window &Window::operator<<(const wchar_t &wc) Window &Window::operator<<(wchar_t wc)
{ {
wprintw(itsWindow, "%lc", wc); wprintw(itsWindow, "%lc", wc);
return *this; return *this;
} }
Window &Window::operator<<(const int &i) Window &Window::operator<<(int i)
{ {
wprintw(itsWindow, "%d", i); wprintw(itsWindow, "%d", i);
return *this; return *this;
} }
Window &Window::operator<<(const double &d) Window &Window::operator<<(double d)
{ {
wprintw(itsWindow, "%f", d); wprintw(itsWindow, "%f", d);
return *this; return *this;
@@ -785,7 +785,7 @@ Window &Window::operator<<(const wstring &ws)
return *this; return *this;
} }
Window &Window::operator<<(const size_t &s) Window &Window::operator<<(size_t s)
{ {
wprintw(itsWindow, "%u", s); wprintw(itsWindow, "%u", s);
return *this; return *this;

View File

@@ -128,17 +128,17 @@ namespace NCurses
virtual void Scroll(Where); virtual void Scroll(Where);
Window &operator<<(int (*)(WINDOW *)); Window &operator<<(int (*)(WINDOW *));
Window &operator<<(const Colors &); Window &operator<<(Colors);
Window &operator<<(const Color &); Window &operator<<(Color);
Window &operator<<(const Format &); Window &operator<<(Format);
Window &operator<<(const XY &); Window &operator<<(XY);
Window &operator<<(const char *); Window &operator<<(const char *);
Window &operator<<(const char &); Window &operator<<(char);
Window &operator<<(const wchar_t *); Window &operator<<(const wchar_t *);
Window &operator<<(const wchar_t &); Window &operator<<(wchar_t);
Window &operator<<(const int &); Window &operator<<(int);
Window &operator<<(const double &); Window &operator<<(double);
Window &operator<<(const size_t &); Window &operator<<(size_t);
Window &operator<<(const std::string &); Window &operator<<(const std::string &);
Window &operator<<(const std::wstring &); Window &operator<<(const std::wstring &);