make MPD::Connection::Toggle() run playback if player is stopped
[ncmpcpp.git] / src / conv.h
blobafdded722a92eacfa43fd1679b21bc63c0c4eb8a
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 int StrToInt(const std::string &);
41 long StrToLong(const std::string &);
43 std::string IntoStr(int);
45 std::string IntoStr(mpd_tag_type);
47 std::string IntoStr(NCurses::Color);
49 NCurses::Color IntoColor(const std::string &);
51 mpd_tag_type IntoTagItem(char);
53 #ifdef HAVE_TAGLIB_H
54 MPD::Song::SetFunction IntoSetFunction(mpd_tag_type);
55 #endif // HAVE_TAGLIB_H
57 std::string Shorten(const std::basic_string<my_char_t> &s, size_t max_length);
59 void EscapeUnallowedChars(std::string &);
61 void EscapeHtml(std::string &s);
63 void Trim(std::string &s);
65 #endif