mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Modernize: Use range-based for loops for readability (#762)
Also run clang-format on these files as requested
This commit is contained in:

committed by
Jesse Beder

parent
21d75fa4cd
commit
b650bc8287
@@ -199,11 +199,11 @@ bool IsValidPlainScalar(const std::string& str, FlowType::value flowType,
|
||||
|
||||
bool IsValidSingleQuotedScalar(const std::string& str, bool escapeNonAscii) {
|
||||
// TODO: check for non-printable characters?
|
||||
for (std::size_t i = 0; i < str.size(); i++) {
|
||||
if (escapeNonAscii && (0x80 <= static_cast<unsigned char>(str[i]))) {
|
||||
for (char ch : str) {
|
||||
if (escapeNonAscii && (0x80 <= static_cast<unsigned char>(ch))) {
|
||||
return false;
|
||||
}
|
||||
if (str[i] == '\n') {
|
||||
if (ch == '\n') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -217,8 +217,8 @@ bool IsValidLiteralScalar(const std::string& str, FlowType::value flowType,
|
||||
}
|
||||
|
||||
// TODO: check for non-printable characters?
|
||||
for (std::size_t i = 0; i < str.size(); i++) {
|
||||
if (escapeNonAscii && (0x80 <= static_cast<unsigned char>(str[i]))) {
|
||||
for (char ch : str) {
|
||||
if (escapeNonAscii && (0x80 <= static_cast<unsigned char>(ch))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user