MCPcopy Create free account
hub / github.com/Illumina/paragraph / getLocationLineAndColumn

Method getLocationLineAndColumn

external/jsoncpp/jsoncpp.cpp:1004–1025  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1002}
1003
1004void Reader::getLocationLineAndColumn(Location location,
1005 int& line,
1006 int& column) const {
1007 Location current = begin_;
1008 Location lastLineStart = current;
1009 line = 0;
1010 while (current < location && current != end_) {
1011 Char c = *current++;
1012 if (c == '\r') {
1013 if (*current == '\n')
1014 ++current;
1015 lastLineStart = current;
1016 ++line;
1017 } else if (c == '\n') {
1018 lastLineStart = current;
1019 ++line;
1020 }
1021 }
1022 // column & line start at 1
1023 column = int(location - lastLineStart) + 1;
1024 ++line;
1025}
1026
1027JSONCPP_STRING Reader::getLocationLineAndColumn(Location location) const {
1028 int line, column;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected