MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / normalizeEOL

Function normalizeEOL

Source/JSON/jsoncpp.cpp:509–526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

507}
508
509static std::string normalizeEOL(Reader::Location begin, Reader::Location end) {
510 std::string normalized;
511 normalized.reserve(end - begin);
512 Reader::Location current = begin;
513 while (current != end) {
514 char c = *current++;
515 if (c == '\r') {
516 if (current != end && *current == '\n')
517 // convert dos EOL
518 ++current;
519 // convert Mac EOL
520 normalized += '\n';
521 } else {
522 normalized += c;
523 }
524 }
525 return normalized;
526}
527
528void Reader::addComment(Location begin, Location end, CommentPlacement placement) {
529 assert(collectComments_);

Callers 1

addCommentMethod · 0.70

Calls 1

reserveMethod · 0.45

Tested by

no test coverage detected