MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / adjust

Method adjust

externals/simplecpp/simplecpp.cpp:182–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182void simplecpp::Location::adjust(const std::string &str)
183{
184 if (strpbrk(str.c_str(), "\r\n") == nullptr) {
185 col += str.size();
186 return;
187 }
188
189 for (std::size_t i = 0U; i < str.size(); ++i) {
190 col++;
191 if (str[i] == '\n' || str[i] == '\r') {
192 col = 1;
193 line++;
194 if (str[i] == '\r' && (i+1)<str.size() && str[i+1]=='\n')
195 ++i;
196 }
197 }
198}
199
200bool simplecpp::Token::isOneOf(const char ops[]) const
201{

Callers 2

stringifyMethod · 0.80
readfileMethod · 0.80

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected