diff options
Diffstat (limited to 'src/helpers.h')
-rw-r--r-- | src/helpers.h | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/src/helpers.h b/src/helpers.h index 945facb4..1861d471 100644 --- a/src/helpers.h +++ b/src/helpers.h @@ -331,95 +331,6 @@ template <typename Iterator> std::string getSharedDirectory(Iterator first, Iter return result; } -template <typename Iterator> -void stringToBuffer(Iterator first, Iterator last, NC::BasicBuffer<typename Iterator::value_type> &buf) -{ - for (auto it = first; it != last; ++it) - { - if (*it == '$') - { - if (++it == last) - { - buf << '$'; - break; - } - else if (isdigit(*it)) - { - buf << charToColor(*it); - } - else - { - switch (*it) - { - case 'b': - buf << NC::Format::Bold; - break; - case 'u': - buf << NC::Format::Underline; - break; - case 'a': - buf << NC::Format::AltCharset; - break; - case 'r': - buf << NC::Format::Reverse; - break; - case '/': - if (++it == last) - { - buf << '$' << '/'; - break; - } - switch (*it) - { - case 'b': - buf << NC::Format::NoBold; - break; - case 'u': - buf << NC::Format::NoUnderline; - break; - case 'a': - buf << NC::Format::NoAltCharset; - break; - case 'r': - buf << NC::Format::NoReverse; - break; - default: - buf << '$' << *--it; - break; - } - break; - default: - buf << *--it; - break; - } - } - } - else if (*it == MPD::Song::FormatEscapeCharacter) - { - // treat '$' as a normal character if song format escape char is prepended to it - if (++it == last || *it != '$') - --it; - buf << *it; - } - else - buf << *it; - } -} - -template <typename CharT> -void stringToBuffer(const std::basic_string<CharT> &s, NC::BasicBuffer<CharT> &buf) -{ - stringToBuffer(s.begin(), s.end(), buf); -} - -template <typename CharT> -NC::BasicBuffer<CharT> stringToBuffer(const std::basic_string<CharT> &s) -{ - NC::BasicBuffer<CharT> result; - stringToBuffer(s, result); - return result; -} - template <typename T> void ShowTime(T &buf, size_t length, bool short_names) { const unsigned MINUTE = 60; |