put local functions into unnamed namespaces
This commit is contained in:
@@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
extern ncmpcpp_keys Key;
|
extern ncmpcpp_keys Key;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
string DisplayKeys(int *key, int size = 2)
|
string DisplayKeys(int *key, int size = 2)
|
||||||
{
|
{
|
||||||
bool backspace = 1;
|
bool backspace = 1;
|
||||||
@@ -80,6 +82,7 @@ string DisplayKeys(int *key, int size = 2)
|
|||||||
result += ": ";
|
result += ": ";
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
string GetKeybindings()
|
string GetKeybindings()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ pthread_mutex_t curl = PTHREAD_MUTEX_INITIALIZER;
|
|||||||
bool data_ready = 0;
|
bool data_ready = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
size_t write_data(char *buffer, size_t size, size_t nmemb, string data)
|
size_t write_data(char *buffer, size_t size, size_t nmemb, string data)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
@@ -57,6 +59,7 @@ void EscapeHtml(string &str)
|
|||||||
for (int i = str.find("&"); i != string::npos; i = str.find("&"))
|
for (int i = str.find("&"); i != string::npos; i = str.find("&"))
|
||||||
str.replace(i, 5, "&");
|
str.replace(i, 5, "&");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_CURL_CURL_H
|
#ifdef HAVE_CURL_CURL_H
|
||||||
void * GetArtistInfo(void *ptr)
|
void * GetArtistInfo(void *ptr)
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
void * GetArtistInfo(void *);
|
void * GetArtistInfo(void *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void EscapeHtml(string &);
|
|
||||||
void * GetLyrics(void *);
|
void * GetLyrics(void *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -197,6 +197,28 @@ void DefaultConfiguration(ncmpcpp_config &conf)
|
|||||||
conf.message_delay_time = 4;
|
conf.message_delay_time = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string GetLineValue(const string &line, char a, char b)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
int begin = -1, end = -1;
|
||||||
|
for (string::const_iterator it = line.begin(); it != line.end(); i++, it++)
|
||||||
|
{
|
||||||
|
if (*it == a || *it == b)
|
||||||
|
{
|
||||||
|
if (begin < 0)
|
||||||
|
begin = i+1;
|
||||||
|
else
|
||||||
|
end = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (begin >= 0 && end >= 0)
|
||||||
|
return line.substr(begin, end-begin);
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
void GetKeys(string line, int *key)
|
void GetKeys(string line, int *key)
|
||||||
{
|
{
|
||||||
int i = line.find("=")+1;
|
int i = line.find("=")+1;
|
||||||
@@ -220,26 +242,6 @@ void GetKeys(string line, int *key)
|
|||||||
key[1] = !two.empty() && two[0] == '\'' ? two[1] : (atoi(two.c_str()) == 0 ? null_key : atoi(two.c_str()));
|
key[1] = !two.empty() && two[0] == '\'' ? two[1] : (atoi(two.c_str()) == 0 ? null_key : atoi(two.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
string GetLineValue(const string &line, char a, char b)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
int begin = -1, end = -1;
|
|
||||||
for (string::const_iterator it = line.begin(); it != line.end(); i++, it++)
|
|
||||||
{
|
|
||||||
if (*it == a || *it == b)
|
|
||||||
{
|
|
||||||
if (begin < 0)
|
|
||||||
begin = i+1;
|
|
||||||
else
|
|
||||||
end = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (begin >= 0 && end >= 0)
|
|
||||||
return line.substr(begin, end-begin);
|
|
||||||
else
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
string IntoStr(Color color)
|
string IntoStr(Color color)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
@@ -289,6 +291,7 @@ Color IntoColor(const string &color)
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ReadKeys(ncmpcpp_keys &keys)
|
void ReadKeys(ncmpcpp_keys &keys)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -147,12 +147,10 @@ struct ncmpcpp_config
|
|||||||
|
|
||||||
void DefaultKeys(ncmpcpp_keys &);
|
void DefaultKeys(ncmpcpp_keys &);
|
||||||
void DefaultConfiguration(ncmpcpp_config &);
|
void DefaultConfiguration(ncmpcpp_config &);
|
||||||
void GetKeys(string, int *);
|
|
||||||
string GetLineValue(const string &, char = '"', char = '"');
|
|
||||||
string IntoStr(Color);
|
|
||||||
Color IntoColor(const string &);
|
|
||||||
void ReadKeys(ncmpcpp_keys &);
|
void ReadKeys(ncmpcpp_keys &);
|
||||||
void ReadConfiguration(ncmpcpp_config &);
|
void ReadConfiguration(ncmpcpp_config &);
|
||||||
|
|
||||||
|
string GetLineValue(const string &, char = '"', char = '"');
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -189,6 +189,8 @@ bool WriteTags(Song &s)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
SongSetFunction IntoSetFunction(char c)
|
SongSetFunction IntoSetFunction(char c)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
@@ -282,6 +284,7 @@ string ParseFilename(Song &s, string mask, bool preview)
|
|||||||
}
|
}
|
||||||
return result.str();
|
return result.str();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void __deal_with_filenames(SongList &v)
|
void __deal_with_filenames(SongList &v)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ string DisplayTag(const Song &, void *, const Menu<Song> *);
|
|||||||
bool GetSongTags(Song &);
|
bool GetSongTags(Song &);
|
||||||
bool WriteTags(Song &);
|
bool WriteTags(Song &);
|
||||||
|
|
||||||
string GenerateFilename(const Song &, string &);
|
|
||||||
string ParseFilename(Song &, string, bool);
|
|
||||||
void __deal_with_filenames(SongList &);
|
void __deal_with_filenames(SongList &);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user