mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-15 15:16:47 +02:00
STYLE: Use range-based loops from C++11
C++11 Range based for loops can be used in Used as a more readable equivalent to the traditional for loop operating over a range of values, such as all elements in a container, in the forward direction.. Range based loopes are more explicit for only computing the end location once for containers. SRCDIR=/Users/johnsonhj/src/jsoncpp/ #My local SRC BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/ run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-loop-convert -header-filter=.* -fix
This commit is contained in:

committed by
Hans Johnson

parent
3beadff472
commit
cbeed7b076
@@ -818,9 +818,7 @@ JSONCPP_STRING Reader::getFormatedErrorMessages() const {
|
||||
|
||||
JSONCPP_STRING Reader::getFormattedErrorMessages() const {
|
||||
JSONCPP_STRING formattedMessage;
|
||||
for (Errors::const_iterator itError = errors_.begin();
|
||||
itError != errors_.end(); ++itError) {
|
||||
const ErrorInfo& error = *itError;
|
||||
for (const auto & error : errors_) {
|
||||
formattedMessage +=
|
||||
"* " + getLocationLineAndColumn(error.token_.start_) + "\n";
|
||||
formattedMessage += " " + error.message_ + "\n";
|
||||
@@ -833,9 +831,7 @@ JSONCPP_STRING Reader::getFormattedErrorMessages() const {
|
||||
|
||||
std::vector<Reader::StructuredError> Reader::getStructuredErrors() const {
|
||||
std::vector<Reader::StructuredError> allErrors;
|
||||
for (Errors::const_iterator itError = errors_.begin();
|
||||
itError != errors_.end(); ++itError) {
|
||||
const ErrorInfo& error = *itError;
|
||||
for (const auto & error : errors_) {
|
||||
Reader::StructuredError structured;
|
||||
structured.offset_start = error.token_.start_ - begin_;
|
||||
structured.offset_limit = error.token_.end_ - begin_;
|
||||
@@ -1833,9 +1829,7 @@ JSONCPP_STRING OurReader::getLocationLineAndColumn(Location location) const {
|
||||
|
||||
JSONCPP_STRING OurReader::getFormattedErrorMessages() const {
|
||||
JSONCPP_STRING formattedMessage;
|
||||
for (Errors::const_iterator itError = errors_.begin();
|
||||
itError != errors_.end(); ++itError) {
|
||||
const ErrorInfo& error = *itError;
|
||||
for (const auto & error : errors_) {
|
||||
formattedMessage +=
|
||||
"* " + getLocationLineAndColumn(error.token_.start_) + "\n";
|
||||
formattedMessage += " " + error.message_ + "\n";
|
||||
@@ -1848,9 +1842,7 @@ JSONCPP_STRING OurReader::getFormattedErrorMessages() const {
|
||||
|
||||
std::vector<OurReader::StructuredError> OurReader::getStructuredErrors() const {
|
||||
std::vector<OurReader::StructuredError> allErrors;
|
||||
for (Errors::const_iterator itError = errors_.begin();
|
||||
itError != errors_.end(); ++itError) {
|
||||
const ErrorInfo& error = *itError;
|
||||
for (const auto & error : errors_) {
|
||||
OurReader::StructuredError structured;
|
||||
structured.offset_start = error.token_.start_ - begin_;
|
||||
structured.offset_limit = error.token_.end_ - begin_;
|
||||
|
Reference in New Issue
Block a user