move anonymous namespaces to the top

This commit is contained in:
unK
2008-10-28 12:52:30 +01:00
parent 6b2356318f
commit 8bd081e964
2 changed files with 176 additions and 176 deletions

View File

@@ -28,6 +28,61 @@ const string keys_config_file = config_dir + "keys";
using std::ifstream;
namespace
{
void GetKeys(string line, int *key)
{
int i = line.find("=")+1;
line = line.substr(i, line.length()-i);
i = 0;
if (line[i] == ' ')
while (line[++i] == ' ') { }
line = line.substr(i, line.length()-i);
i = line.find(" ");
string one;
string two;
if (i != string::npos)
{
one = line.substr(0, i);
i++;
two = line.substr(i, line.length()-i);
}
else
one = line;
key[0] = !one.empty() && one[0] == '\'' ? one[1] : (atoi(one.c_str()) == 0 ? null_key : atoi(one.c_str()));
key[1] = !two.empty() && two[0] == '\'' ? two[1] : (atoi(two.c_str()) == 0 ? null_key : atoi(two.c_str()));
}
Color IntoColor(const string &color)
{
Color result = clDefault;
if (color == "black")
result = clBlack;
else if (color == "red")
result = clRed;
else if (color == "green")
result = clGreen;
else if (color == "yellow")
result = clYellow;
else if (color == "blue")
result = clBlue;
else if (color == "magenta")
result = clMagenta;
else if (color == "cyan")
result = clCyan;
else if (color == "white")
result = clWhite;
return result;
}
Border IntoBorder(const string &color)
{
return (Border) IntoColor(color);
}
}
void CreateConfigDir()
{
mkdir(config_dir.c_str(), 0755);
@@ -279,61 +334,6 @@ mpd_TagItems IntoTagItem(char c)
}
}
namespace
{
void GetKeys(string line, int *key)
{
int i = line.find("=")+1;
line = line.substr(i, line.length()-i);
i = 0;
if (line[i] == ' ')
while (line[++i] == ' ') { }
line = line.substr(i, line.length()-i);
i = line.find(" ");
string one;
string two;
if (i != string::npos)
{
one = line.substr(0, i);
i++;
two = line.substr(i, line.length()-i);
}
else
one = line;
key[0] = !one.empty() && one[0] == '\'' ? one[1] : (atoi(one.c_str()) == 0 ? null_key : atoi(one.c_str()));
key[1] = !two.empty() && two[0] == '\'' ? two[1] : (atoi(two.c_str()) == 0 ? null_key : atoi(two.c_str()));
}
Color IntoColor(const string &color)
{
Color result = clDefault;
if (color == "black")
result = clBlack;
else if (color == "red")
result = clRed;
else if (color == "green")
result = clGreen;
else if (color == "yellow")
result = clYellow;
else if (color == "blue")
result = clBlue;
else if (color == "magenta")
result = clMagenta;
else if (color == "cyan")
result = clCyan;
else if (color == "white")
result = clWhite;
return result;
}
Border IntoBorder(const string &color)
{
return (Border) IntoColor(color);
}
}
void ReadKeys(ncmpcpp_keys &keys)
{
ifstream f(keys_config_file.c_str());