std::pair conversion

Signed-off-by: Rosen Penev <rosenp@gmail.com>
main
Rosen Penev 3 years ago
parent a8061e7ee9
commit 3a8a8b29a2

@ -1437,9 +1437,10 @@ bool parseLine(ModifyCmd& modifyCmd, const std::string& line, int num) {
CmdId commandId(const std::string& cmdString) { CmdId commandId(const std::string& cmdString) {
int i = 0; int i = 0;
for (; cmdIdAndString[i].cmdId_ != invalidCmdId && cmdIdAndString[i].cmdString_ != cmdString; ++i) { while (cmdIdAndString[i].first != invalidCmdId && cmdIdAndString[i].second != cmdString) {
++i;
} }
return cmdIdAndString[i].cmdId_; return cmdIdAndString[i].first;
} }
std::string parseEscapes(const std::string& input) { std::string parseEscapes(const std::string& input) {

@ -51,11 +51,7 @@ struct ModifyCmd {
//! Container for modification commands //! Container for modification commands
using ModifyCmds = std::vector<ModifyCmd>; using ModifyCmds = std::vector<ModifyCmd>;
//! Structure to link command identifiers to strings //! Structure to link command identifiers to strings
struct CmdIdAndString { using CmdIdAndString = std::pair<CmdId, std::string>;
CmdId cmdId_; //!< Commands identifier
std::string cmdString_; //!< Command string
};
/*! /*!
@brief Implements the command line handling for the program. @brief Implements the command line handling for the program.

Loading…
Cancel
Save