[LyX/master] Use range-based loops
Yuriy Skalko
yuriy.skalko at gmail.com
Sat Nov 28 21:55:42 UTC 2020
commit e97daf9e13f450fd1828b944c0db94d0efff52c9
Author: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Fri Nov 27 11:09:16 2020 +0200
Use range-based loops
---
src/graphics/GraphicsCache.cpp | 23 ++++++-----------------
1 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/src/graphics/GraphicsCache.cpp b/src/graphics/GraphicsCache.cpp
index dbf9caf..5f89c56 100644
--- a/src/graphics/GraphicsCache.cpp
+++ b/src/graphics/GraphicsCache.cpp
@@ -70,18 +70,10 @@ vector<string> const & Cache::loadableFormats() const
if (!fmts.empty())
return fmts;
- // The formats recognised by LyX
- Formats::const_iterator begin = theFormats().begin();
- Formats::const_iterator end = theFormats().end();
-
- // The formats natively loadable.
- vector<string> nformat = frontend::loadableImageFormats();
-
- vector<string>::const_iterator it = nformat.begin();
- for (; it != nformat.end(); ++it) {
- for (Formats::const_iterator fit = begin; fit != end; ++fit) {
- if (fit->extension() == *it) {
- fmts.push_back(fit->name());
+ for (string const & native_extension : frontend::loadableImageFormats()) {
+ for (Format const & format : theFormats()) {
+ if (format.extension() == native_extension) {
+ fmts.push_back(format.name());
break;
}
}
@@ -89,11 +81,8 @@ vector<string> const & Cache::loadableFormats() const
if (lyxerr.debugging()) {
LYXERR(Debug::GRAPHICS, "LyX recognises the following image formats:");
-
- vector<string>::const_iterator fbegin = fmts.begin();
- vector<string>::const_iterator fend = fmts.end();
- for (vector<string>::const_iterator fit = fbegin; fit != fend; ++fit) {
- LYXERR(Debug::GRAPHICS, *fit << ',');
+ for (string const & format : fmts) {
+ LYXERR(Debug::GRAPHICS, format << ',');
}
}
More information about the lyx-cvs
mailing list