std::string Settings::addEnabled(const std::string &str) { // Enable parameters may be comma separated... if (str.find(",") != std::string::npos) { std::string::size_type prevPos = 0; std::string::size_type pos = 0; while ((pos = str.find(",", pos)) != std::string::npos) { if (pos == prevPos) return std::string("cppcheck: --enable parameter is empty"); const std::string errmsg(addEnabled(str.substr(prevPos, pos - prevPos))); if (!errmsg.empty()) return errmsg; ++pos; prevPos = pos; } if (prevPos >= str.length()) return std::string("cppcheck: --enable parameter is empty"); return addEnabled(str.substr(prevPos)); } bool handled = false; static std::set<std::string> id; if (id.empty()) { id.insert("warning"); id.insert("style"); id.insert("performance"); id.insert("portability"); id.insert("information"); id.insert("missingInclude"); id.insert("unusedFunction"); #ifndef NDEBUG id.insert("internal"); #endif } if (str == "all") { std::set<std::string>::const_iterator it; for (it = id.begin(); it != id.end(); ++it) { if (*it == "internal") continue; _enabled.insert(*it); } } else if (id.find(str) != id.end()) { _enabled.insert(str); if (str == "information") { _enabled.insert("missingInclude"); } } else if (!handled) { if (str.empty()) return std::string("cppcheck: --enable parameter is empty"); else return std::string("cppcheck: there is no --enable parameter with the name '" + str + "'"); } return std::string(""); }
std::string Settings::addEnabled(const std::string &str) { // Enable parameters may be comma separated... if (str.find(",") != std::string::npos) { std::string::size_type prevPos = 0; std::string::size_type pos = 0; while ((pos = str.find(",", pos)) != std::string::npos) { if (pos == prevPos) return std::string("cppcheck: --enable parameter is empty"); const std::string errmsg(addEnabled(str.substr(prevPos, pos - prevPos))); if (!errmsg.empty()) return errmsg; ++pos; prevPos = pos; } if (prevPos >= str.length()) return std::string("cppcheck: --enable parameter is empty"); return addEnabled(str.substr(prevPos)); } bool handled = false; if (str == "all") handled = _checkCodingStyle = true; else if (str == "style") handled = _checkCodingStyle = true; std::set<std::string> id; id.insert("missingInclude"); id.insert("unusedFunction"); id.insert("information"); if (str == "all") { std::set<std::string>::const_iterator it; for (it = id.begin(); it != id.end(); ++it) _enabled[*it] = true; } else if (id.find(str) != id.end()) { _enabled[str] = true; } else if (!handled) { if (str.empty()) return std::string("cppcheck: --enable parameter is empty"); else return std::string("cppcheck: there is no --enable parameter with the name '" + str + "'"); } return std::string(""); }
std::string Settings::addEnabled(const std::string &str) { // Enable parameters may be comma separated... if (str.find(',') != std::string::npos) { std::string::size_type prevPos = 0; std::string::size_type pos = 0; while ((pos = str.find(',', pos)) != std::string::npos) { if (pos == prevPos) return std::string("cppcheck: --enable parameter is empty"); const std::string errmsg(addEnabled(str.substr(prevPos, pos - prevPos))); if (!errmsg.empty()) return errmsg; ++pos; prevPos = pos; } if (prevPos >= str.length()) return std::string("cppcheck: --enable parameter is empty"); return addEnabled(str.substr(prevPos)); } if (str == "all") { mEnabled |= WARNING | STYLE | PERFORMANCE | PORTABILITY | INFORMATION | UNUSED_FUNCTION | MISSING_INCLUDE; } else if (str == "warning") { mEnabled |= WARNING; } else if (str == "style") { mEnabled |= STYLE; } else if (str == "performance") { mEnabled |= PERFORMANCE; } else if (str == "portability") { mEnabled |= PORTABILITY; } else if (str == "information") { mEnabled |= INFORMATION | MISSING_INCLUDE; } else if (str == "unusedFunction") { mEnabled |= UNUSED_FUNCTION; } else if (str == "missingInclude") { mEnabled |= MISSING_INCLUDE; } #ifdef CHECK_INTERNAL else if (str == "internal") { mEnabled |= INTERNAL; } #endif else { if (str.empty()) return std::string("cppcheck: --enable parameter is empty"); else return std::string("cppcheck: there is no --enable parameter with the name '" + str + "'"); } return std::string(); }
std::string Settings::addEnabled(const std::string &str) { // Enable parameters may be comma separated... if (str.find(',') != std::string::npos) { std::string::size_type prevPos = 0; std::string::size_type pos = 0; while ((pos = str.find(',', pos)) != std::string::npos) { if (pos == prevPos) return std::string("cppcheck: --enable parameter is empty"); const std::string errmsg(addEnabled(str.substr(prevPos, pos - prevPos))); if (!errmsg.empty()) return errmsg; ++pos; prevPos = pos; } if (prevPos >= str.length()) return std::string("cppcheck: --enable parameter is empty"); return addEnabled(str.substr(prevPos)); } if (str == "all") { std::set<std::string>::const_iterator it; for (it = id.begin(); it != id.end(); ++it) { if (*it == "internal") continue; _enabled.insert(*it); } } else if (id.find(str) != id.end()) { _enabled.insert(str); if (str == "information") { _enabled.insert("missingInclude"); } } else { if (str.empty()) return std::string("cppcheck: --enable parameter is empty"); else return std::string("cppcheck: there is no --enable parameter with the name '" + str + "'"); } return std::string(""); }
void MUCAffiliationsView::currentChanged(const QModelIndex& current, const QModelIndex& previous) { Q_UNUSED(previous); // Commenting these optimizations, since they cause too much trouble //bool add_before = previous.isValid() && (model()->flags(previous) & Qt::ItemIsEnabled); //bool remove_before = previous.isValid() && previous.parent().isValid(); bool add_after = current.isValid() && (model()->flags(current) & Qt::ItemIsEnabled); bool remove_after = current.isValid() && current.parent().isValid(); //if (add_before != add_after) emit addEnabled(add_after); //if (remove_before != remove_after) emit removeEnabled(remove_after); }