Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Nov 13, 2023
1 parent bbd5162 commit 606254f
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions avogadro/io/fileformatmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ bool FileFormatManager::addFormat(FileFormat* format)
appendError("Format " + format->identifier() + " already loaded.");
return false;
}
for (auto & m_format : m_formats) {
for (auto& m_format : m_formats) {
if (m_format == format) {
appendError("The format object was already loaded.");
return false;
Expand All @@ -147,11 +147,11 @@ bool FileFormatManager::addFormat(FileFormat* format)
m_formats.push_back(format);
m_identifiers[format->identifier()].push_back(index);
std::vector<std::string> mimes = format->mimeTypes();
for (auto & mime : mimes) {
for (auto& mime : mimes) {
m_mimeTypes[mime].push_back(index);
}
std::vector<std::string> extensions = format->fileExtensions();
for (auto & extension : extensions) {
for (auto& extension : extensions) {
m_fileExtensions[extension].push_back(index);
}

Expand All @@ -161,7 +161,7 @@ bool FileFormatManager::addFormat(FileFormat* format)
namespace {
// Lookup each key from "keys" in "map", and remove "val" from the Map's
// data value (which is a vector of ValueType)
template<typename Map, typename VectorOfKeys, typename ValueType>
template <typename Map, typename VectorOfKeys, typename ValueType>
void removeFromMap(Map& map, const VectorOfKeys& keys, const ValueType& val)
{
for (auto key = keys.begin(), keyEnd = keys.end(); key != keyEnd; ++key) {
Expand All @@ -172,13 +172,12 @@ void removeFromMap(Map& map, const VectorOfKeys& keys, const ValueType& val)
if (vec.size() <= 1) {
map.erase(*key);
} else {
auto newEnd =
std::remove(vec.begin(), vec.end(), val);
auto newEnd = std::remove(vec.begin(), vec.end(), val);
vec.resize(newEnd - vec.begin());
}
}
}
}
} // namespace

bool FileFormatManager::removeFormat(const std::string& identifier)
{
Expand Down Expand Up @@ -305,7 +304,7 @@ FileFormatManager::FileFormatManager()
FileFormatManager::~FileFormatManager()
{
// Delete the file formats that were loaded.
for (auto & m_format : m_formats) {
for (auto& m_format : m_formats) {
delete m_format;
}
m_formats.clear();
Expand All @@ -316,9 +315,9 @@ std::vector<std::string> FileFormatManager::filteredKeysFromFormatMap(
const FileFormatManager::FormatIdMap& fmap) const
{
std::vector<std::string> result;
for (const auto & it : fmap) {
for (auto formatIt = it.second.begin();
formatIt != it.second.end(); ++formatIt) {
for (const auto& it : fmap) {
for (auto formatIt = it.second.begin(); formatIt != it.second.end();
++formatIt) {
if (filter == FileFormat::None ||
(m_formats[*formatIt]->supportedOperations() & filter) == filter) {
result.push_back(it.first);
Expand Down Expand Up @@ -385,4 +384,4 @@ void FileFormatManager::appendError(const std::string& errorMessage)
m_error += errorMessage + "\n";
}

} // end Avogadro namespace
} // namespace Avogadro::Io

0 comments on commit 606254f

Please sign in to comment.