Commit e84b4745 authored by Tom Titcombe's avatar Tom Titcombe
Browse files

Fix clang formatting

parent c714c114
......@@ -343,7 +343,7 @@ void EnggDiffFittingPresenter::processShutDown() {
void EnggDiffFittingPresenter::processLogMsg() {
std::vector<std::string> msgs = m_view->logMsgs();
for (const auto & msg : msgs) {
for (const auto &msg : msgs) {
g_log.information() << msg << '\n';
}
}
......
......@@ -597,7 +597,7 @@ void EnggDiffractionPresenter::processRebinMultiperiod() {
void EnggDiffractionPresenter::processLogMsg() {
std::vector<std::string> msgs = m_view->logMsgs();
for (const auto & msg : msgs) {
for (const auto &msg : msgs) {
g_log.information() << msg << '\n';
}
}
......@@ -682,7 +682,7 @@ std::string EnggDiffractionPresenter::isValidRunNumber(
std::string filename = inputDir.getFileName();
// convert to int or assign it to size_t
for (char & i : filename) {
for (char &i : filename) {
char *str = &i;
if (std::isdigit(*str)) {
run_number += i;
......@@ -736,7 +736,7 @@ std::vector<std::string> EnggDiffractionPresenter::isValidMultiRunNumber(
std::string filename = inputDir.getFileName();
// convert to int or assign it to size_t
for (char & i : filename) {
for (char &i : filename) {
char *str = &i;
if (std::isdigit(*str)) {
run_number += i;
......
......@@ -580,7 +580,7 @@ void DataComparison::diffSelected() {
QList<int> selectedRows;
// Generate a list of selected row numbers
for (auto & selectedItem : selectedItems) {
for (auto &selectedItem : selectedItems) {
int row = selectedItem->row();
if (!selectedRows.contains(row))
selectedRows << selectedItem->row();
......
......@@ -273,7 +273,7 @@ void QtReflRunsTabView::setStopMonitorButtonEnabled(bool enabled) {
*/
void QtReflRunsTabView::setTransferMethods(
const std::set<std::string> &methods) {
for (const auto & method : methods) {
for (const auto &method : methods) {
ui.comboTransferMethod->addItem(method.c_str());
}
}
......@@ -289,7 +289,7 @@ void QtReflRunsTabView::setInstrumentList(
const std::string &defaultInstrument) {
ui.comboSearchInstrument->clear();
for (const auto & it : instruments) {
for (const auto &it : instruments) {
QString instrument = QString::fromStdString(it);
ui.comboSearchInstrument->addItem(instrument);
}
......@@ -451,7 +451,7 @@ std::set<int> QtReflRunsTabView::getSelectedSearchRows() const {
auto selectionModel = ui.tableSearchResults->selectionModel();
if (selectionModel) {
auto selectedRows = selectionModel->selectedRows();
for (auto & selectedRow : selectedRows)
for (auto &selectedRow : selectedRows)
rows.insert(selectedRow.row());
}
return rows;
......
......@@ -139,7 +139,7 @@ std::string QtReflSaveTabView::getCurrentWorkspaceName() const {
std::vector<std::string> QtReflSaveTabView::getSelectedWorkspaces() const {
std::vector<std::string> itemNames;
auto items = m_ui.listOfWorkspaces->selectedItems();
for (auto & item : items) {
for (auto &item : items) {
itemNames.push_back(item->text().toStdString());
}
return itemNames;
......@@ -151,7 +151,7 @@ std::vector<std::string> QtReflSaveTabView::getSelectedWorkspaces() const {
std::vector<std::string> QtReflSaveTabView::getSelectedParameters() const {
std::vector<std::string> paramNames;
auto items = m_ui.listOfLoggedParameters->selectedItems();
for (auto & item : items) {
for (auto &item : items) {
paramNames.push_back(item->text().toStdString());
}
return paramNames;
......@@ -208,7 +208,7 @@ void QtReflSaveTabView::clearParametersList() const {
*/
void QtReflSaveTabView::setWorkspaceList(
const std::vector<std::string> &names) const {
for (const auto & name : names) {
for (const auto &name : names) {
m_ui.listOfWorkspaces->addItem(QString::fromStdString(name));
}
}
......@@ -218,7 +218,7 @@ void QtReflSaveTabView::setWorkspaceList(
*/
void QtReflSaveTabView::setParametersList(
const std::vector<std::string> &logs) const {
for (const auto & log : logs) {
for (const auto &log : logs) {
m_ui.listOfLoggedParameters->addItem(QString::fromStdString(log));
}
}
......
......@@ -67,7 +67,7 @@ MantidQt::CustomInterfaces::ReflMeasureTransferStrategy::transferRuns(
// runs.
TransferResults results(runs, errors);
MapGroupedMeasurement mapOfMeasurements;
for (auto & searchResult : searchResults) {
for (auto &searchResult : searchResults) {
const auto location = searchResult.second.location;
const auto fuzzyName = searchResult.first;
......@@ -100,7 +100,7 @@ MantidQt::CustomInterfaces::ReflMeasureTransferStrategy::transferRuns(
int nextGroupId = 0;
for (auto & mapOfMeasurement : mapOfMeasurements) {
for (auto &mapOfMeasurement : mapOfMeasurements) {
std::string groupName;
......
......@@ -199,7 +199,8 @@ void SANSAddFiles::add2Runs2Add() {
"unusedName", m_SANSForm->new2Add_edit->text().toStdString());
const std::vector<std::string> &nam = commaSep;
for (const auto & i : nam) { // each comma separated item could be a range of run numbers
for (const auto &i :
nam) { // each comma separated item could be a range of run numbers
// specified with a ':' or '-'
QStringList ranges;
std::vector<int> runNumRanges;
......
......@@ -3015,7 +3015,7 @@ void SANSRunWindow::handleDefSaveClick() {
const QStringList algs(getSaveAlgs());
QString saveCommand;
for (const auto & alg : algs) {
for (const auto &alg : algs) {
QString ext = SaveWorkspaces::getSaveAlgExt(alg);
QString fname = fileBase.endsWith(ext) ? fileBase : fileBase + ext;
if (alg == "SaveRKH")
......@@ -3255,7 +3255,7 @@ void SANSRunWindow::handleInstrumentChange() {
QWidget *front_center_widgets[] = {
m_uiForm.front_beam_x, m_uiForm.front_beam_y, m_uiForm.front_radio};
bool loq_selected = (instClass == "LOQ()");
for (auto & front_center_widget : front_center_widgets)
for (auto &front_center_widget : front_center_widgets)
front_center_widget->setEnabled(true);
// Set the label of the radio buttons according to the
// beamline usage:
......@@ -3482,8 +3482,9 @@ void SANSRunWindow::checkList() {
// split up the comma separated list ignoring spaces
Poco::StringTokenizer in(input, ",", Poco::StringTokenizer::TOK_TRIM);
try {
for (const auto & i : in) { // try a lexical cast, we don't need its result only
// if there was an error
for (const auto &i :
in) { // try a lexical cast, we don't need its result only
// if there was an error
boost::lexical_cast<double>(i);
}
// there were no errors
......@@ -3965,7 +3966,7 @@ void SANSRunWindow::transSelectorChanged(int currindex) {
QWidget *wid[] = {m_uiForm.trans_can_label, m_uiForm.transFitOnOff_can,
m_uiForm.transFit_ck_can, m_uiForm.trans_min_can,
m_uiForm.trans_max_can, m_uiForm.trans_opt_can};
for (auto & i : wid)
for (auto &i : wid)
i->setVisible(visible);
}
......
......@@ -128,7 +128,7 @@ void DensityOfStates::run() {
std::vector<std::string> selectedIons;
auto items = m_uiForm.lwIons->selectedItems();
for (auto & item : items)
for (auto &item : items)
selectedIons.push_back(item->text().toStdString());
dosAlgo->setProperty("Ions", selectedIons);
} else if (specType == "IR") {
......
......@@ -204,7 +204,7 @@ void Elwin::run() {
// Load input files
std::string inputWorkspacesString;
for (auto & inputFilename : inputFilenames) {
for (auto &inputFilename : inputFilenames) {
QFileInfo inputFileInfo(inputFilename);
std::string workspaceName = inputFileInfo.baseName().toStdString();
......
......@@ -275,7 +275,7 @@ QMap<QString, QString> IndirectDataReduction::getInstrumentDetails() {
auto component = instrument->getComponentByName(analyser);
// For each parameter we want to get
for (auto & ipfElement : ipfElements) {
for (auto &ipfElement : ipfElements) {
try {
std::string key = ipfElement;
......@@ -289,8 +289,8 @@ QMap<QString, QString> IndirectDataReduction::getInstrumentDetails() {
// In the case that the parameter does not exist
catch (Mantid::Kernel::Exception::NotFoundError &nfe) {
UNUSED_ARG(nfe);
g_log.warning() << "Could not find parameter " << ipfElement << " in instrument "
<< instrumentName << '\n';
g_log.warning() << "Could not find parameter " << ipfElement
<< " in instrument " << instrumentName << '\n';
}
}
......@@ -487,10 +487,10 @@ void IndirectDataReduction::filterUiForFacility(QString facility) {
}
// Add the required tabs
for (auto & enabledTab : enabledTabs) {
for (auto &enabledTab : enabledTabs) {
// Connect the insturment changed signal
connect(this, SIGNAL(newInstrumentConfiguration()), m_tabs[enabledTab].second,
SIGNAL(newInstrumentConfiguration()));
connect(this, SIGNAL(newInstrumentConfiguration()),
m_tabs[enabledTab].second, SIGNAL(newInstrumentConfiguration()));
// Add the tab
m_uiForm.twIDRTabs->addTab(m_tabs[enabledTab].first, enabledTab);
......
......@@ -52,7 +52,7 @@ void updateParameters(
void updateAttributes(
IFunction_sptr function, std::vector<std::string> const &attributeNames,
std::unordered_map<std::string, IFunction::Attribute> const &attributes) {
for (const auto & attributeName : attributeNames) {
for (const auto &attributeName : attributeNames) {
auto const value = attributes.find(attributeName);
if (value != attributes.end())
function->setAttribute(attributeName, value->second);
......
......@@ -76,7 +76,7 @@ QStringList AddWorkspaceDialog::availableWorkspaces() const {
auto &ADS = Mantid::API::AnalysisDataService::Instance();
QStringList workspaceNames;
auto wsNames = ADS.getObjectNames(Mantid::Kernel::DataServiceSort::Sorted);
for (auto & wsName : wsNames) {
for (auto &wsName : wsNames) {
if (ADS.retrieveWS<Mantid::API::MatrixWorkspace>(wsName)) {
workspaceNames << QString::fromStdString(wsName);
continue;
......
......@@ -72,7 +72,7 @@ void DataController::addWorkspace() {
}
if (!matrixWorkspaces.empty()) {
for (auto & matrixWorkspace : matrixWorkspaces) {
for (auto &matrixWorkspace : matrixWorkspaces) {
auto name = QString::fromStdString((*matrixWorkspace).getName());
for (auto &index : indices) {
addWorkspaceSpectrum(name, index, *matrixWorkspace);
......@@ -135,7 +135,7 @@ void DataController::removeSelectedSpectra() {
if (ranges.isEmpty())
return;
QList<int> rows;
for (auto & range : ranges) {
for (auto &range : ranges) {
for (int row = range.topRow(); row <= range.bottomRow(); ++row) {
rows.push_back(row);
}
......
......@@ -237,7 +237,7 @@ void EditLocalParameterDialog::showContextMenu() {
bool hasSelection = false;
for (auto & index : selection) {
for (auto &index : selection) {
if (index.column() == valueColumn)
hasSelection = true;
}
......
......@@ -108,7 +108,7 @@ void MDFFunctionPlotData::updateFunction(const Mantid::API::IFunction &fun) {
}
// Copy the attributes
auto attributes = fun.getAttributeNames();
for (auto & attribute : attributes) {
for (auto &attribute : attributes) {
auto value = fun.getAttribute(attribute);
m_function->setAttribute(attribute, value);
}
......
......@@ -769,8 +769,7 @@ void MultiDatasetFit::setLogNames() {
ws->run().getLogData();
QStringList logNames;
for (auto log : logs) {
if (dynamic_cast<Mantid::Kernel::TimeSeriesProperty<double> *>(
log)) {
if (dynamic_cast<Mantid::Kernel::TimeSeriesProperty<double> *>(log)) {
logNames << QString::fromStdString(log->name());
}
}
......
......@@ -90,7 +90,7 @@ void ALCBaselineModellingModel::disableUnwantedPoints(
// Find points which are in at least one section, and exclude them from
// disable list
for (size_t i = 0; i < numBins; ++i) {
for (const auto & section : sections) {
for (const auto &section : sections) {
if (ws->x(0)[i] >= section.first && ws->x(0)[i] <= section.second) {
toDisable[i] = false;
break; // No need to check other sections
......
......@@ -181,7 +181,7 @@ void ALCInterface::exportResults() {
// Check if any of the above is not empty
bool nothingToExport = true;
for (auto & result : results) {
for (auto &result : results) {
if (result.second) {
nothingToExport = false;
......@@ -196,7 +196,7 @@ void ALCInterface::exportResults() {
AnalysisDataService::Instance().addOrReplace(
groupName, boost::make_shared<WorkspaceGroup>());
for (auto & result : results) {
for (auto &result : results) {
if (result.second) {
std::string wsName = groupName + "_" + result.first;
AnalysisDataService::Instance().addOrReplace(wsName, result.second);
......
......@@ -665,7 +665,7 @@ void groupWorkspaces(const std::string &groupName,
if (group) {
// Exists and is a group -> add missing workspaces to it
for (const auto & inputWorkspace : inputWorkspaces) {
for (const auto &inputWorkspace : inputWorkspaces) {
if (!group->contains(inputWorkspace)) {
group->add(inputWorkspace);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment