pass Buffer/Window to ShowTag() by reference

returning new Buffer and passing it to Window by operator<<()
was rather bad idea since it required unnecessary copying.
This commit is contained in:
Andrzej Rybczak
2009-09-15 16:36:26 +00:00
parent 40b9b547dd
commit 27687fd2b1
7 changed files with 133 additions and 89 deletions

View File

@@ -95,6 +95,14 @@ template <typename C> void String2Buffer(const std::basic_string<C> &s, basic_bu
}
}
template <typename T> void ShowTag(T &buf, const std::string &tag)
{
if (tag.empty())
buf << Config.empty_tags_color << Config.empty_tag << clEnd;
else
buf << tag;
}
inline bool Keypressed(int in, const int *key)
{
return in == key[0] || in == key[1];
@@ -113,8 +121,6 @@ std::string GetLineValue(std::string &, char = '"', char = '"', bool = 0);
void RemoveTheWord(std::string &s);
std::string ExtractTopDirectory(const std::string &);
Buffer ShowTag(const std::string &);
#ifdef _UTF8
std::basic_string<my_char_t> Scroller(const std::string &str, size_t &pos, size_t width);
#endif // _UTF8