Use anonymous namespaces instead of static functions. (More idomatic)

This commit is contained in:
Christoph Heiss 2018-03-06 14:58:41 +01:00
parent ebb20044d9
commit ab685a66e7
4 changed files with 18 additions and 5 deletions

View file

@ -19,7 +19,9 @@ struct Options {
};
static Options parse_commandline(int argc, char** argv)
namespace {
Options parse_commandline(int argc, char** argv)
{
Options options;
bool show_help{};
@ -40,6 +42,8 @@ static Options parse_commandline(int argc, char** argv)
return options;
}
}
int main(int argc, char* argv[])
{

View file

@ -28,7 +28,9 @@ struct Options {
};
static Options parse_commandline(int argc, char** argv)
namespace {
Options parse_commandline(int argc, char** argv)
{
Options options;
bool show_help{};
@ -49,7 +51,6 @@ static Options parse_commandline(int argc, char** argv)
return options;
}
std::ostream& operator<<(std::ostream& ostream, const rslp::Command& command)
{
using Type = rslp::Command_Data::DataCase;
@ -91,7 +92,6 @@ std::ostream& operator<<(std::ostream& ostream, const rslp::Command& command)
return ostream;
}
class ProtobufResplyClient {
public:
ProtobufResplyClient(const std::string& host, const std::string& port) :
@ -189,6 +189,7 @@ private:
asio::ip::tcp::socket socket_;
};
}
int main(int argc, char* argv[])

View file

@ -15,6 +15,8 @@
using resply::Result;
namespace {
enum RespTypes {
SIMPLE_STRING = '+',
ERROR = '-',
@ -23,6 +25,8 @@ enum RespTypes {
ARRAY = '*'
};
}
bool RespParser::parse(std::istream& stream)
{

View file

@ -23,7 +23,9 @@ struct Options {
};
static Options parse_commandline(int argc, char** argv)
namespace {
Options parse_commandline(int argc, char** argv)
{
Options options;
bool show_help{}, show_version{};
@ -50,6 +52,8 @@ static Options parse_commandline(int argc, char** argv)
return options;
}
}
int main(int argc, char* argv[])
{