Enum e_param declares values with the same naming convention as private variables.
|
typedef enum { |
|
channel_, |
|
hostname_, |
|
key_, |
|
message_, |
|
flag_, |
|
flagArg_, |
|
nickname_, |
|
password_, |
|
realname_, |
|
servername_, |
|
target_, |
|
topic_, |
|
username_, |
|
} e_param; |
Usages of these variables, for example in CmdManager.cpp
|
log(CmdSpec::CmdBuilder() |
|
.Name("PASS") |
|
.Registration(0) |
|
.addParam(password_, new CmdParam()) |
|
.addChecker(check::register_::stageDone) |
|
.addChecker(check::register_::isRegistered) |
|
.addChecker(check::enoughParams) |
|
.addChecker(check::register_::pwMatch) |
|
.CmExecutor(pass) |
|
.build()); |
it's hard to distinguish password_ from a variable.
A common convention in C++98 is to use PascalCase for enumeration members, starting with the enumeration name to avoid conflicts (scoped enumeration appeared in C++11).
e_param might look like this
enum ParamType {
ParamTypeChannel,
ParamTypeHostName,
ParamTypeKey,
ParamTypeMessage,
ParamTypeFlag,
ParamTypeFlagArgument,
ParamTypeNickname,
ParamTypePassword,
ParamTypeRealName,
ParamTypeServerName,
ParamTypeTarget,
ParamTypeTopic,
ParamTypeUserName,
};
Also, in C++, an using an enum does not require the enum keyword (same thing with struct), so typedef is useless.
Enum
e_paramdeclares values with the same naming convention as private variables.irc/server/headers/builder/command-validation/CmdSpec.hpp
Lines 26 to 40 in 22ee811
Usages of these variables, for example in
CmdManager.cppirc/server/src/builder/command-validation/CmdManager.cpp
Lines 47 to 56 in 22ee811
it's hard to distinguish
password_from a variable.A common convention in C++98 is to use PascalCase for enumeration members, starting with the enumeration name to avoid conflicts (scoped enumeration appeared in C++11).
e_param might look like this
enum ParamType { ParamTypeChannel, ParamTypeHostName, ParamTypeKey, ParamTypeMessage, ParamTypeFlag, ParamTypeFlagArgument, ParamTypeNickname, ParamTypePassword, ParamTypeRealName, ParamTypeServerName, ParamTypeTarget, ParamTypeTopic, ParamTypeUserName, };Also, in C++, an using an enum does not require the
enumkeyword (same thing withstruct), sotypedefis useless.