-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Enum e_param declares values with the same naming convention as private variables.
irc/server/headers/builder/command-validation/CmdSpec.hpp
Lines 26 to 40 in 22ee811
| 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
irc/server/src/builder/command-validation/CmdManager.cpp
Lines 47 to 56 in 22ee811
| 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels