move code responsible for screen resize to SIGWINCH handler
[ncmpcpp.git] / src / conv.h
blob4f56b4e68d0a40ea47fe76163465c112475b3675
1 /***************************************************************************
2 * Copyright (C) 2008-2009 by Andrzej Rybczak *
3 * electricityispower@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
21 #ifndef _CONV_H
22 #define _CONV_H
24 #include <string>
26 #include "window.h"
27 #include "song.h"
29 template <size_t N> inline size_t static_strlen(const char (&)[N])
31 return N-1;
34 template <size_t N> void Replace(std::string &s, const char (&from)[N], const char *to)
36 for (size_t i = 0; (i = s.find(from, i)) != std::string::npos; i += N)
37 s.replace(i, N-1, to);
40 void ToLower(std::string &);
42 int StrToInt(const std::string &);
43 long StrToLong(const std::string &);
45 std::string IntoStr(int);
47 std::string IntoStr(mpd_tag_type);
49 std::string IntoStr(NCurses::Color);
51 NCurses::Color IntoColor(const std::string &);
53 mpd_tag_type IntoTagItem(char);
55 #ifdef HAVE_TAGLIB_H
56 MPD::Song::SetFunction IntoSetFunction(mpd_tag_type);
57 #endif // HAVE_TAGLIB_H
59 std::string Shorten(const std::basic_string<my_char_t> &s, size_t max_length);
61 void EscapeUnallowedChars(std::string &);
63 void EscapeHtml(std::string &s);
65 void Trim(std::string &s);
67 #endif